-
Notifications
You must be signed in to change notification settings - Fork 14
CLOUDP-306573: IPA rule - plaintext repsonse has example #628
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
|
IPA failure related to |
| with: | ||
| file_glob: v2.yaml | ||
| spectral_ruleset: tools/spectral/ipa/ipa-spectral.yaml | ||
| run: npx spectral lint v2.yaml --ruleset=./tools/spectral/ipa/ipa-spectral.yaml |
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.
❤️
| message: '{{error}} https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-117-plaintext-response-must-have-example' | ||
| severity: warn | ||
| given: | ||
| - '$.paths[*][get,put,post,delete,options,head,patch,trace].responses[*].content' |
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: I know this comes a long way but.. Do we need to specify them? Do you remember what is the reason behind specifying HTTP methods?
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.
Yes, if we don't specify them this will also target other things like extension properties as well. For this line specifically the risk is pretty low to have an extension with responses and content, but just as a safe-guard
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.
LGTM
Proposed changes
New rule
xgen-IPA-117-plaintext-response-must-have-examplechecks that 2xx responses (non-json and non-yaml) have examples in the object or in the schema.Also updated the IPA validation that runs on the PRs to use the spectral CLI instead of the action, since the action runs on a downloaded spec it can't show the annotations in the PR as a result. The spectral CLI output is a bit more useful as it shows all warnings/errors and the component that is violating.
Before:
After:
Jira ticket: CLOUDP-306573