swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
When a model is generated for a schema defined as an enum with type integer a class constant is included for each value. These constants will use the integer value as their name which is not valid PHP. For enums with type string the names for numeric values seem to be prefixed with _ but this does not happen for type integer.
Hi @paulvandermeijs, I'm running into the same issue with a PHP client that was generated by Swagger Codegen. Did you find any workaround to correct this without having to manually change each one of these?
Description
When a model is generated for a schema defined as an enum with type
integer
a class constant is included for each value. These constants will use the integer value as their name which is not valid PHP. For enums with typestring
the names for numeric values seem to be prefixed with_
but this does not happen for typeinteger
.Swagger-codegen version
3.0.30
Swagger declaration file content or url
The following schema definition:
Results in:
While the following schema definition:
Results in: