-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
-> Nope, but tested with the docker image, which I think is at most 17 days old. - Have you searched for related issues/PRs?
- What's the actual output vs expected output?
Description
Generated flask server code has bad Python syntax for enum.
openapi-generator version
7.0.1-SNAPSHOT (got it from Docker)
OpenAPI declaration file content or url
https://github.com/TALQ-consortium/TALQ_specification/tree/main/oas
Steps to reproduce
I'm trying to generate a TALQ gateway in flask, from their OpenAPI specs.
I've download these OpenAPI specs into my local folder, and tried to generate a server as per the Docker instructions.
docker run --rm -v $PWD:/local openapitools/openapi-generator-cli generate -i /local/talq-api-gateway-2-5-1.json -g python-flask -o /local/out/flask
Generation gave a wall of text, a lot of INFO, some WARN, but the code was generated. I couldn't find anything special about the offending identifiers in this text. Return value in CLI is OK.
Then I followed the instructions in out/flask/README.md:
# building the image
docker build -t openapi_server .
# starting up a container
docker run -p 8080:8080 openapi_server
This results in an error in openapi_server/models/event_type.py, the generated python code is invalid:
class EventType(Model):
"""NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Do not edit the class manually.
"""
"""
allowed enum values
"""
NUMBER_'abnormalNoiseDetected' = 'abnormalNoiseDetected'
NUMBER_'absoluteLampPowerTooHigh' = 'absoluteLampPowerTooHigh'
NUMBER_'absoluteLampPowerTooLow' = 'absoluteLampPowerTooLow'
...
NUMBER_' is probably wrong, ' is an apostrophe that did not translate correctly. But I'm not sure what the expected result should be.
Related issues/PRs
Related issue: #13689