Add RandomNumber schema
This commit is contained in:
parent
be717a5e66
commit
2904c8503c
21
schemas/randomnumber.py
Normal file
21
schemas/randomnumber.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
class RandomNumberBase(BaseModel):
|
||||||
|
number: int = Field(..., description="A random integer number")
|
||||||
|
|
||||||
|
class RandomNumberCreate(RandomNumberBase):
|
||||||
|
class Config:
|
||||||
|
schema_extra = {
|
||||||
|
"example": {
|
||||||
|
"number": 42
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class RandomNumber(RandomNumberBase):
|
||||||
|
class Config:
|
||||||
|
orm_mode = True
|
||||||
|
schema_extra = {
|
||||||
|
"example": {
|
||||||
|
"number": 42
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user