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

**Is your feature request related to a problem? Please describe.** I'm using datamodel-code-generator to generate Python dataclasses from an OpenAPI model. These models have one default response and at least...

enhancement

**Is your feature request related to a problem? Please describe.** The generator produces code that is not compatible with PEP 681's `dataclass_transform` interface. For more details see https://github.com/microsoft/pyright/issues/7166 **Describe the...

Context: I've spent the last week writing a code generation script that converts JSON schemas into Python dataclasses and C++ classes; and today I stumbled into your wonderful project! My...

There's quite a few warnings generated by Pydantic v2 generated models that could be cleaned up to make a lot less noise in downstream project users. Some examples: ``` datamodel_code_generator/parser/jsonschema.py:1663:...

enhancement

Hello -- this forbid line (line 230) never gets hit and I think the default is `Extra.ignore` meaning there's no easy way to enforce strict type checking. The inline If...

enhancement
answered

**Describe the bug** Code is generated that resembles: ```python from datetime import date class ActivityBase(BaseModel): date: Optional[date] = Field( None, description="The date the Activity was performed (as a ISO-8601 date)"...

bug

**Describe the bug** References to other files don't work. I have a custom schema that uses file references like so: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "file:Foo.schema.json", "title": "A schema file",...

**Is your feature request related to a problem? Please describe.** When using this (awesome) tool, one of the issues we have is tracking exactly what options were used when the...

Would anyone know of a way to remove the enforced `default:None` when converting an OpenApi 3.0.1 yaml document to Pydantic models for later usage? As of now I see that...

**Describe the bug** Items in an array are not generated as `Optional`, despite adding the `nullable: true` property. **To Reproduce** Example schema: ```json # test.yml properties: list1: type: array items:...