Uh oh!
There was an error while loading. Please reload this page.
[php][DefaultCodegen.java] Fix invalid enum const names - #3524
[php][DefaultCodegen.java] Fix invalid enum const names#3524githubERIK wants to merge 6 commits into
Conversation
It seems to be a good idea to debug the generated jar and start with a breakpoint in DefaultCodegen and then perform "Step Into" when "importPath→OpenAPI\Client\Model.EnumTest" appears. and then see what happens with outerEnumInteger Enum_Test:
type: objectrequired:
- enum_string_requiredproperties:
enum_string:
type: stringenum:
- UPPER
- lower
- ''enum_string_required:
type: stringenum:
- UPPER
- lower
- ''enum_integer:
type: integerformat: int32enum:
- 1
- -1enum_number:
type: numberformat: doubleenum:
- 1.1
- -1.2outerEnum:
$ref: '#/components/schemas/OuterEnum'outerEnumInteger:
$ref: '#/components/schemas/OuterEnumInteger'outerEnumDefaultValue:
$ref: '#/components/schemas/OuterEnumDefaultValue'outerEnumIntegerDefaultValue:
$ref: '#/components/schemas/OuterEnumIntegerDefaultValue'd07efac leads to at some point. But in the end class OuterEnumInteger
{
/** * Possible values of this enum */const0 = 0;
const1 = 1;
const2 = 2;
/** * Gets allowable values of the enum * @return string[] */publicstaticfunctiongetAllowableEnumValues()
{
return [
self::0,
self::1,
self::2,
];
}
}is generated. Probably because after OuterEnumInteger is processed as part of EnumTest it is also processed later separately: . |
The final approach: change Generated all samples by executing shell scripts in bin and bin/openapi3 folders using a script generate_all_sample_clients.sh. |
ybelenko
commented
May 14, 2020
Is this PR is still relevant or it should be closed? |
asabramo
commented
Jul 2, 2020
Hi guys, I'm still seeing this issue, which means I can't use the files as they are generated - I have to add another step manually, which beats the purpose. Oddly enough, when I use the version that the Jetbrains plugin retrieves automatically (https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.3/swagger-codegen-cli-3.0.3.jar) , the enum problem doesn't exist (but then there's another bug - BigDecimal instead of float). Is there a version where both issues are fixed? |
ybelenko
commented
Jul 4, 2020
@asabramo It seems that you're talking about About bug itself, I don't know whether it fixed or not. Maybe we should add part of the spec from related issue to samples and check PHP syntax of generated models with |





@jebentier, @dkarlovi, @mandrean, @jfastnacht, @ackintosh, @ybelenko, @renepardon
Fix#1475