Add Artist schema
This commit is contained in:
parent
f82c622ebe
commit
f4964f63ab
18
schemas/artist.py
Normal file
18
schemas/artist.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
class ArtistBase(BaseModel):
|
||||||
|
name: str = Field(..., min_length=1, index=True, unique=True, description="Artist's name")
|
||||||
|
country: str = Field("Norway", description="Artist's country of origin")
|
||||||
|
|
||||||
|
class ArtistCreate(ArtistBase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class ArtistResponse(ArtistBase):
|
||||||
|
class Config:
|
||||||
|
orm_mode = True
|
||||||
|
schema_extra = {
|
||||||
|
"example": {
|
||||||
|
"name": "Edvard Munch",
|
||||||
|
"country": "Norway"
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user