1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
# generated by datamodel-codegen:
# filename: tutorial_pet.json
from __future__ import annotations
from enum import Enum
from typing import Optional
from pydantic import BaseModel, Field, conint
class Species(Enum):
dog = 'dog'
cat = 'cat'
bird = 'bird'
fish = 'fish'
class Pet(BaseModel):
name: str = Field(..., description="The pet's name")
species: Species
age: Optional[conint(ge=0)] = Field(None, description='Age in years')
vaccinated: Optional[bool] = False
|