DC

datamodel-code-generator/datamodel-code-generator

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

4047 stars 品質 77 トレンド 48MIT

Pydantic v2モデル、データクラス、TypedDict、msgspecを生成します。OpenAPIから構造体を生成し、JSON Schema、GraphQL、Avro、Protobuf、そして生のJSON/YAML/CSVから使えます。

概要

🚀 スキーマ定義から数秒でPythonのデータモデルを生成できます。 📚 ドキュメント ·🧪遊び場 ·💼作業可能なリードメンテナ Playgroundプライバシー:生成はPyodideを使ってローカルブラウザで実行されます。スキーマやオプションはバックエンドに送られません。共有された複製URLはURLフラグメント(#state=...)にエンコードされており、ブラウザはサーバーに送信しません。完全なURLはブラウザ履歴や共有先に保存されます。 サポートされている入力の中から任意のものを選び、出力として望むPythonモデルスタイルを選んでください。--input-model path/to/file.py:ClassNameは、別のPythonファイルで定義された既存のPydantic、dataclass、またはTypedDictクラスを別の出力タイプにリターゲティングすることもできます。

概要(AI 翻訳)

🚀 スキーマ定義から数秒でPythonのデータモデルを生成できます。

📚 資料・ 🧪 遊び場・ 💼 リードメンテナが仕事に対応可能です

[!注] Playgroundのプライバシー:生成はPyodideを使ってブラウザ上でローカルに動作します。スキーマやオプションは バックエンド。共有複製URLはURLフラグメント(#state=...)にエンコードしますが、ブラウザはこれをサーバーに送信しません。 、完全なURLはブラウザ履歴や共有先に保存されている可能性があります。

✨ それが何をするのか

サポートされている入力の中からどれかを選び、出力として使いたいPythonモデルスタイルを選んでください。 --input-model path/to/file.py:ClassNameは既存のPydantic、dataclass、またはTypedDictクラスを再ターゲットすることも可能です 別のPythonファイルで異なる出力タイプに変換します。

  • 📄 OpenAPI 3、AsyncAPI、JSONスキーマ、Apache Avro、XMLスキーマ、プロトコルバッファ/gRPC、GraphQL、MCPツールスキーマ、生データ(JSON/YAML/CSV)をPythonモデルに変換します
  • 🐍 既存のPython型(Pydantic、dataclass、TypedDict)から--input-model経由で生成します。
  • 🎯 Pydantic v2、Pydantic v2 dataclass、dataclasses、TypedDict、またはmsgspec の出力を生成する

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

datamodel-code-generator

🚀 Generate Python data models from schema definitions in seconds.

📚 Documentation · 🧪 Playground · 💼 Lead maintainer available for work

[!NOTE] Playground privacy: Generation runs locally in your browser with Pyodide. Your schema and options are not sent to a backend. Shared repro URLs encode them in the URL fragment (#state=...), which browsers do not send to the server; the full URL can still be stored in your browser history or wherever you share it.

✨ What it does

Pick any one of the supported inputs and pick the Python model style you want as output. --input-model path/to/file.py:ClassName can even retarget an existing Pydantic, dataclass, or TypedDict class defined in another Python file to a different output type.

  • 📄 Converts OpenAPI 3, AsyncAPI, JSON Schema, Apache Avro, XML Schema, Protocol Buffers/gRPC, GraphQL, MCP tool schemas, and raw data (JSON/YAML/CSV) into Python models
  • 🐍 Generates from existing Python types (Pydantic, dataclass, TypedDict) via --input-model
  • 🎯 Generates Pydantic v2, Pydantic v2 dataclass, dataclasses, TypedDict, or msgspec output
  • 🔗 Handles complex schemas: $ref, allOf, oneOf, anyOf, enums, and nested types
  • ✅ Produces type-safe, validated code ready for your IDE and type checker
GitHub で README 全文を見る

推奨ツール

別のキーワードを試すか、フィルタを外してください。

インストール

npx skillfish add datamodel-code-generator/datamodel-code-generator
MCP 初心者?mcpskill.org のガイドから始めましょう →