-
Notifications
You must be signed in to change notification settings - Fork 14
CLOUDP-331821: Add op ID override validation #841
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
}; | ||
|
||
describe('tools/spectral/ipa/rulesets/functions/utils/extensions.js', () => { | ||
describe('hasMethodWithVerbOverride', () => { |
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.
Refactored custom method rule approach to apply to each operation instead of each path in the OAS.
This method not needed, removed test
expect(generateOperationID('update', '/groups/{groupId}/clusters/{clusterName}')).toEqual('updateGroupCluster'); | ||
expect(generateOperationID('pause', '/groups/{groupId}/clusters/{clusterName}')).toEqual('pauseGroupCluster'); | ||
}); | ||
describe('generateOperationID', () => { |
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.
Added a describe to wrap these as part of generateOperationID
function
* @param endpoint the endpoint to evaluate | ||
* @returns {boolean} true if the endpoint has a nested method with the extension, otherwise false | ||
*/ | ||
export function hasMethodWithVerbOverride(endpoint) { |
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.
Refactored custom method rule approach to apply to each operation instead of each path in the OAS.
This method not needed anymore
tools/spectral/ipa/rulesets/functions/utils/validations/validateOperationIdAndReturnErrors.js
Outdated
Show resolved
Hide resolved
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
Jira ticket: CLOUDP-331821
Adding support for operation ID override validation. Errors are returned when:
Additional changes
Moved the operation ID validation logic to a shared validation function called by each rule.
Added try catches to each rule in case of spectral errors.
Refactored custom method rule approach to apply to each operation instead of each path in the OAS.
Testing
Added unit tests for each introduced function.
Follow-ups
The rules are not yet enabled. This will be done with E2E testing in a later ticket.