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

Allow full schema customization #36

Open HeroicKatora opened 2 years ago

HeroicKatora commented 2 years ago

Adds a full callback hook to customize schema after the type annotations have been processed, not unlike pydantics own __modify_schema__ customization point. The goal here is to provide a suitable fallback for arbitrary modifications to the OpenAPI specification, in case the provided attribute processing is not yet ready for the details. The alternative, implementing the full available OpenAPI fields, is unlikely to be feasible and not readily translate to annotations.

codecov-commenter commented 2 years ago

Codecov Report

Merging #36 (0afbd28) into main (3648dde) will increase coverage by 0.07%. The diff coverage is 83.33%.

:exclamation: Current head 0afbd28 differs from pull request most recent head 1bcfa1a. Consider uploading reports for the commit 1bcfa1a to get more accurate results

@@            Coverage Diff             @@
##             main      #36      +/-   ##
==========================================
+ Coverage   93.12%   93.20%   +0.07%     
==========================================
  Files          11       11              
  Lines         771      780       +9     
==========================================
+ Hits          718      727       +9     
  Misses         53       53              
Impacted Files Coverage Δ
aiohttp_pydantic/oas/struct.py 91.02% <66.66%> (+0.11%) :arrow_up:
aiohttp_pydantic/oas/view.py 94.69% <100.00%> (+0.14%) :arrow_up:
aiohttp_pydantic/injectors.py 96.00% <0.00%> (+0.08%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3648dde...1bcfa1a. Read the comment docs.

Maillol commented 2 years ago

Please, in the readme, add paragraph "Custom Open API Schema" between "Custom Validation error" and "Demo" paragraphs. and a unittest