Maillol / aiohttp-pydantic

Aiohttp View that validates request body and query sting regarding the annotations declared in the View method

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Response model validation

Alex-Bogdanov opened this issue · comments

commented
class PetCollectionView(PydanticView):
    async def get(self, age: Optional[int] = None) -> r200[List[Pet]]:
         pass

I expected this handler's response annotation triggers response content validation with pydantic, but unfortunately I was wrong. Is there any library capability to do that just like FastAPI does? It would very frustrating to have only request validation within aiohttp server, but without the same approach (sugar) for response validation

Hello,

Response annotation is only used by the documentation generation. That nice to have response validation you can make a PR if you want. But in my opinion this feature should be optional a user would like only enable this feature to the test like debug log.