Describe the bug
Thank you for this great tool. When --snake-case-field is enabled, datamodel-codegen incorrectly converts union variant type names to snake_case.
To Reproduce
Example schema:
union ExampleUnion = FooCamel | BarCamel
type FooCamel {
a: String!
}
type BarCamel {
b: String!
}
Used commandline:
$ datamodel-codegen --input test.graphql --output model.py --input-file-type graphql --output-model-type pydantic_v2.BaseModel --snake-case-field
Current behavior
ExampleUnion: TypeAlias = Union[
'bar_camel',
'foo_camel',
]
Expected behavior
ExampleUnion: TypeAlias = Union[
'BarCamel',
'FooCamel',
]
Version:
- OS:
macOS 14.6.1
- Python version:
3.10.17
- datamodel-code-generator version:
0.30.1
Describe the bug
Thank you for this great tool. When
--snake-case-fieldis enabled,datamodel-codegenincorrectly converts union variant type names tosnake_case.To Reproduce
Example schema:
Used commandline:
Current behavior
Expected behavior
Version:
macOS 14.6.13.10.170.30.1