You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In v2.4.0 a change was made which automatically populated the discriminator variable
with the class name. However whilst the variable name was converted from the model to
a java friendly variable, for example object_type to objectType in the parent class
the set variable didn't translate accordingly and so leaves uncompilable code.
As a result the generated code produced was...
public ParentObject() {
this.object_type = this.getClass().getSimpleName();
}
public ParentObject objectType(String objectType) {
this.objectType = objectType;
return this;
}
There is a workaround which is that you specify your discriminator as the camel case version of the object but I assume this only works for the Java generator (and other generators that use camel case) it stops the swagger specification from being language independent.
I've taken a fork of the project and have a fix that works, but as I don't know the codebase it may not be how you would want to fix it. I'll raise a PR so someone can take a look
The text was updated successfully, but these errors were encountered:
Description
In v2.4.0 a change was made which automatically populated the discriminator variable
with the class name. However whilst the variable name was converted from the model to
a java friendly variable, for example object_type to objectType in the parent class
the set variable didn't translate accordingly and so leaves uncompilable code.
As a result the generated code produced was...
and not
There is a workaround which is that you specify your discriminator as the camel case version of the object but I assume this only works for the Java generator (and other generators that use camel case) it stops the swagger specification from being language independent.
Swagger-codegen version
v2.4.0+
Swagger declaration file content or url
Command line used for generation
swagger-codegen generate -i -l java
Steps to reproduce
Run the Java code gen
Related issues/PRs
Issue was cause by commit 73c338b
Suggest a fix/enhancement
I've taken a fork of the project and have a fix that works, but as I don't know the codebase it may not be how you would want to fix it. I'll raise a PR so someone can take a look
The text was updated successfully, but these errors were encountered: