Closed drderuiter closed 3 years ago
Merging #9 (13041af) into main (c6b979d) will increase coverage by
0.03%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## main #9 +/- ##
==========================================
+ Coverage 92.64% 92.67% +0.03%
==========================================
Files 11 11
Lines 666 669 +3
==========================================
+ Hits 617 620 +3
Misses 49 49
Impacted Files | Coverage Δ | |
---|---|---|
aiohttp_pydantic/__init__.py | 100.00% <100.00%> (ø) |
|
aiohttp_pydantic/injectors.py | 94.80% <100.00%> (+0.21%) |
: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 c6b979d...13041af. Read the comment docs.
Thank you for your contribution.
I would like that aiohttp-pydantic can accept a JSON that has a list as the top-level structure.
We can define a list as model using pydantic:
class Pets(BaseModel):
__root__: List[str]
Thank you!
When the
BodyGetter
class has to deal with a JSON that does not have an object as the top-level structure, it crashes. To replicate this behavior, simply send a POST request with request body["foo"]
in the demo, or run the test scenario added in this PR without the changes to theBodyGetter
.Seeing as the request body is always parsed to a Pydantic model, and never to a nested structure like
List[<MyPydanticModel>]
, this change does not alter any behavior except for returning a 400 whenever a 500 would have been returned otherwise.WDYT?
Awesome package, by the way!