feat: test oas; feat: v1.120.7

This commit is contained in:
Georg K
2022-11-22 17:19:00 +03:00
parent ba0530d6b1
commit b896020a4f
2 changed files with 9 additions and 3 deletions

View File

@@ -11,7 +11,7 @@ from pydantic.main import BaseModel
from aiohttp_pydantic import PydanticView, oas
from aiohttp_pydantic.injectors import Group
from aiohttp_pydantic.oas.typing import r200, r201, r204, r404
from aiohttp_pydantic.oas.typing import r200, r201, r204, r404, r400
from aiohttp_pydantic.oas.view import generate_oas
@@ -37,6 +37,11 @@ class Pet(BaseModel):
toys: List[Toy]
class Error(BaseModel):
code: int
text: str
class PetCollectionView(PydanticView):
async def get(
self, format: str, lang: Lang = Lang.EN, name: Optional[str] = None, *, promo: Optional[UUID] = None
@@ -63,7 +68,7 @@ class PetItemView(PydanticView):
/,
size: Union[int, Literal["x", "l", "s"]],
day: Union[int, Literal["now"]] = "now",
) -> Union[r200[Pet], r404]:
) -> Union[r200[Pet], r404[Error], r400[Error]]:
return web.json_response()
async def put(self, id: int, /, pet: Pet):