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
to generate code for Point and Polygon. Overall it works fine, however it fails to generate the "type" which should be "point" for Point and "polygon" for Polygon.
Swagger-codegen version
swagger-codegen-maven-plugin 2.2.3
Swagger declaration file content or url
look at Polygon or Point in the geojson swagger above.
From a swagger-spec point of view, it is not defined that the type of a #/definitions/Point should be TypeEnum.POINT and that the type of a #/definitions/Polygon will be TypeEnum.POLYGON.
This is something that can be figured out when you read the external doc page referenced in the swagger-spec:
For a use case like this, the possibility to define constant values in the Schema definitions is currently missing. This is a requested feature for the next version of the specification: OAI/OpenAPI-Specification#1313 (maybe you could mention your use case, the geojson swagger file in this issue)
As pointed out in the discussion, without the possibility to have constant value in schema, it is not possible for a code generator to know that a fixed value needs to be set for a specific model class.
Description
I'm using the geojson swagger file
https://gist.github.com/bubbobne/fe5f2db65acf039be6a9fd92fc9c7233
to generate code for Point and Polygon. Overall it works fine, however it fails to generate the "type" which should be "point" for Point and "polygon" for Polygon.
Swagger-codegen version
swagger-codegen-maven-plugin 2.2.3
Swagger declaration file content or url
look at Polygon or Point in the geojson swagger above.
Command line used for generation
I use Maven
generate-geojson generate src/main/resources/geometry_geojson.yaml java java8 src/java/mainSteps to reproduce
Related issues/PRs
Suggest a fix/enhancement
The hack is basically I add a constructor to the class like so:
public Point() {
setType(TypeEnum.POINT);
}
or for Polygon:
public Polygon() {
setType(TypeEnum.POLYGON);
}
The text was updated successfully, but these errors were encountered: