datamodel-code-generator
datamodel-code-generator copied to clipboard
Pydantic model and dataclasses.dataclass generator for easy conversion of JSON, OpenAPI, JSON Schema, and YAML data sources.
**Context** I am using an Open API specs to serve as the single source of truth in my application across my frontend written in Typescript and my backend written in...
**Describe the bug** Given two schemas which are contained within a namespace, when a schema at the top level of the namespace references a schema from a sub-namespace, the relative...
**Is your feature request related to a problem? Please describe.** The data that will be returned of the dataclass is not in the expected output casing that we need for...
**Is your feature request related to a problem? Please describe.** No real problem **Describe the solution you'd like** be able to parameter to dtaclass for example @dataclass(slots=True) **Describe alternatives you've...
**Is your feature request related to a problem? Please describe.** I'm in the unfortunate position of having to consume an API that has incorrect constraints in its OpenAPI documentation. Up...
**Describe the bug** An unquoted `false` value in an enum of `string` type generates a python boolean enum option. **To Reproduce** Example schema: ```yaml intersection_type: type: string enum: - regular...
**Describe the bug** When parsing the FlatZinc-JSON schema (a JSONSchema spec, not an instance of it) and using `--collapse-root-models` I got an error from Black. This was because the code...
```py from datamodel_code_generator import ( DataModelType, # 注意:DataModelType 不在 __all__ 中定义,可能在未来的版本中发生变化 InputFileType, PythonVersion, generate, ) generate( json_str, input_file_type=InputFileType.Json, # JSON类型 output=model_file, # 输出文件路径 output_model_type=output_model_type, # 输出模型类型 # 这边datamodel_code_generator有bug(https://github.com/koxudaxi/datamodel-code-generator/issues/1977) # 将allow_extra_fields设置为True,...
**Describe the bug** Given an OpenAPI component schema configured with `nullable: true`, properties referencing this schema are not generated as optional. **To Reproduce** Example schema (OpenAPI): ```yaml openapi: 3.0.3 components:...
**Describe the bug** datamodel-code-generator creates invalid Python syntax if multi-line comments are present on some GraphQL items. This was discovered on the Shopify API and a minimal reproduction is below....