-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[Kotlin] Add ability to use modelNamePrefix/modelNameSuffix #2349
[Kotlin] Add ability to use modelNamePrefix/modelNameSuffix #2349
Conversation
assertEquals(codegen.toModelName("name"), "Name"); | ||
assertEquals(codegen.toModelName("$name"), "Dollarname"); | ||
assertEquals(codegen.toModelName("nam#e"), "NamHashe"); | ||
assertEquals(codegen.toModelName("$another-fake?"), "DollaranotherMinusfakeQuestionMark"); |
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.
@karismann quick question if you don't mind. Should it be DollarAnotherMinusFakeQuestionMark
(capital letter A and F) instead of DollaranotherMinusfakeQuestionMark
?
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.
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.
OK. If my memory serves me well, we've something like $prefix_$name
before going through camelize
to handle the case mentioned above in some other generators (e.g. Perl). We can definitely go with this implementation in Kotlin and see if that's what the user expects.
Tested with prefixes and suffixes, and this seems to work as expected: Prefix=Jim
Suffix=Cats
|
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 doing this up!
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
,./bin/openapi3/{LANG}-petstore.sh
,./bin/security/{LANG}-petstore.sh
and./bin/openapi3/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
.master
,. Default:3.4.x
,4.0.x
master
.@jimschubert (2017/09) , @dr4ke616 (2018/08)
Description of the PR
fix #1885
add some missing testcase on toModelName function in abstract Kotlin CodeGen package