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

**Describe the bug** When running `datamodel-codegen` for any files that have `additionalProperties` set to `false`, the tool throws an exception. See the full debug output below: ``` Modified var:.. key...

bug

The [`use_attribute_docstrings`](https://docs.pydantic.dev/latest/api/config/#pydantic.config.ConfigDict.use_attribute_docstrings) key is available in Pydantic v2.7+ that enables docstrings of attributes to be used for field descriptions. If the value is the default `False`, the examples in the...

enhancement

**Describe the bug** Since [black release v24.2](https://black.readthedocs.io/en/stable/change_log.html#id11) black ignores `pyproject.toml` files without a `[tool.black]` section. The bug arises because datamodel-codegen uses black's `black.find_project_root` [here](https://github.com/koxudaxi/datamodel-code-generator/blob/e4fa23a7270261b2fc195815d00039068b1c8197/datamodel_code_generator/__main__.py#L353-L354), but that now that ignores pyproject.toml...

**Describe the bug** If file A refers to file B via url, and file B refers to file C using a relative path, datamodel-codegen searches local file system (from A)...

bug

**Describe the bug** If I have a jsonschema file that references another jsonschema file with a circular dependency, the pydantic model file that is produced has the classes out-of-order so...

bug
help wanted

**Describe the bug** Combining [one|all|any]Of + required generates excessive near-identical models instead of treating them as root validation rules. This makes the output relatively quite verbose and significantly more difficult...

**Is your feature request related to a problem? Please describe.** The current behavior generates unhelpful enumerated class names, like `Address1`, `Address2`, `Address3` when the source has multiple definitions for `Address`....

**Describe the bug** For some reason, all of my fields are set as nullable, using `strict-nullable` dosen't change anything. This migh well be my error, but after spending much time...

**Describe the bug** Broken imports when defining schema names with "dot" notation. ```yaml openapi: 3.0.0 info: title: Example for import errors version: 1.0.0 paths: {} components: schemas: v0.animal: title: Animal...

bug

**Describe the bug** I cannot use datamodel-code-generator to build a pydantic model from [OpenAPI spec](https://raw.githubusercontent.com/openai/openai-openapi/master/openapi.yaml) **To Reproduce** ``` $ datamodel-codegen --url=https://raw.githubusercontent.com/openai/openai-openapi/master/openapi.yaml --output=openai.py Invalid file format ``` **Version:** - OS: [e.g....