mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
21 lines
338 B
Python
21 lines
338 B
Python
# output-json
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class Person(BaseModel):
|
|
name: str
|
|
age: int
|
|
|
|
class Config:
|
|
schema_extra = {
|
|
'examples': [
|
|
{
|
|
'name': 'John Doe',
|
|
'age': 25,
|
|
}
|
|
]
|
|
}
|
|
|
|
|
|
print(Person.schema_json(indent=2))
|