This is coming out of a python flask app, but we are using --lang python
:
A number
type in our swagger.json
gets incorrectly mapped to BigDecimal
rather than float
, which is a nonexistent model:
will cause you to hit this line in the parent model
from my_client.models.big_decimal import BigDecimal # noqa: F401,E501
which will result in
ModuleNotFoundError: No module named 'my_client.models.big_decimal'
because my_client.models.big_decimal
is never generated.
3.0.10
{ "OffendingSchema": { "additionalProperties": false, "properties": { "some_object": { "items": { "items": { "type": "number" // this is the offending type }, "type": "array" }, "type": "array" } }, "required": [ "some_object" ], "title": "OffendingSchema", "type": "object" } }Command line used for generation
java -jar swagger-codegen-cli.jar generate \
--lang python \
--input-spec clients/swagger.json \
-c clients/swagger-config.json \
-o clients/python/generated;
Steps to reproduce
swagger.json
with the above snippetI think this may be because the following line present in the python-flask
generator is not present in the python
generator:
typeMapping.put("BigDecimal", "float");
absent in
Temporary workaroundI was able to get around this by passing in --import-mappings BigDecimal=float
to swagger-codegen-cli
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4