Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/parser/schema_errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ func rewriteAdditionalPropertiesError(message string) string {
return message
}

// normalizeAdditionalPropertyList strips quotes, trims whitespace, and sorts the
// comma-separated property names so that diagnostics are deterministic regardless
// of the order in which the schema validator emits them.
func normalizeAdditionalPropertyList(raw string) string {
raw = strings.ReplaceAll(raw, "'", "")
parts := strings.Split(raw, ",")
Expand Down
3 changes: 2 additions & 1 deletion pkg/parser/schema_errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ func TestRewriteAdditionalPropertiesErrorOrdering(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := rewriteAdditionalPropertiesError(tt.in)
assert.Equal(t, tt.want, got)
assert.Equal(t, tt.want, got,
"rewriteAdditionalPropertiesError(%q) = %q, want %q", tt.in, got, tt.want)
})
}
}