-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Fix: allow colons in TS interface property names #1152
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
return name; | ||
} | ||
|
||
private boolean hasIllegalCharacters(String 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.
a description in which context the characters are "illegal" would be nice
@smasala you need to replace the tab with spaces in https://github.com/OpenAPITools/openapi-generator/pull/1152/files#diff-328108658e03bbcf6cc8b931ffa7a63eR201 |
if (hasIllegalCharacters(name)) { | ||
name = "\'" + name + "\'"; | ||
} | ||
|
||
return name; | ||
} | ||
|
||
private boolean hasIllegalCharacters(String name) { | ||
/** | ||
* Checks whether illegal characters are present in the given param |
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.
what is an illegal character and why?
@macjohnny this PR is now complete |
@@ -184,6 +186,33 @@ public String toVarName(String name) { | |||
return name; | |||
} | |||
|
|||
@Override() |
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.
@smasala what about updating toParamName
with the code logic in toVarName
(line 167 to 186) and then toVarName
will call toParamName
instead before the additional propertyHasBreakingCharacters
check?
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.
@wing328 and then leaving the toPropertyName
completely out?
Thanks @wing328 and @macjohnny |
* Allow colons in interface property names: OpenAPITools#1080 * replace tabs with spaces * add docs * add example in doc * update docs * update docs * remove language specific docs in DefaultCodegen * Delete addPet-BodyParams.csv * remove toPropertyName and update toVarName instead for TS
Developed with @Xyaren
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/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
(3.3.x),4.0.x
. Default:master
.@TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @nicokoenig (2018/09)
Description of the PR
Fix latest version by adding single quotes to properties with colons.
Example:
Original issue: #1080