-
Notifications
You must be signed in to change notification settings - Fork 14
CLOUDP-305821: IPA Validation Repo Documentation #671
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
tools/spectral/ipa/CONTRIBUTING.md
Outdated
| "x-xgen-IPA-exception": { | ||
| "xgen-IPA-104-resource-has-GET": "Legacy API, not used by infrastructure-as-code tooling", | ||
| } | ||
| ``` |
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.
Copy part from the spec when you mention exception placements or reference to openapi file as example of exceptions
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.
Exception placements are also referring to the MMS Java code, should we include it?
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 meant that you can list examples where exception can be placed or not placed.
Example:
For example on how to place exceptions please refer to the atlas openapi file [ref]
Or
Exceptions can be typically correlated with spectral `given` value and placed on:
- in path object
- in each http method, requests and responses
- components. schemas objects
tools/spectral/ipa/CONTRIBUTING.md
Outdated
| ### Resource & Singleton Evaluation | ||
|
|
||
| In the IPA Spectral validation, a resource can be identified using a resource collection path. | ||
|
|
||
| For example, resource collection path: `/resource` | ||
|
|
||
| - To get all paths and the path objects for this resource, use [getResourcePathItems](https://github.com/mongodb/openapi/blob/99823b3dfd315f892c5f64f1db50f2124261929c/tools/spectral/ipa/rulesets/functions/utils/resourceEvaluation.js#L143) | ||
|
|
||
| - Will return path objects for paths (if present): | ||
| - Resource collection path `/resource` | ||
| - Single resource path `/resource + /{someId}` | ||
| - Custom method path(s) | ||
| - `/resource + /{someId} + :customMethod` | ||
| - `/resource + :customMethod` | ||
|
|
||
| - To check if a resource is a singleton, take the returned object from [getResourcePathItems](https://github.com/mongodb/openapi/blob/99823b3dfd315f892c5f64f1db50f2124261929c/tools/spectral/ipa/rulesets/functions/utils/resourceEvaluation.js#L143) and evaluate the resource using [isSingletonResource](https://github.com/mongodb/openapi/blob/99823b3dfd315f892c5f64f1db50f2124261929c/tools/spectral/ipa/rulesets/functions/utils/resourceEvaluation.js#L71) | ||
| - To check if a path belongs to a resource collection, use [isResourceCollectionIdentifier](https://github.com/mongodb/openapi/blob/99823b3dfd315f892c5f64f1db50f2124261929c/tools/spectral/ipa/rulesets/functions/utils/resourceEvaluation.js#L13) | ||
| - To check if a path belongs to a single resource, use [isSingleResourceIdentifier](https://github.com/mongodb/openapi/blob/99823b3dfd315f892c5f64f1db50f2124261929c/tools/spectral/ipa/rulesets/functions/utils/resourceEvaluation.js#L31) | ||
|
|
||
|  Note: Paths like `/resource/resource` or `/resource/{id}/{id}` are not evaluated as valid resource or single resource paths using isResourceCollectionIdentifier or isSingleResourceIdentifier. |
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.
Wondering if that can be incorporated into rules documentation?
This would not be typical content in Contributing
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 think this is an implementation detail, so I thought that it might stay here in contributing. I will rephrase it a bit
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.
Awesome PR! Thank you for adding those changes!
All comments optional
Proposed changes
Jira ticket: CLOUDP-305821
Checklist
Changes to Spectral
Further comments