-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Description
Description
Running the openapi-generator-cli.jar with --type-mappings Integer=int,Boolean=boolean,Float=float,Double=double --language-specific-primitives boolean,int,float,double options, generates incorrect private List<double> vector = null; code.
openapi-generator version
3.3.3-SNAPSHOT (30bfebf) / master
OpenAPI declaration file content or url
Partial content:
"Features": {
"type": "object",
"required": [
"features"
],
"properties": {
"algorithm": {
"description": "The name and version of the algorithm used for feature extraction",
"type": "string",
"example": "Euclidean tripartite loss function"
},
"metric": {
"description": "The recommended type of metric used ",
"type": "string",
"example": "Euclidean tripartite loss function",
"enum": [
"euclidean",
"manhattan",
"cosine"
]
},
"threshold": {
"description": "The value of the metric threshold",
"type": "number",
"format": "double",
"example": 0.8
},
"vector": {
"description": "N-dimensional feature vector of numerical features representing the unique signature of the object",
"type": "array",
"items": {
"type": "number",
"format": "double"
}
}
}
},Full spec is available here: https://github.com/deepviss/deepviss-server-example/blob/master/src/main/resources/deep-viss-openapi-v3.json
Command line used for generation
java -jar openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/deepviss/deepviss-server-example/master/src/main/resources/deep-viss-openapi-v3.json -l java -o ~/Downloads/generated/ --type-mappings Integer=int,Boolean=boolean,Float=float,Double=double --language-specific-primitives boolean,int,float,double
Steps to reproduce
Generate code with the above specified command.
Open ~/Downloads/generated/src/main/java/org/openapitools/client/model/Features.java and notice the following syntax error:
private List<double> vector = null;
Expected declaration type is:
private double[] vector;
Related issues/PRs
None
Suggest a fix/enhancement
Suggested fix would be to correctly interpret type-mappings and language-specific-primitives options and adjust code generation logic to output double[] instead of List<double>. The same error might reproduce (not tested) for int, float and boolean arrays.