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

Hello, Is it possible to add support for JSON schema readOnly field property? Thank you

enhancement
help wanted

**Describe the bug** An OpenAPI schema with a self-referencing object with a discriminated union produces code with undefined variables for all output model types except pydantic v1 BaseModel. **To Reproduce**...

Can datamodel-code-generator generate request body? If not, could you add this feature? ``` pydantic_core._pydantic_core.ValidationError: 1 validation error for Config openapi_scopes.1 Input should be 'schemas', 'paths', 'tags' or 'parameters' [type=enum, input_value='requestBodies',...

enhancement

I discovered your project from https://github.com/gold-standard-phantoms/bids-pydantic/ which produces pydantic model from our BIDS standard metadata descriptor files such as https://github.com/bids-standard/bids-schema/blob/main/versions/1.9.0/schema/objects/metadata.yaml after a few [ad-hoc transformations](https://github.com/bids-standard/bids-schema/blob/main/versions/1.9.0/schema/objects/metadata.yaml) using your library. But there...

**Is your feature request related to a problem? Please describe.** When I convert an array like following with `datamodel-codegen --input openapi.yaml --output model.py --output-model-type pydantic_v2.BaseModel`, ```yaml openapi: 3.0.3 components: schemas:...

answered

**Describe the bug** After digging a bit, I found a strange behavior, which could be related to #270: I generate my code like [this](https://github.com/carstencodes/buildinfo-om/blob/e12d1d232ac11f092ac2fc358bdf62c65917c2d2/pyproject.toml#L26). As the target version is not...

answered

Hey there, for the maintainers, thanks for that great library. I would appreciate a heads-up on something I'm trying to do, which is basically adding some static code to a...

answered

**Describe the bug** From the json schema a property named '`schema`' was created as a field named '`schema_`'. **To Reproduce** Example schema: https://schema.getpostman.com/json/collection/v2.1.0/collection.json Used commandline: ``` $ datamodel-codegen --url https://schema.getpostman.com/json/collection/v2.1.0/collection.json...

bug

**Describe the bug** When generating (class) docstrings, special characters such as backslash are not properly escaped. This causes a warning in type checkers such as pyright/Pylance, and may cause a...

enhancement

**Describe the bug** When I try to generate models from an OpenAPI schema containing discriminators, I get an error: `RuntimeError: Discriminator type is not found`. **To Reproduce** Get the OpenAPI...

bug