-
Notifications
You must be signed in to change notification settings - Fork 14
fix: Fix foascli sunset list
to print sunset endpoints with deterministic order
#804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
foascli sunset list
foascli sunset list
foascli sunset list
to print sunset endpoints with deterministic order
return nil | ||
keysContent := slices.Collect(maps.Keys(content)) | ||
// Regex to find a date in YYYY-MM-DD format. | ||
dateRegex := regexp.MustCompile(`\d{4}-\d{2}-\d{2}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q: What about upcoming and preview?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
upcoming
will sunset with the related stable api so we will get the sunset date from the stable api.
Regarding preview
is a bit tricky, I need to think about how to add support for it and if it makes sense 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will create a follow up ticket for preview
Proposed changes
This pull request introduces enhancements to the sunset listing functionality, including sorting improvements, additional test coverage, and updates to handle API content extensions. The changes aim to improve the accuracy and reliability of the sunset data processing and testing.
Enhancements to sunset listing functionality:
Path
andOperation
in ascending order to ensure consistent output. (tools/cli/internal/cli/sunset/list.go
, tools/cli/internal/cli/sunset/list.goR56-R63)contentExtensions
function to sort API content by date using a regex and return the extensions of the earliest version. (tools/cli/internal/openapi/sunset/sunset.go
, tools/cli/internal/openapi/sunset/sunset.goL98-R119)Testing improvements:
TestList_Run
test to include validation of output against expected results using JSON unmarshalling and deep equality checks. (tools/cli/internal/cli/sunset/list_test.go
, tools/cli/internal/cli/sunset/list_test.goR34-R135)tools/cli/internal/cli/sunset/list_test.go
, tools/cli/internal/cli/sunset/list_test.goR34-R135)