Add List schema
This commit is contained in:
parent
9c90381a89
commit
b711bd3792
27
schemas/list.py
Normal file
27
schemas/list.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
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"
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user