datamodel-code-generator
datamodel-code-generator copied to clipboard
Pydantic model and dataclasses.dataclass generator for easy conversion of JSON, OpenAPI, JSON Schema, and YAML data sources.
**Describe the bug** **To Reproduce** Example schema: ```json openapi: "3.0.0" info: version: 1.0.0 title: File endpoint paths: get_file: parameters: - $ref: "#/components/schemas/FileRequest" components: schemas: FileHash: type: string min_length: 32 max_length:...
**Describe the bug** Parsing fails with a `KeyError` when processing an external ref that contains a local ref. ``` /datamodel_code_generator/parser/jsonschema.py", line 54, in get_model_by_path return get_model_by_path(schema[keys[0]], keys[1:]) KeyError: 'model_a' ```...
Want to be able to create models from paths schemas. Is there any way to nest and generate also from that level? Example for that snippet: ``` paths: /users/{id}: get:...
If a field in a component has type array and subtype enum, no enum class is generated for this enum as it is for simple, non-composite enum field. **To Reproduce**...
**Is your feature request related to a problem? Please describe.** Code generated by different systems (e.g. different OS like Linux and Mac) can be different, because Python classes can be...
**Describe the bug** jsonschema example command from documentation errors **To Reproduce** Example schema: ```json { "$schema": "http://json-schema.org/draft-07/schema#", "title": "Person", "type": "object", "properties": { "firstName": { "type": "string", "description": "The person's...
**Is your feature request related to a problem? Please describe.** `pydantic` supports the provision to add a validator decorator for fields. Is there anyway to represent this in `jsonschema` and...
Timestamp with timezone format string type is generated as a string property of the pydantic model
Fields with schema ```yaml schema: type: string format: timestamp with time zone ``` are generated as string properties of the pydantic models instead of being generated as a datetime property,...
**Describe the bug** JSON schema pattern properties can provide multiple patterns where any object property key must match one of the patterns. This is probably not handled correctly by models...
See #662.