🌐
GitHub
github.com › koxudaxi › datamodel-code-generator
GitHub - koxudaxi/datamodel-code-generator: Python data model generator (Pydantic, dataclasses, TypedDict, msgspec) from OpenAPI, JSON Schema, GraphQL, and raw data (JSON/YAML/CSV). · GitHub
# generated by datamodel-codegen: # filename: schema.json from __future__ import annotations from enum import Enum from typing import Optional from pydantic import BaseModel, Field class Species(Enum): dog = 'dog' cat = 'cat' bird = 'bird' fish = 'fish' class Pet(BaseModel): name: str = Field(..., description="The pet's name") species: Species age: Optional[int] = Field(None, description='Age in years', ge=0) vaccinated: Optional[bool] = False
Starred by 3.8K users
Forked by 429 users
Languages   Python
🌐
GitHub
github.com › koxudaxi › datamodel-code-generator › releases
Releases · koxudaxi/datamodel-code-generator
Removed datamodel_code_generator.pydantic_patch module - The entire pydantic compatibility patching module was removed. Any code importing from this module will fail (#3027) Removed packaging dependency - The packaging library is no longer a dependency. Code that relied on it being transitively available should add it explicitly (#3027) Extract shared pydantic base module for v2/dataclass/msgspec by @koxudaxi in #3022 · Remove pydantic v1 runtime compat layer by @koxudaxi in #3025
Author   koxudaxi
🌐
Pydantic
docs.pydantic.dev › latest › integrations › datamodel_code_generator
datamodel-code-generator - Pydantic Validation
The datamodel-code-generator project is a library and command-line utility to generate pydantic models from just about any data source, including:
🌐
GitHub
github.com › tomercagan › datamodel-code-generator
GitHub - tomercagan/datamodel-code-generator: Pydantic model generator for easy conversion of JSON, OpenAPI, JSON Schema, and YAML data sources.
This code generator creates pydantic model from an openapi file and others. See documentation for more details. ... If you want to resolve $ref for remote files then you should specify http extra option.
Author   tomercagan
🌐
PyPI
pypi.org › project › datamodel-code-generator › 0.4.8
datamodel-code-generator · PyPI
# generated by datamodel-codegen: # filename: data.json # timestamp: 2020-04-15T15:35:20+00:00 from __future__ import annotations from typing import List from pydantic import BaseModel class Pet(BaseModel): name: str age: int class Model(BaseModel): pets: List[Pet] version: str · Install the package in editable mode: $ git clone git@github.com:koxudaxi/datamodel-code-generator.git $ pip install -e datamodel-code-generator ·
      » pip install datamodel-code-generator
    
Published   Apr 18, 2020
Version   0.4.8
🌐
GitHub
github.com › mmwinther › datamodel-code-generator › blob › main › README.md
datamodel-code-generator/README.md at main · mmwinther/datamodel-code-generator
This code generator creates pydantic v1 and v2 model, dataclasses.dataclass, typing.TypedDict and msgspec.Struct from an openapi file and others. See documentation for more details. To install datamodel-code-generator: $ pip install datamodel-code-generator ·
Author   mmwinther
🌐
Ubuntu
manpages.ubuntu.com › manpages › resolute › man1 › datamodel-codegen.1.html
Ubuntu Manpage: datamodel-codegen - pydantic code generator from OpenAPI and more
`$ pip install 'datamodel-code-generator[debug]'`) --disable-warnings disable warnings --generate-cli-command Generate CLI command from pyproject.toml configuration and exit --generate-pyproject-config Generate pyproject.toml configuration from the provided CLI arguments and exit --ignore-pyproject Ignore pyproject.toml configuration --no-color disable colorized output --profile PROFILE Use a named profile from pyproject.toml [tool.datamodel-codegen.profiles.<name>] --version show version --watch Watch input file(s) for changes and regenerate output automatically --watch-delay WATCH_DELAY Debounce delay in seconds for watch mode (default: 0.5) -h, --help show this help message and exit Documentation: https://koxudaxi.github.io/datamodel-code-generator GitHub: https://github.com/koxudaxi/datamodel-code-generator datamodel-codegen 0.45.0-1 December 2025
🌐
GitHub
github.com › pydantic › pydantic › blob › main › docs › integrations › datamodel_code_generator.md
pydantic/docs/integrations/datamodel_code_generator.md at main · pydantic/pydantic
November 20, 2024 - # generated by datamodel-codegen: # filename: person.json # timestamp: 2020-05-19T15:07:31+00:00 from __future__ import annotations from typing import Any from pydantic import BaseModel, Field, conint class Pet(BaseModel): name: str | None = None age: int | None = None class Person(BaseModel): first_name: str = Field(description="The person's first name.") last_name: str = Field(description="The person's last name.") age: conint(ge=0) | None = Field(None, description='Age in years.') pets: list[Pet] | None = None comment: Any | None = None
Author   pydantic
🌐
Pydantify
pydantify.github.io › pydantify › technologies › dmcg
datamodel-code-generator - pydantify
Datamodel-code-generator (or DMCG for short) is a project which aims to translate data models written in either the ApenAPI 3 or JSONSchema format into Python class structures based on pydantic.
Find elsewhere
🌐
GitHub
github.com › guardicore › datamodel-code-generator
GitHub - guardicore/datamodel-code-generator · GitHub
This code generator creates pydantic v1 and v2 model, dataclasses.dataclass, typing.TypedDict and msgspec.Struct from an openapi file and others. See documentation for more details. ... You can generate models from a local file. $ datamodel-codegen --input api.yaml --output model.py
Author   guardicore
🌐
GitHub
github.com › koxudaxi › datamodel-code-generator › blob › main › CHANGELOG.md
datamodel-code-generator/CHANGELOG.md at main · koxudaxi/datamodel-code-generator
All notable changes to this project are documented in this file. This changelog is automatically generated from GitHub Releases. Pydantic v1 runtime support removed - Pydantic v2 is now required as a runtime dependency. Users running datamodel-code-generator with Pydantic v1 installed must ...
Author   koxudaxi
🌐
GitHub
github.com › koxudaxi › datamodel-code-generator › blob › main › docs › index.md
datamodel-code-generator/docs/index.md at main · koxudaxi/datamodel-code-generator
# 🆕 Pydantic v2 (recommended for new projects) datamodel-codegen --output-model-type pydantic_v2.BaseModel ... # 🏗️ Python dataclasses datamodel-codegen --output-model-type dataclasses.dataclass ... # 📝 TypedDict (for type hints without validation) datamodel-codegen --output-model-type typing.TypedDict ...
Author   koxudaxi
🌐
Koxudaxi
koxudaxi.github.io › datamodel-code-generator › what_is_the_difference_between_v1_and_v2
Output Model Types - datamodel-code-generator
pip install 'datamodel-code-generator[msgspec]' datamodel-codegen --input schema.json --output-model-type msgspec.Struct --output model.py · from msgspec import Struct, field from typing import Union, UnsetType from msgspec import UNSET class Pet(Struct): id: int name: str tag: Union[str, UnsetType] = UNSET ... graph TD A[Need runtime validation?] -->|Yes| B[Need best performance?] A -->|No| C[Need type hints for dicts?] B -->|Yes| D[msgspec.Struct] B -->|No| E[Pydantic v1 dependency?] E -->|Yes| F[pydantic.BaseModel] E -->|No| G[pydantic_v2.BaseModel] C -->|Yes| H[typing.TypedDict] C -->|No| I[dataclasses.dataclass]
🌐
Koxudaxi
koxudaxi.github.io › datamodel-code-generator › openapi
Generate from OpenAPI - datamodel-code ... - GitHub Pages
The code generator can create pydantic models from OpenAPI schema definitions, particularly using the data from the schema field. $ datamodel-codegen --input api.yaml --input-file-type openapi --output model.py ... openapi: "3.0.0" info: version: 1.0.0 title: Swagger Petstore license: name: ...
🌐
Docker Hub
hub.docker.com › r › koxudaxi › datamodel-code-generator
koxudaxi/datamodel-code-generator - Docker Image
This code generator creates pydantic v1 and v2⁠ model, dataclasses.dataclass⁠, typing.TypedDict⁠ and msgspec.Struct⁠ from an openapi file and others. See documentation⁠ for more details. ... You can generate models from a local file. $ datamodel-codegen --input api.yaml --output model.py Copy
🌐
GitHub
github.com › koxudaxi › datamodel-code-generator › blob › main › README.md
datamodel-code-generator/README.md at main · koxudaxi/datamodel-code-generator
# generated by datamodel-codegen: # filename: schema.json from __future__ import annotations from enum import Enum from typing import Optional from pydantic import BaseModel, Field class Species(Enum): dog = 'dog' cat = 'cat' bird = 'bird' fish = 'fish' class Pet(BaseModel): name: str = Field(..., description="The pet's name") species: Species age: Optional[int] = Field(None, description='Age in years', ge=0) vaccinated: Optional[bool] = False
Author   koxudaxi
🌐
PyPI
pypi.org › project › improved-datamodel-codegen
improved-datamodel-codegen · PyPI
https://github.com/koxudaxi/fa... https://pypi.org/project/datamodel-code-generator · datamodel-code-generator is released under the MIT License....
      » pip install improved-datamodel-codegen
    
Published   Mar 07, 2023
Version   1.2.1
🌐
GitHub
github.com › koxudaxi › datamodel-code-generator › blob › main › docs › using_as_module.md
datamodel-code-generator/docs/using_as_module.md at main · koxudaxi/datamodel-code-generator
... When the output parameter is omitted (or set to None), generate() returns the generated code directly as a string: !!! note GenerateConfig is only available in Pydantic v2 environments. For Pydantic v1, use from datamodel_code_generator.config ...
Author   koxudaxi