File tree Expand file tree Collapse file tree 2 files changed +392
-291
lines changed
tools/cli/internal/openapi/filter Expand file tree Collapse file tree 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 {
4949 return nil
5050}
5151
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.
5256func applyOnOperation (op * openapi3.Operation ) {
57+ // 1) Check the "sunset" extension in the response
5358 for key , response := range op .Responses .Map () {
5459 if ! strings .HasPrefix (key , "20" ) {
5560 continue
@@ -61,4 +66,9 @@ func applyOnOperation(op *openapi3.Operation) {
6166 })
6267 }
6368 }
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+ })
6474}
You can’t perform that action at this time.
0 commit comments