-
Notifications
You must be signed in to change notification settings - Fork 14
CLOUDP-304053: IPA-106:Create - The resource must be the request body (Refinement) #548
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
Super important assumption! We need to have it across all rules! |
| ##### Implementation details | ||
| Validation checks the POST method for resource collection paths. | ||
| - Validation ignores resources without a Get method. |
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.
| - Validation ignores resources without a Get method. | |
| - Validation ignores resources without a GET method. |
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.
Seems like wider issue. Can be done across all the docs.
| if (postRequestSchemaRef && getResponseSchemaRef) { | ||
| const postRequestSchemaName = getSchemaNameFromRef(postRequestSchemaRef); | ||
| const getResponseSchemaName = getSchemaNameFromRef(getResponseSchemaRef); | ||
| if (postRequestSchemaName === getResponseSchemaName) { | ||
| return []; | ||
| } | ||
| } |
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.
Why not compare all the refs instead.
| if (postRequestSchemaRef && getResponseSchemaRef) { | |
| const postRequestSchemaName = getSchemaNameFromRef(postRequestSchemaRef); | |
| const getResponseSchemaName = getSchemaNameFromRef(getResponseSchemaRef); | |
| if (postRequestSchemaName === getResponseSchemaName) { | |
| return []; | |
| } | |
| } | |
| if (postRequestSchemaRef && getResponseSchemaRef) { | |
| if (postRequestSchemaRef === getResponseSchemaRef) { | |
| return []; | |
| } | |
| } |
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.
Applied on your behalf as this is minor correction. We can restore it if that is an issue.
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.
There are multiple ways to define components in openapi thus relying on last part of the reference is not reliable:
| return removePropertyByFlag(schema, 'writeOnly'); | ||
| export function removeRequestProperties(schema) { | ||
| let result = removePropertiesByFlag(schema, 'writeOnly'); | ||
| return removePropertyKeys(result, 'title', 'description', 'required'); |
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.
Not blocking/General comment:
hardcoding filtered properties in helper method can be seen as technical debt. Helper should get those values injected as array from config or caller. Otherwise we might be seeing ourselves creating urgent PR's to add more properties etc. over the time.
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.
My commit only fixed formatting.
Proposed changes
Jira ticket: CLOUDP-304053
Refinements:
-- Properties will be compared based on their names and types
-- Resolved oneOf, allOf, anyOf, and discriminator field values are expected to be completely same
Checklist
Changes to Spectral
Further comments