-
Notifications
You must be signed in to change notification settings - Fork 5
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
codegen: applying kotlin naming rules to operationId param #49
base: master
Are you sure you want to change the base?
Conversation
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 great first contribution! Please see my comment below.
- 'operation' prepend if operationId starts with a digit
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
hi, @niraj8, can I ask you for a check and response if provided fix is sufficient and the PR can be merged pls.? Thanks. |
Hey @pedro-cze! I went over the issue once again and I think we should take a different approach here. Instead of converting operationId to conform to function names, we should fail while parsing and ask for valid operationId, with a helpful error message that mentions what is considered valid. I can't think of any reason for an operationId to start with any non-alphabetic characters. The operationId would then be mapped directly to the generated controller function for that operation, which was my intention when I suggested we prefix the function name with We should fail while parsing the spec yml if the operationId doesn't conform to the kotlin function as is. What do you think? |
Hi @niraj8 and thanks for your reply :) Is that ok? Thanks. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Currently if
operationId
contains whitespaces the resulting function name is wrongly createad asfoo bar()
. This hould be prevented.Fixes #30
What is the new behavior?
From now on the
operationId
will follow naming rules specified for kotlin functions. That means that the first character is removed in case it is a digit. After this check theFunctions.toCamelCase()
function is applied.Does this PR introduce a breaking change?
Additional context