Skip to content

Commit

Permalink
Sort enum arrays for deterministic JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
garfieldnate committed Jan 9, 2025
1 parent 8ee94e8 commit 764fcbd
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;

import java.util.Arrays;
import java.util.Objects;

@JsonDeserialize(builder = Vertex.Builder.class)
Expand Down Expand Up @@ -43,7 +44,12 @@ enum VertexType {
this.comment = comment;
this.foreignDMPath = foreignDMPath;
this.foreignVertex = foreignVertex;
this.enumChoices = enumChoices;
if (enumChoices != null) {
this.enumChoices = Arrays.copyOf(enumChoices, enumChoices.length);
Arrays.sort(this.enumChoices);
} else {
this.enumChoices = null;
}
this.min = min;
this.max = max;

Expand Down

0 comments on commit 764fcbd

Please sign in to comment.