27 lines
729 B
Python
27 lines
729 B
Python
from pydantic import BaseModel, Field
|
|
|
|
class ListBase(BaseModel):
|
|
name: str = Field(..., description="Name of the list")
|
|
description: str | None = Field(None, description="Description of the list")
|
|
|
|
class ListCreate(ListBase):
|
|
class Config:
|
|
schema_extra = {
|
|
"example": {
|
|
"name": "Grocery List",
|
|
"description": "Items to buy from the grocery store"
|
|
}
|
|
}
|
|
|
|
class ListResponse(ListBase):
|
|
id: int
|
|
|
|
class Config:
|
|
orm_mode = True
|
|
schema_extra = {
|
|
"example": {
|
|
"id": 1,
|
|
"name": "Grocery List",
|
|
"description": "Items to buy from the grocery store"
|
|
}
|
|
} |