From a7f304fb25a548b35de4daf209af640a13a2bd2f Mon Sep 17 00:00:00 2001 From: GitHub Copilot Date: Sun, 22 Feb 2026 18:56:53 +0000 Subject: [PATCH] parser: add doc comment and assertion messages to normalizeAdditionalPropertyList - Add doc comment to normalizeAdditionalPropertyList explaining its purpose (strips quotes, trims whitespace, sorts for determinism) - Add descriptive assertion message to TestRewriteAdditionalPropertiesErrorOrdering for consistency with the rest of schema_errors_test.go Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- pkg/parser/schema_errors.go | 3 +++ pkg/parser/schema_errors_test.go | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/parser/schema_errors.go b/pkg/parser/schema_errors.go index 00868f3c2ba..a190ccb2b6a 100644 --- a/pkg/parser/schema_errors.go +++ b/pkg/parser/schema_errors.go @@ -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, ",") diff --git a/pkg/parser/schema_errors_test.go b/pkg/parser/schema_errors_test.go index 37608a391e4..bcb707edef3 100644 --- a/pkg/parser/schema_errors_test.go +++ b/pkg/parser/schema_errors_test.go @@ -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) }) } }