In my generated python file, all the schemas I wanted are present but they have "1" or "Model" added to the end of the class name. Every single original schema name is taken by a TypeAlias any.
To Reproduce
Input schema:
https://github.com/simonLeary42/codegen-example/blob/main/openapi-schemas.json
Used commandline:
$ datamodel-codegen --input openapi-schemas.json --input-file-type jsonschema --output-model-type dataclasses.dataclass --output openapi_schemas.py
Behavior
This is the python file generated (after I formatted it with ruff):
https://github.com/simonLeary42/codegen-example/blob/de39b135db2346fef1c9c277e0936dd38aaf1f45/openapi_schemas.py
https://github.com/simonLeary42/codegen-example/blob/de39b135db2346fef1c9c277e0936dd38aaf1f45/openapi_schemas.py#L19-L23
class AccountStatus1(Enum):
standard = "standard"
founder = "founder"
gold_founder = "gold_founder"
vip_founder = "vip_founder"
https://github.com/simonLeary42/codegen-example/blob/de39b135db2346fef1c9c277e0936dd38aaf1f45/openapi_schemas.py#L594
AccountStatus: TypeAlias = Any
Here's a diff between what was generated and what I was expecting:
https://github.com/simonLeary42/codegen-example/commit/a399211fc8c36264854e96dcf33edb97c2c6d972
Version:
- OS: windows 11
- Python version: 3.12.10
- datamodel-code-generator version: 0.54.0
In my generated python file, all the schemas I wanted are present but they have "1" or "Model" added to the end of the class name. Every single original schema name is taken by a
TypeAlias any.To Reproduce
Input schema:
https://github.com/simonLeary42/codegen-example/blob/main/openapi-schemas.json
Used commandline:
$ datamodel-codegen --input openapi-schemas.json --input-file-type jsonschema --output-model-type dataclasses.dataclass --output openapi_schemas.pyBehavior
This is the python file generated (after I formatted it with ruff):
https://github.com/simonLeary42/codegen-example/blob/de39b135db2346fef1c9c277e0936dd38aaf1f45/openapi_schemas.py
https://github.com/simonLeary42/codegen-example/blob/de39b135db2346fef1c9c277e0936dd38aaf1f45/openapi_schemas.py#L19-L23
https://github.com/simonLeary42/codegen-example/blob/de39b135db2346fef1c9c277e0936dd38aaf1f45/openapi_schemas.py#L594
Here's a diff between what was generated and what I was expecting:
https://github.com/simonLeary42/codegen-example/commit/a399211fc8c36264854e96dcf33edb97c2c6d972
Version: