Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tools/cli/internal/openapi/filter/sunset.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ func (f *SunsetFilter) Apply() error {
return nil
}

// applyOnOperation removes the "sunset" extension if its value is set to "sunsetToBeDecided".
// The "sunset" extension can be located in two places.
// 1) Within the 20X response.
// 2) As part of the operation itself.
func applyOnOperation(op *openapi3.Operation) {
// 1) Check the "sunset" extension in the response
for key, response := range op.Responses.Map() {
if !strings.HasPrefix(key, "20") {
continue
Expand All @@ -61,4 +66,9 @@ func applyOnOperation(op *openapi3.Operation) {
})
}
}

// 2) Check the "sunset" extension as part of the operation
maps.DeleteFunc(op.Extensions, func(_ string, v any) bool {
return v == sunsetToBeDecided
})
}
Loading
Loading