File tree 2 files changed +392
-291
lines changed
tools/cli/internal/openapi/filter
2 files changed +392
-291
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,12 @@ func (f *SunsetFilter) Apply() error {
49
49
return nil
50
50
}
51
51
52
+ // applyOnOperation removes the "sunset" extension if its value is set to "sunsetToBeDecided".
53
+ // The "sunset" extension can be located in two places.
54
+ // 1) Within the 20X response.
55
+ // 2) As part of the operation itself.
52
56
func applyOnOperation (op * openapi3.Operation ) {
57
+ // 1) Check the "sunset" extension in the response
53
58
for key , response := range op .Responses .Map () {
54
59
if ! strings .HasPrefix (key , "20" ) {
55
60
continue
@@ -61,4 +66,9 @@ func applyOnOperation(op *openapi3.Operation) {
61
66
})
62
67
}
63
68
}
69
+
70
+ // 2) Check the "sunset" extension as part of the operation
71
+ maps .DeleteFunc (op .Extensions , func (_ string , v any ) bool {
72
+ return v == sunsetToBeDecided
73
+ })
64
74
}
You can’t perform that action at this time.
0 commit comments