-
Notifications
You must be signed in to change notification settings - Fork 14
CLOUDP-287247: IPA-109: Validate custom method must use colon (:) followed by the custom verb #328
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
…lowed by the custom verb
} | ||
|
||
const isCamelCase = casing(methodName, { type: 'camel', disallowDigits: true }); | ||
if (isCamelCase !== undefined) { |
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.
undefined
means that the methodName
is validated against camelCase
tools/spectral/ipa/rulesets/functions/eachCustomMethodMustUseCamelCase.js
Outdated
Show resolved
Hide resolved
tools/spectral/ipa/rulesets/functions/eachCustomMethodMustUseCamelCase.js
Outdated
Show resolved
Hide resolved
tools/spectral/ipa/rulesets/functions/eachCustomMethodMustUseCamelCase.js
Outdated
Show resolved
Hide resolved
const isCamelCase = casing(methodName, { type: 'camel', disallowDigits: true }); | ||
if (isCamelCase !== undefined) { | ||
return ERROR_RESULT; | ||
} |
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.
const isCamelCase = casing(methodName, { type: 'camel', disallowDigits: true }); | |
if (isCamelCase !== undefined) { | |
return ERROR_RESULT; | |
} | |
return casing(methodName, { type: 'camel', disallowDigits: true }); |
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.
If you want ot customize the error message, you can change the yaml here:
message: '{{error}} http://go/ipa/109'
-> message: 'Custom error message here. http://go/ipa/109'
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 would return undefined
if validated or something like {... use camel case}
if not validated.
Also, we disregard returning ERROR_RESULT
.
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.
If you want ot customize the error message, you can change the yaml here:
message: '{{error}} http://go/ipa/109' -> message: 'Custom error message here. http://go/ipa/109'
I can send a custom message which includes the problematic method name
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.
Ah I see, yeah it would be nice to have {methodName} must use camelCase
, let's go with original approach and add the evaluated string to the message 👍
tools/spectral/ipa/rulesets/functions/utils/resourceEvaluation.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, one nit on the error message 👍
Proposed changes
Jira ticket: CLOUDP-287247
Implement the rule for custom method must use
camelCase
Checklist
Changes to Spectral
Further comments