-
Notifications
You must be signed in to change notification settings - Fork 14
CLOUDP-302984: IPA rule Get methods should return data for a single resource #463
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
| */ | ||
| export function getAllSuccessfulGetResponseSchemas(pathObject) { | ||
| const responses = pathObject['get']['responses']; | ||
| export function getAllSuccessfulResponseSchemas(operationObject) { |
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.
Updated this one to return successful response schemas for any operation, so we can reuse it more. Also returning the path for each schema, to be used in rule evaluations
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
|
|
||
| if (hasException(responseObject, RULE_NAME)) { | ||
| collectException(responseObject, RULE_NAME, fullPath); | ||
| } else if (schemaIsPaginated(schema) || schemaIsArray(schema)) { |
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.
Question - when we have PR level job does this validator runs against dev or production schema?
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 will be for the dev schema
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.
Perfect!
Proposed changes
Adds new IPA rule
xgen-IPA-104-get-method-returns-single-resourceto check that get operations don't return paginated or array responses. Applied toGETfor standard resources and singleton resources.Jira ticket: CLOUDP-302984
Testing
See all violations: https://github.com/mongodb/openapi/pull/463/checks?check_run_id=37928281663
Example violation: