Skip to content

Commit bad56e3

Browse files
authored
Update annotation test to check properties instead of root types (#3651)
## Changes Previously, it was checking only the root type, so it wasn't possible to have different properties in openapi_overrides and custom overrides of the same root type Also updated message to make it more clear: <img width="982" height="86" alt="image" src="https://github.com/user-attachments/assets/49493c88-da6e-4e2f-b61f-dfe8141e6170" /> ## Why Tests were unexpectedly failing in this PR #3635 ## Tests <!-- How have you tested the changes? --> <!-- If your PR needs to be included in the release notes for next release, add a separate entry in NEXT_CHANGELOG.md as part of your PR. -->
1 parent 165bd50 commit bad56e3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

bundle/internal/schema/main_test.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,18 @@ func TestNoDuplicatedAnnotations(t *testing.T) {
132132
"annotations.yml",
133133
}
134134

135-
annotations := map[string]bool{}
135+
annotations := map[string]string{}
136136
for _, file := range files {
137137
annotationsFile, err := getAnnotations(file)
138138
assert.NoError(t, err)
139-
for k := range annotationsFile {
140-
if _, ok := annotations[k]; ok {
141-
t.Errorf("Annotation `%s` is duplicated in %s", k, file)
139+
for typ, props := range annotationsFile {
140+
for prop := range props {
141+
key := typ + "_" + prop
142+
if prevFile, ok := annotations[key]; ok {
143+
t.Errorf("Annotation `%s` is duplicated in %s and %s", key, prevFile, file)
144+
}
145+
annotations[key] = file
142146
}
143-
annotations[k] = true
144147
}
145148
}
146149
}

0 commit comments

Comments
 (0)