[JAVA][Server] Generated model classes are missing default values
Created by: ccozzolino
Description
Certain java server model classes do not properly declare default values for certain fields. For example, here is the beginning of Pet.java from the samples directory (pulled from undertow
, vertx-async
, vertx-rx
). Note the missing default value for the id
, name
, and status
fields:
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Pet {
private Long id = ;
private Category category = null;
private String name = ;
private List<String> photoUrls = new ArrayList<>();
private List<Tag> tags = new ArrayList<>();
public enum StatusEnum {
AVAILABLE("available"),
PENDING("pending"),
SOLD("sold");
private String value;
StatusEnum(String value) {
this.value = value;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
private StatusEnum status = ;
public Pet () {
}
openapi-generator version
This appears to be a regression since 3.3.1.
Reproduced issue with openapi generator 3.3.1, 3.3.2, 3.3.3, and current master.
Testing against 3.3.0 generates models with proper defaults.
OpenAPI declaration file content or url
Issue is reproducible with certain java server samples (undertow
, vertx-async
, vertx-rx
) provided in this project for the versions mentioned above.
Command line used for generation
Generate models from existing sample servers to reproduce the problem:
mvn clean ; ./bin/java-undertow-petstore-server.sh
mvn clean ; ./bin/java-vertx-async-petstore-server.sh
mvn clean ; ./bin/java-vertx-rx-petstore-server.sh