mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 14:40:53 +00:00
[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";
|
return "EMPTY";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(name.trim().length() == 0) {
|
||||||
|
return "SPACE_" + name.length();
|
||||||
|
}
|
||||||
|
|
||||||
// for symbol, e.g. $, #
|
// for symbol, e.g. $, #
|
||||||
if (getSymbolName(name) != null) {
|
if (getSymbolName(name) != null) {
|
||||||
return (getSymbolName(name)).toUpperCase(Locale.ROOT);
|
return (getSymbolName(name)).toUpperCase(Locale.ROOT);
|
||||||
@ -739,6 +743,11 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
|||||||
return input;
|
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.
|
// Trim the string to avoid leading and trailing spaces.
|
||||||
return super.escapeText(input).trim();
|
return super.escapeText(input).trim();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user