Description
Description
The Swagger Codegen produces wrong getter methods for Boolean. It uses a Boolean Object and the getter isMyProperty() which cannot be used in JSF applications.
This behaviour has changed in comparison to version 2.2.3 of the swagger-codegen.
Swagger-codegen version
2.3.1
Swagger declaration file content or url
properties:
active:
type: boolean
Command line used for generation
Using the maven plugin
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.3.1</version>
<!--<version>2.2.3</version>-->
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>src/main/resources/swagger.json</inputSpec>
<language>java</language>
<modelPackage>modelPacakge</modelPackage>
<apiPackage>apiPackage</apiPackage>
<generateApiTests>false</generateApiTests>
<generateApiDocumentation>false</generateApiDocumentation>
<generateModelDocumentation>false</generateModelDocumentation>
<generateModelTests>false</generateModelTests>
<configOptions>
<dateLibrary>java8-localdatetime</dateLibrary>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
Steps to reproduce
Generate the Java Model using a Boolean attribute.
Related issues/PRs
Suggest a fix/enhancement
The Generator produces Boolean objects and not types, which is fine.
For Boolean Objects the getter should by getMyProperty, the setter setMyProperty()
In the example above is should produce
public Boolean getActive(){
...
}
and
public void setActive(Boolean boolValue){
...
}
If the Generator would produce boolean types, then the getter isMyPropery() and setMyProperty() is fine.
public boolean isActive(){
...
}
and
public void setActive(boolean boolValue){
...
}
The generated getter() for the Boolan object cannot be used in JSF Applications, since it expects proper getter() and setter() for Objects. The prefix is is only possible for primitive type boolean.