File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed
tools/cli/internal/openapi/filter Expand file tree Collapse file tree 2 files changed +5
-6
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,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}
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