fapi/app/schemas.py

21 lines
554 B
Python

from pydantic import BaseModel, Field
# Schemat do tworzenia nowej osoby (POST)
class PersonCreate(BaseModel):
last_name: str = Field(..., description="Nazwisko osoby", example="Kowalski")
first_name: str = Field(..., description="Imię osoby", example="Jan")
address: str | None = None
city: str | None = None
# Schemat reprezentujący osobę (GET)
class Person(BaseModel):
person_id: int
last_name: str
first_name: str
address: str | None = None
city: str | None = None
class Config:
orm_mode = True