Skip to content

Commit

Permalink
Sort list of required attributes in JSON schema (#106)
Browse files Browse the repository at this point in the history
We are fetching the JSON schema from OCSF server and committing it to
a repo. The order of the required fields changes randomly, generating 
unnecessarily large diffs.

Co-authored-by: Lukáš Křečan <[email protected]>
  • Loading branch information
lukas-krecan and lukas-krecan-s1 authored Aug 20, 2024
1 parent 206a113 commit d4f2b03
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/schema/json_schema.ex
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ defmodule Schema.JsonSchema do
end

defp put_required(map, required) do
Map.put(map, "required", required)
Map.put(map, "required", Enum.sort(required))
end

defp encode_objects(schema, nil) do
Expand Down

0 comments on commit d4f2b03

Please sign in to comment.