{"id":13486573,"url":"https://github.com/koxudaxi/datamodel-code-generator","last_synced_at":"2026-03-04T06:07:37.812Z","repository":{"id":38050201,"uuid":"189179081","full_name":"koxudaxi/datamodel-code-generator","owner":"koxudaxi","description":"Python data model generator (Pydantic, dataclasses, TypedDict, msgspec) from OpenAPI, JSON Schema, GraphQL, and raw data (JSON/YAML/CSV).","archived":false,"fork":false,"pushed_at":"2026-01-07T02:57:44.000Z","size":25526,"stargazers_count":3691,"open_issues_count":38,"forks_count":424,"subscribers_count":27,"default_branch":"main","last_synced_at":"2026-01-09T10:58:29.265Z","etag":null,"topics":["code-generator","csv","dataclass","datamodel","fastapi","generator","graphql","json-schema","msgspec","openapi","openapi-codegen","pydantic","python","swagger","swagger-codegen","typeddict","yaml"],"latest_commit_sha":null,"homepage":"https://koxudaxi.github.io/datamodel-code-generator/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/koxudaxi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yaml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"docs/supported-data-types.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["koxudaxi"]}},"created_at":"2019-05-29T08:01:32.000Z","updated_at":"2026-01-09T08:28:07.000Z","dependencies_parsed_at":"2025-12-24T04:08:52.805Z","dependency_job_id":null,"html_url":"https://github.com/koxudaxi/datamodel-code-generator","commit_stats":{"total_commits":1146,"total_committers":135,"mean_commits":8.488888888888889,"dds":0.5776614310645725,"last_synced_commit":"d306553dc949e87fb476c83b8d22b23ae72a8dda"},"previous_names":[],"tags_count":239,"template":false,"template_full_name":null,"purl":"pkg:github/koxudaxi/datamodel-code-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koxudaxi%2Fdatamodel-code-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koxudaxi%2Fdatamodel-code-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koxudaxi%2Fdatamodel-code-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koxudaxi%2Fdatamodel-code-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koxudaxi","download_url":"https://codeload.github.com/koxudaxi/datamodel-code-generator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koxudaxi%2Fdatamodel-code-generator/sbom","scorecard":{"id":14766,"data":{"date":"2025-08-04","repo":{"name":"github.com/koxudaxi/datamodel-code-generator","commit":"e9ffb9fdf8ac55dc7a7306674c0430adfc73b92f"},"scorecard":{"version":"v5.2.1-28-gc1d103a9","commit":"c1d103a9bb9f635ec7260bf9aa0699466fa4be0e"},"score":6.2,"checks":[{"name":"Maintained","score":10,"reason":"28 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#maintained"}},{"name":"Code-Review","score":9,"reason":"Found 23/24 approved changesets -- score normalized to 9","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#cii-best-practices"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql.yaml:21","Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql.yaml:22","Warn: no topLevel permission defined: .github/workflows/codeql.yaml:1","Info: topLevel 'contents' permission set to 'read': .github/workflows/codespell.yaml:16","Warn: no topLevel permission defined: .github/workflows/codspeed.yaml:1","Warn: no topLevel permission defined: .github/workflows/docs.yaml:1","Warn: no topLevel permission defined: .github/workflows/publish.yaml:1","Warn: no topLevel permission defined: .github/workflows/test.yaml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#token-permissions"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":1,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'main'","Warn: 'force pushes' enabled on branch 'main'","Warn: 'branch protection settings apply to administrators' is disabled on branch 'main'","Info: 'stale review dismissal' is required to merge on branch 'main'","Warn: branch 'main' does not require approvers","Warn: codeowners review is not required on branch 'main'","Warn: 'last push approval' is disabled on branch 'main'","Warn: 'up-to-date branches' is disabled on branch 'main'","Info: status check found to merge onto on branch 'main'","Info: PRs are required in order to make changes on branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#branch-protection"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/publish.yaml:28"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#packaging"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#fuzzing"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yaml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/codeql.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yaml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/codeql.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yaml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/codeql.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yaml:44: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/codeql.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codespell.yaml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/codespell.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/codespell.yaml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/codespell.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codspeed.yaml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/codspeed.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codspeed.yaml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/codspeed.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/codspeed.yaml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/codspeed.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/codspeed.yaml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/codspeed.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/docs.yaml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/docs.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/docs.yaml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/docs.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/docs.yaml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/docs.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yaml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/publish.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish.yaml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/publish.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yaml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/publish.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yaml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/publish.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish.yaml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/publish.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yaml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/publish.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish.yaml:59: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/publish.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish.yaml:65: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/publish.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish.yaml:70: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/publish.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish.yaml:72: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/publish.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish.yaml:74: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/publish.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/test.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yaml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/test.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:57: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/test.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:69: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/test.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yaml:73: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/test.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:81: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/test.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:91: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/test.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yaml:96: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/test.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:117: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/test.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yaml:121: update your workflow using https://app.stepsecurity.io/secureworkflow/koxudaxi/datamodel-code-generator/test.yaml/main?enable=pin","Warn: containerImage not pinned by hash: Dockerfile:1","Warn: pipCommand not pinned by hash: Dockerfile:9","Info:   0 out of  18 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of  16 third-party GitHubAction dependencies pinned","Info:   0 out of   1 containerImage dependencies pinned","Info:   0 out of   1 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":10,"reason":"SAST tool is run on all commits","details":["Info: SAST configuration detected: CodeQL","Info: all commits (30) are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-14T15:31:02.544Z","repository_id":38050201,"created_at":"2025-08-14T15:31:02.545Z","updated_at":"2025-08-14T15:31:02.545Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-generator","csv","dataclass","datamodel","fastapi","generator","graphql","json-schema","msgspec","openapi","openapi-codegen","pydantic","python","swagger","swagger-codegen","typeddict","yaml"],"created_at":"2024-07-31T18:00:48.489Z","updated_at":"2026-03-04T06:07:37.803Z","avatar_url":"https://github.com/koxudaxi.png","language":"Python","funding_links":["https://github.com/sponsors/koxudaxi"],"categories":["Python","HarmonyOS","Utilities","yaml","其他_大数据","OpenAPI Utilities"],"sub_categories":["Windows Manager","资源传输下载"],"readme":"# datamodel-code-generator\n\n🚀 Generate Python data models from schema definitions in seconds.\n\n[![PyPI version](https://badge.fury.io/py/datamodel-code-generator.svg)](https://pypi.python.org/pypi/datamodel-code-generator)\n[![Conda-forge](https://img.shields.io/conda/v/conda-forge/datamodel-code-generator)](https://anaconda.org/conda-forge/datamodel-code-generator)\n[![Downloads](https://pepy.tech/badge/datamodel-code-generator/month)](https://pepy.tech/project/datamodel-code-generator)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/datamodel-code-generator)](https://pypi.python.org/pypi/datamodel-code-generator)\n[![codecov](https://codecov.io/gh/koxudaxi/datamodel-code-generator/graph/badge.svg?token=plzSSFb9Li)](https://codecov.io/gh/koxudaxi/datamodel-code-generator)\n![license](https://img.shields.io/github/license/koxudaxi/datamodel-code-generator.svg)\n[![Pydantic v1](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v1.json)](https://pydantic.dev)\n[![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://pydantic.dev)\n\n\u003e 📣 💼 Maintainer update: Open to opportunities. 🔗 [koxudaxi.dev](https://koxudaxi.dev/?utm_source=github_readme\u0026utm_medium=top\u0026utm_campaign=open_to_work)\n\n## ✨ What it does\n\n- 📄 Converts **OpenAPI 3**, **JSON Schema**, **GraphQL**, and raw data (JSON/YAML/CSV) into Python models\n- 🐍 Generates from **existing Python types** (Pydantic, dataclass, TypedDict) via `--input-model`\n- 🎯 Generates **Pydantic v1/v2**, **dataclasses**, **TypedDict**, or **msgspec** output\n- 🔗 Handles complex schemas: `$ref`, `allOf`, `oneOf`, `anyOf`, enums, and nested types\n- ✅ Produces type-safe, validated code ready for your IDE and type checker\n\n---\n\n## 📖 Documentation\n\n**👉 [datamodel-code-generator.koxudaxi.dev](https://datamodel-code-generator.koxudaxi.dev)**\n\n- 🖥️ [CLI Reference](https://datamodel-code-generator.koxudaxi.dev/cli-reference/) - All command-line options\n- ⚙️ [pyproject.toml](https://datamodel-code-generator.koxudaxi.dev/pyproject_toml/) - Configuration file\n- 🔄 [CI/CD Integration](https://datamodel-code-generator.koxudaxi.dev/ci-cd/) - GitHub Actions, pre-commit hooks\n- 🚀 [One-liner Usage](https://datamodel-code-generator.koxudaxi.dev/oneliner/) - uvx, pipx, clipboard integration\n- ❓ [FAQ](https://datamodel-code-generator.koxudaxi.dev/faq/) - Common questions\n\n---\n\n## 📦 Installation\n\n```bash\nuv tool install datamodel-code-generator\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eOther installation methods\u003c/summary\u003e\n\n**pip:**\n```bash\npip install datamodel-code-generator\n```\n\n**uv (add to project):**\n```bash\nuv add datamodel-code-generator\n```\n\n**conda:**\n```bash\nconda install -c conda-forge datamodel-code-generator\n```\n\n**With HTTP support** (for resolving remote `$ref`):\n```bash\npip install 'datamodel-code-generator[http]'\n```\n\n**With GraphQL support:**\n```bash\npip install 'datamodel-code-generator[graphql]'\n```\n\n**Docker:**\n```bash\ndocker pull koxudaxi/datamodel-code-generator\n```\n\n\u003c/details\u003e\n\n---\n\n## 🏃 Quick Start\n\n```bash\ndatamodel-codegen --input schema.json --input-file-type jsonschema --output-model-type pydantic_v2.BaseModel --output model.py\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e📄 schema.json (input)\u003c/summary\u003e\n\n```json\n{\n  \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n  \"title\": \"Pet\",\n  \"type\": \"object\",\n  \"required\": [\"name\", \"species\"],\n  \"properties\": {\n    \"name\": {\n      \"type\": \"string\",\n      \"description\": \"The pet's name\"\n    },\n    \"species\": {\n      \"type\": \"string\",\n      \"enum\": [\"dog\", \"cat\", \"bird\", \"fish\"]\n    },\n    \"age\": {\n      \"type\": \"integer\",\n      \"minimum\": 0,\n      \"description\": \"Age in years\"\n    },\n    \"vaccinated\": {\n      \"type\": \"boolean\",\n      \"default\": false\n    }\n  }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e🐍 model.py (output)\u003c/summary\u003e\n\n```python\n# generated by datamodel-codegen:\n#   filename:  schema.json\n\nfrom __future__ import annotations\n\nfrom enum import Enum\nfrom typing import Optional\n\nfrom pydantic import BaseModel, Field\n\n\nclass Species(Enum):\n    dog = 'dog'\n    cat = 'cat'\n    bird = 'bird'\n    fish = 'fish'\n\n\nclass Pet(BaseModel):\n    name: str = Field(..., description=\"The pet's name\")\n    species: Species\n    age: Optional[int] = Field(None, description='Age in years', ge=0)\n    vaccinated: Optional[bool] = False\n```\n\n\u003c/details\u003e\n\n---\n\n## 📥 Supported Input\n\n- OpenAPI 3 (YAML/JSON)\n- JSON Schema\n- JSON / YAML / CSV data\n- GraphQL schema\n- Python types (Pydantic, dataclass, TypedDict) via `--input-model`\n- Python dictionary\n\n## 📤 Supported Output\n\n- [pydantic v1](https://docs.pydantic.dev/1.10/) BaseModel\n- [pydantic v2](https://docs.pydantic.dev/) BaseModel\n- [pydantic v2](https://docs.pydantic.dev/) dataclass\n- [dataclasses](https://docs.python.org/3/library/dataclasses.html)\n- [TypedDict](https://docs.python.org/3/library/typing.html#typing.TypedDict)\n- [msgspec](https://github.com/jcrist/msgspec) Struct\n\n---\n\n## 🍳 Common Recipes\n\n### 🤖 Get CLI Help from LLMs\n\nGenerate a prompt to ask LLMs about CLI options:\n\n```bash\ndatamodel-codegen --generate-prompt \"Best options for Pydantic v2?\" | claude -p\n```\n\nSee [LLM Integration](https://datamodel-code-generator.koxudaxi.dev/llm-integration/) for more examples.\n\n### 🌐 Generate from URL\n\n```bash\npip install 'datamodel-code-generator[http]'\ndatamodel-codegen --url https://example.com/api/openapi.yaml --output model.py\n```\n\n### ⚙️ Use with pyproject.toml\n\n```toml\n[tool.datamodel-codegen]\ninput = \"schema.yaml\"\noutput = \"src/models.py\"\noutput-model-type = \"pydantic_v2.BaseModel\"\n```\n\nThen simply run:\n\n```bash\ndatamodel-codegen\n```\n\nSee [pyproject.toml Configuration](https://datamodel-code-generator.koxudaxi.dev/pyproject_toml/) for more options.\n\n### 🔄 CI/CD Integration\n\nValidate generated models in your CI pipeline:\n\n```yaml\n- uses: koxudaxi/datamodel-code-generator@0.44.0\n  with:\n    input: schemas/api.yaml\n    output: src/models/api.py\n```\n\nSee [CI/CD Integration](https://datamodel-code-generator.koxudaxi.dev/ci-cd/) for more options.\n\n---\n\n## 💖 Sponsors\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd valign=\"top\" align=\"center\"\u003e\n      \u003ca href=\"https://github.com/astral-sh\"\u003e\n        \u003cimg src=\"https://avatars.githubusercontent.com/u/115962839?s=200\u0026v=4\" alt=\"Astral Logo\" style=\"width: 100px;\"\u003e\n        \u003cp\u003eAstral\u003c/p\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n---\n\n## 🏢 Projects that use datamodel-code-generator\n\nThese projects use datamodel-code-generator. See the linked examples for real-world usage.\n\n- [PostHog/posthog](https://github.com/PostHog/posthog) - *[Generate models via npm run](https://github.com/PostHog/posthog/blob/e1a55b9cb38d01225224bebf8f0c1e28faa22399/package.json#L41)*\n- [airbytehq/airbyte](https://github.com/airbytehq/airbyte) - *[Generate Python, Java/Kotlin, and Typescript protocol models](https://github.com/airbytehq/airbyte-protocol/tree/main/protocol-models/bin)*\n- [apache/iceberg](https://github.com/apache/iceberg) - *[Generate Python code](https://github.com/apache/iceberg/blob/d2e1094ee0cc6239d43f63ba5114272f59d605d2/open-api/README.md?plain=1#L39)*\n- [open-metadata/OpenMetadata](https://github.com/open-metadata/OpenMetadata) - *[datamodel_generation.py](https://github.com/open-metadata/OpenMetadata/blob/main/scripts/datamodel_generation.py)*\n- [awslabs/aws-lambda-powertools-python](https://github.com/awslabs/aws-lambda-powertools-python) - *[Recommended for advanced-use-cases](https://awslabs.github.io/aws-lambda-powertools-python/2.6.0/utilities/parser/#advanced-use-cases)*\n- [Netflix/consoleme](https://github.com/Netflix/consoleme) - *[Generate models from Swagger](https://github.com/Netflix/consoleme/blob/master/docs/gitbook/faq.md#how-do-i-generate-models-from-the-swagger-specification)*\n- [DataDog/integrations-core](https://github.com/DataDog/integrations-core) - *[Config models](https://github.com/DataDog/integrations-core/blob/master/docs/developer/meta/config-models.md)*\n- [argoproj-labs/hera](https://github.com/argoproj-labs/hera) - *[Makefile](https://github.com/argoproj-labs/hera/blob/c8cbf0c7a676de57469ca3d6aeacde7a5e84f8b7/Makefile#L53-L62)*\n- [SeldonIO/MLServer](https://github.com/SeldonIO/MLServer) - *[generate-types.sh](https://github.com/SeldonIO/MLServer/blob/master/hack/generate-types.sh)*\n- [geojupyter/jupytergis](https://github.com/geojupyter/jupytergis) - *[Python type generation from JSONSchema](https://jupytergis.readthedocs.io/en/latest/contributor_guide/explanation/code-generation.html)*\n- [Nike-Inc/brickflow](https://github.com/Nike-Inc/brickflow) - *[Code generate tools](https://github.com/Nike-Inc/brickflow/blob/e3245bf638588867b831820a6675ada76b2010bf/tools/README.md?plain=1#L8)*\n- [cloudcoil/cloudcoil](https://github.com/cloudcoil/cloudcoil) - *[Model generation](https://github.com/cloudcoil/cloudcoil#%EF%B8%8F-model-generation)*\n- [IBM/compliance-trestle](https://github.com/IBM/compliance-trestle) - *[Building models from OSCAL schemas](https://github.com/IBM/compliance-trestle/blob/develop/docs/contributing/website.md#building-the-models-from-the-oscal-schemas)*\n- [hashintel/hash](https://github.com/hashintel/hash) - *[codegen.sh](https://github.com/hashintel/hash/blob/9762b1a1937e14f6b387677e4c7fe4a5f3d4a1e1/libs/%40local/hash-graph-client/python/scripts/codegen.sh#L21-L39)*\n\n[See all dependents →](https://github.com/koxudaxi/datamodel-code-generator/network/dependents)\n\n---\n\n## 🔗 Related Projects\n\n- **[fastapi-code-generator](https://github.com/koxudaxi/fastapi-code-generator)** - Generate FastAPI app from OpenAPI\n- **[pydantic-pycharm-plugin](https://github.com/koxudaxi/pydantic-pycharm-plugin)** - PyCharm plugin for Pydantic\n\n---\n\n## 🤝 Contributing\n\nSee [Development \u0026 Contributing](https://datamodel-code-generator.koxudaxi.dev/development-contributing/) for how to get started!\n\n## 📄 License\n\nMIT License - see [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoxudaxi%2Fdatamodel-code-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoxudaxi%2Fdatamodel-code-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoxudaxi%2Fdatamodel-code-generator/lists"}