-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Fix for Issue 346 #364
base: master
Are you sure you want to change the base?
Fix for Issue 346 #364
Conversation
We require all PRs to follow Conventional Commits specification.
|
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.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
Quality Gate passedIssues Measures |
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.
Thanks for the PR! Main blocker is adding a test. I'd be happy to see the original issue's example asyncapi document added in /mocks as asyncapi version 2.0.0 (since that's all we technically support) and have its own snapshot test.
// This returns a valid method name fro an identifier. | ||
getMethodName(name) { | ||
let ret = _.camelCase(name); | ||
ret = _.upperFirst(ret); | ||
|
||
if (ScsLib.javaKeywords.has(ret)) { | ||
ret = `_${ret}`; | ||
} | ||
|
||
return ret; | ||
} |
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 was confused at first because a method shouldn't start with a capital letter, but I see a 'get' or 'set' is prepended to this name in the template. Maybe calling this getMethodNameSuffix
would make that clearer.
Also, since this is so close to being the same as getClassName or getIdentifierName, I wonder if we can use those instead. Calling both getClassName and getIdentifierName would do it, but that's weird. Maybe calling getIdentifierName and doing _.upperFirst() is fine.
Description
With this, the duplication of variable names based on the type will be fixed.
Related issue(s)
Fixes #346