feat: test oas; feat: v1.120.7
This commit is contained in:
parent
ba0530d6b1
commit
b896020a4f
@ -34,7 +34,8 @@ class _OASResponseBuilder:
|
|||||||
).copy()
|
).copy()
|
||||||
if def_sub_schemas := response_schema.pop("definitions", None):
|
if def_sub_schemas := response_schema.pop("definitions", None):
|
||||||
self._oas.components.schemas.update(def_sub_schemas)
|
self._oas.components.schemas.update(def_sub_schemas)
|
||||||
return response_schema
|
self._oas.components.schemas.update({response_schema['title']: response_schema})
|
||||||
|
return {'$ref': f'#/components/schemas/{response_schema["title"]}'}
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def _handle_list(self, obj):
|
def _handle_list(self, obj):
|
||||||
|
@ -11,7 +11,7 @@ from pydantic.main import BaseModel
|
|||||||
|
|
||||||
from aiohttp_pydantic import PydanticView, oas
|
from aiohttp_pydantic import PydanticView, oas
|
||||||
from aiohttp_pydantic.injectors import Group
|
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
|
from aiohttp_pydantic.oas.view import generate_oas
|
||||||
|
|
||||||
|
|
||||||
@ -37,6 +37,11 @@ class Pet(BaseModel):
|
|||||||
toys: List[Toy]
|
toys: List[Toy]
|
||||||
|
|
||||||
|
|
||||||
|
class Error(BaseModel):
|
||||||
|
code: int
|
||||||
|
text: str
|
||||||
|
|
||||||
|
|
||||||
class PetCollectionView(PydanticView):
|
class PetCollectionView(PydanticView):
|
||||||
async def get(
|
async def get(
|
||||||
self, format: str, lang: Lang = Lang.EN, name: Optional[str] = None, *, promo: Optional[UUID] = None
|
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"]],
|
size: Union[int, Literal["x", "l", "s"]],
|
||||||
day: Union[int, Literal["now"]] = "now",
|
day: Union[int, Literal["now"]] = "now",
|
||||||
) -> Union[r200[Pet], r404]:
|
) -> Union[r200[Pet], r404[Error], r400[Error]]:
|
||||||
return web.json_response()
|
return web.json_response()
|
||||||
|
|
||||||
async def put(self, id: int, /, pet: Pet):
|
async def put(self, id: int, /, pet: Pet):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user