mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
Update datamodel_code_generator.md (#2058)
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
[datamodel-code-generator](https://github.com/koxudaxi/datamodel-code-generator/) is a command to generate pydantic models from other data types.
|
||||
The [datamodel-code-generator](https://github.com/koxudaxi/datamodel-code-generator/) project is a library and command-line utility to generate pydantic models from just about any data source, including:
|
||||
|
||||
* OpenAPI 3 (YAML/JSON)
|
||||
* JSON Schema
|
||||
* JSON/YAML Data (which will converted to JSON Schema)
|
||||
|
||||
* Supported source types
|
||||
* OpenAPI 3 (YAML/JSON)
|
||||
* JSON Schema
|
||||
* JSON/YAML Data (It will be converted to JSON Schema)
|
||||
Whenever you find yourself with any data convertible JSON but without pydantic models, this tool will allow you to generate type-safe model hierarchies on demand.
|
||||
|
||||
## Install
|
||||
## Installation
|
||||
```bash
|
||||
pip install datamodel-code-generator
|
||||
```
|
||||
|
||||
## Example
|
||||
In this case, The datamodel-code-generator creates pydantic models from JSON Schema.
|
||||
In this case, datamodel-code-generator creates pydantic models from a JSON Schema file.
|
||||
```bash
|
||||
datamodel-codegen --input person.json --input-file-type jsonschema --output model.py
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user