mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-08 16:40:56 +00:00
Prevent ObjC generator from producing invalid var names.
This commit is contained in:
parent
5e95362542
commit
d14ab2aeff
@ -82,10 +82,11 @@ class BasicObjcGenerator extends BasicGenerator {
|
||||
|
||||
// objective c doesn't like variables starting with "new"
|
||||
override def toVarName(name: String): String = {
|
||||
if(name.startsWith("new") || reservedWords.contains(name)) {
|
||||
escapeReservedWord(name)
|
||||
val paramName = name.replaceAll("[^a-zA-Z0-9_]","")
|
||||
if(paramName.startsWith("new") || reservedWords.contains(paramName)) {
|
||||
escapeReservedWord(paramName)
|
||||
}
|
||||
else name
|
||||
else paramName
|
||||
}
|
||||
|
||||
// naming for the apis
|
||||
|
Loading…
x
Reference in New Issue
Block a user