mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
c3098a30cf
* Consistent __repr__ and __str__ methods for all types * add change description * devtools integration and feedback on repr methods * fix Color repr * tests for truncate * add devtools section to docs * tests for devtools * ValidationError inheriting from Representation * fix imports * tweaks * tweak docs * exec_examples.py integration with __repr__ changes
19 lines
336 B
Python
19 lines
336 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))
|