forked from loafle/openapi-generator-original
[PHP] Allow strings with only whitespaces in enums (#12783)
This commit is contained in:
parent
cd48db43b4
commit
3e42a6eae0
@ -664,6 +664,10 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
return "EMPTY";
|
||||
}
|
||||
|
||||
if(name.trim().length() == 0) {
|
||||
return "SPACE_" + name.length();
|
||||
}
|
||||
|
||||
// for symbol, e.g. $, #
|
||||
if (getSymbolName(name) != null) {
|
||||
return (getSymbolName(name)).toUpperCase(Locale.ROOT);
|
||||
@ -739,6 +743,11 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
return input;
|
||||
}
|
||||
|
||||
// If the string contains only "trim-able" characters, don't trim it
|
||||
if(input.trim().length() == 0) {
|
||||
return input;
|
||||
}
|
||||
|
||||
// Trim the string to avoid leading and trailing spaces.
|
||||
return super.escapeText(input).trim();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user