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
and generate the PythonClient with the generator, resulting in the following Enum in Python:
# coding: utf-8""" FastAPI No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually."""# noqa: E501from __future__ importannotationsimportjsonfromenumimportEnumfromtyping_extensionsimportSelfclassStatusEnum(str, Enum):
""" StatusEnum """""" allowed enum values """ACTIVE='ACTIVE'ACTIVE='active'@classmethoddeffrom_json(cls, json_str: str) ->Self:
"""Create an instance of StatusEnum from a JSON string"""returncls(json.loads(json_str))
where we retrieve the duplicate attribute ACTIVE in the StatusEnum.
Bug Report Checklist
Description
Generator creates Enums with duplicate attributes
openapi-generator version
openapi-generator v7.8.0
OpenAPI declaration file content or url
where the important part is:
Generation Details
openapi-generator generate -i openapi_example.json -g python --package-name example -o .
Steps to reproduce
Create a simple FastAPI:
and generate the PythonClient with the generator, resulting in the following Enum in Python:
where we retrieve the duplicate attribute ACTIVE in the StatusEnum.
Related issues/PRs
None
Suggest a fix
Add
in
AbstractPythonCodegen.java
and the regarding logic to handle the case where enums shouldn't be capitalized.The text was updated successfully, but these errors were encountered: