-
Notifications
You must be signed in to change notification settings - Fork 1
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
Replace swagger-cli with go-swagger. #457
Merged
NullHypothesis
merged 4 commits into
master
from
phw/sc-47949/bring-openapi-spec-and-models-back-in-sync
May 22, 2024
Merged
Replace swagger-cli with go-swagger. #457
NullHypothesis
merged 4 commits into
master
from
phw/sc-47949/bring-openapi-spec-and-models-back-in-sync
May 22, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NullHypothesis
force-pushed
the
phw/sc-47949/bring-openapi-spec-and-models-back-in-sync
branch
from
May 22, 2024 18:34
acc66bc
to
488e21f
Compare
This PR replaces the swagger-cli-based Azure pipeline with a go-swagger-based GitHub workflow. Ever since Nov 2023, swagger-cli is archived and the pipeline failed to catch a schema issue that I ran into while using go-swagger. We appear to be using go-swagger to generate Cloud-UI's and Cloud-REST's model files, so we should use the very same tool to validate the spec files.
When building models or validating the spec, go-swagger would fail with the following error: $ swagger validate openapi-v1.yaml [...] The swagger spec at "openapi-v1.yaml" is invalid against swagger specification 2.0. See errors below: - "paths./invitations/share_payment/{namespace}.post.parameters" must validate one and only one schema (oneOf). Found none valid - paths./invitations/share_payment/{namespace}.post.parameters.schema in body is a forbidden property - paths./invitations/share_payment/{namespace}.post.parameters.in in body should be one of [header] - paths./invitations/share_payment/{namespace}.post.parameters.type in body should be one of [string number boolean integer array] - "/invitations/share_payment/{namespace}.POST.parameters.email_invite" must validate one and only one schema (oneOf). Found none valid - /invitations/share_payment/{namespace}.POST.parameters.email_invite.schema in body is a forbidden property - /invitations/share_payment/{namespace}.POST.parameters.email_invite.type in body should be one of [string number boolean integer array] - /invitations/share_payment/{namespace}.POST.parameters.email_invite.in in body should be one of [header]
NullHypothesis
force-pushed
the
phw/sc-47949/bring-openapi-spec-and-models-back-in-sync
branch
from
May 22, 2024 18:55
4ca0945
to
75fc522
Compare
NullHypothesis
changed the title
Add validation workflow.
Replace swagger-cli with go-swagger.
May 22, 2024
snagles
approved these changes
May 22, 2024
thetorpedodog
approved these changes
May 22, 2024
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Install go-swagger | ||
run: go install github.com/go-swagger/go-swagger/cmd/swagger@latest |
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.
it might be worth specifying an exact version here
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.
Good point – fixed in fa19c9e.
This prevents the workflow from mysteriously failing some time in the future due to backward-incompatible changes. Thanks to Paul for pointing this out.
...for consistency.
NullHypothesis
deleted the
phw/sc-47949/bring-openapi-spec-and-models-back-in-sync
branch
May 22, 2024 22:17
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR replaces the swagger-cli-based Azure pipeline with a go-swagger-based GitHub workflow. Ever since Nov 2023, swagger-cli is archived and the pipeline failed to catch a schema issue that I ran into while using go-swagger. We appear to be using go-swagger to generate Cloud-UI's and Cloud-REST's model files, so we should use the very same tool to validate the spec. It remains a mystery why swagger-cli and go-swagger disagree on what constitutes a valid spec.