swagger-api / swagger-api/swagger-codegen
type:string format:binary doesn't work on python-flask (ImportError: No module named binary)
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
When generating a swagger-server with a model that has type:string format:binary, it completes successfully, but then fail on a missing import.
Swagger-codegen version
tested on both v2.2.3 and v2.3snapshot
Swagger declaration file content or url
https://forge.etsi.org/rep/gitweb.cgi/MEC.GS_012.git/blob_plain/HEAD:/RniAPI.yaml
Command line used for generation
java -jar swagger-codegen-cli.jar generate -o out -i https://forge.etsi.org/rep/gitweb.cgi/MEC.GS_012.git/blob_plain/HEAD:/RniAPI.yaml -l python-flask -D supportPython2=true
tested with both python3 and python2 support, both stable and unstable versions of codegen.
Current result:
[...snip...]
from swagger_server.models.cell_id import CellId
File "swagger_server/models/cell_id.py", line 4, in <module>
from swagger_server.models.binary import Binary
ImportError: No module named binary
Suggest a fix/enhancement
Removing the format:binary from the yaml removes the missing import directive. Since import alone [should] do nothing, I don't think removing that import will hurt.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the provided generation command and inspect the generated swagger_server/models/cell_id.py import of swagger_server.models.binary. Compare this with the type:string format:binary declaration in RniAPI.yaml. Done means the generated Python Flask server no longer raises ImportError for the binary model while retaining valid model imports.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flask, python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100