Maillol / aiohttp-pydantic

Aiohttp View that validates request body and query sting regarding the annotations declared in the View method
MIT License
67 stars 21 forks source link

Integration with Dependency Injector #44

Closed KurganskyVladimir closed 7 months ago

KurganskyVladimir commented 1 year ago

There is an issue to use aiohttp-pydantic with (dependency-injector). The issue is in pydantic exception about DI params, which will be injected. In order to fix it, we need to override PydanticView logic in static method parse_func_signature (actually in injectors module, _parse_func_signature). We need to have a mechanism to skip DI and our custom classes/types in order to allow DI inject services/resources to aiohttp handlers.

There is a fix with defining our custom 'PydanticView'-like class, but in this case we need to override almost all oas package too, because there is a call of is_pydantic_view function to build spec in generate_oas.