Skip to content

Commit bbca316

Browse files
CLOUDP-308422: Addressed follow up comments (#602)
1 parent c657a6a commit bbca316

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

tools/cli/internal/openapi/filter/sunset.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package filter
1616

1717
import (
18+
"maps"
1819
"strings"
1920

2021
"github.com/getkin/kin-openapi/openapi3"
@@ -55,12 +56,9 @@ func applyOnOperation(op *openapi3.Operation) {
5556
}
5657

5758
for _, content := range response.Value.Content {
58-
if v, ok := content.Extensions["x-sunset"]; ok {
59-
if v != sunsetToBeDecided {
60-
continue
61-
}
62-
delete(content.Extensions, "x-sunset")
63-
}
59+
maps.DeleteFunc(content.Extensions, func(_ string, v any) bool {
60+
return v == sunsetToBeDecided
61+
})
6462
}
6563
}
6664
}

tools/cli/internal/openapi/filter/sunset_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ func TestSunsetFilter_Apply(t *testing.T) {
326326

327327
for _, tc := range testCases {
328328
t.Run(tc.name, func(t *testing.T) {
329+
t.Parallel()
329330
f := &SunsetFilter{
330331
oas: tc.initSpec,
331332
}

0 commit comments

Comments
 (0)