File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
tools/cli/internal/openapi/filter Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 1515package filter
1616
1717import (
18+ "maps"
1819 "strings"
1920
2021 "github.com/getkin/kin-openapi/openapi3"
@@ -55,12 +56,12 @@ 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" )
59+ if content .Extensions == nil {
60+ continue
6361 }
62+ maps .DeleteFunc (content .Extensions , func (key string , v any ) bool {
63+ return v == sunsetToBeDecided
64+ })
6465 }
6566 }
6667}
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments