datamodel-code-generator icon indicating copy to clipboard operation
datamodel-code-generator copied to clipboard

Pydantic model and dataclasses.dataclass generator for easy conversion of JSON, OpenAPI, JSON Schema, and YAML data sources.

Results 379 datamodel-code-generator issues
Sort by recently updated
recently updated
newest added
trafficstars

Tried to override Literal generation (`typing` module) for JSON Schema enums with >1 options. Regardless of the value passed to `enum_field_as_literal`, the result is always a `Literal`. The only workaround...

**Describe the bug** While trying to generate a pydantic code model with datamodel-codegen for Kibana's API, command didn't work. API is available here (https://www.elastic.co/docs/api/doc/kibana) ``` pydantic_core._pydantic_core.ValidationError: 1 validation error for...

bug
help wanted

**Describe the bug** Model generation seems to fail on anyOf, I encountered this issue for the SARIF spec: * https://raw.githubusercontent.com/oasis-tcs/sarif-spec/123e95847b13fbdd4cbe2120fa5e33355d4a042b/Schemata/sarif-schema-2.1.0.json **To Reproduce** Used commandline: ``` wget https://raw.githubusercontent.com/oasis-tcs/sarif-spec/123e95847b13fbdd4cbe2120fa5e33355d4a042b/Schemata/sarif-schema-2.1.0.json $ datamodel-codegen sarif-schema-2.1.0.json...

bug
help wanted

Hi, **Is your feature request related to a problem? Please describe.** Right now I have to generate JSON schemas from OpenAPI spec files. I do not how typical this issue...

**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: ```grapql union ExampleUnion =...

**Describe the bug** If I include a regex pattern, under a oneOf/anyOf which is nested inside a property of a schema, the resulting pydantic mdoel has extra spaces after each...

**Describe the bug** A generated model with an enum field generates its default value using string type instead of enum value causes pydantic serializer warnings: ``` .../env/lib/python3.10/site-packages/pydantic/main.py:477: UserWarning: Pydantic serializer...

**Describe the bug** So, I was trying to override this `ConfigDict.jinja2` template and I placed it at `templates/pydantic_v2/ConfigDict.jinja2`, but `use_enum_values=True` is not being added to the `ConfigDict` of the generated...

**Describe the bug** `field_include_all_keys=True` should store all extra schema keys in Field attributes. However, this does not work for schemas that contain `oneOf` or `anyOf` **To Reproduce** Example schema: ```json...

**Describe the bug** When default object values are provided in the openapi spec for a field typed as a model and --use-annotated is specified when generating the model plain dict...