mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
6e29848608
* Add datamodel-code-generator link in pydantic document site. * tweak menu * fix blank lines Co-authored-by: Samuel Colvin <samcolvin@gmail.com> Co-authored-by: Samuel Colvin <s@muelcolvin.com>
20 lines
624 B
Python
20 lines
624 B
Python
# generated by datamodel-codegen:
|
|
# filename: person.json
|
|
# timestamp: 2020-05-19T15:07:31+00:00
|
|
from __future__ import annotations
|
|
from typing import Any, List, Optional
|
|
from pydantic import BaseModel, Field, conint
|
|
|
|
|
|
class Pet(BaseModel):
|
|
name: Optional[str] = None
|
|
age: Optional[int] = None
|
|
|
|
|
|
class Person(BaseModel):
|
|
first_name: str = Field(..., description="The person's first name.")
|
|
last_name: str = Field(..., description="The person's last name.")
|
|
age: Optional[conint(ge=0)] = Field(None, description='Age in years.')
|
|
pets: Optional[List[Pet]] = None
|
|
comment: Optional[Any] = None
|