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** I am trying to produce pydantic models from a JSONSchema file I have. When I try to do this, the process never finishes and just accumulates memory...

**Describe the bug** Pydantic `2.5.3` complains about incorrect type definition `confloat`: This function is **discouraged** in favor of using [`Annotated`](https://docs.python.org/3/library/typing.html#typing.Annotated) with [`Field`][pydantic.fields.Field] instead. **To Reproduce** Example schema: ```json { "$id":...

**Describe the bug** Due to changes in how serialization of subclasses is handled in pydantic v2, generated models do not produce correct output when using model_dump or model_dump_json. See issue...

bug
help wanted

**Describe the bug** When a name collision is produced in a schema, by for example referencing to another schema + adding a property to it, an `import as` is then...

**Describe the bug** if json contain specific chinese, code generat will fail. specific chinese like :陳 **To Reproduce** Example schema: ```json { "nickName": "陳老師", } ``` Used commandline: ``` $...

**Describe the bug** When generating models from openapi yaml that references multiple files with same schemas, and setting `--enum-field-as-literal all ` following Exception is raised: `python3.10/site-packages/datamodel_code_generator/parser/base.py", line 595, in __delete_duplicate_models...

bug

**Describe the bug** Generating `"pydantic_v2.BaseModel` with `Field()` generates an impossible solution for current pydantic v2 implementation. **To Reproduce** Example schema: ```json { "$schema": "http://json-schema.org/draft-07/schema", "properties": { "Settings": { "title": "having...

enhancement

**Describe the bug** I would like to set a field passed from a $ref (let's say A) as `required`. If I simply put it in the `required` on my schema...

**Describe the bug** Option '--url' behaves differently from '--input' with same input file **To Reproduce** ``` datamodel-codegen --input .CVE_JSON_5.0_bundled.json --input-file-type jsonschema \ --output output.py --output-model-type pydantic_v2.BaseModel ``` works, while ```...

Add the marker to "generated" at the file header to make it easier for tooling to identify generated files as such. Closes: #1604