0.11.0
rafalkrupinski
released this
17 Aug 12:47
·
41 commits
to develop
since this release
This release introduces some fundamental new features:
- thanks to pydantic, operation function arguments and response headers accept non-primitive types
- error responses and undeclared responses raise exceptions. If the response is in the response map, it's processed like a normal response and wrapped in an exception, otherwise exception includes the original
httpx.Response
- responses are now declared as tuple[BodyModel, HeadresModel]. Operation functions are now written this way:
@get('/')
async def get(...)->Annotated[
tuple[ResponseBody, ResponseHeaders],
Responses({
'default': Response(
Body({'application/json': list[Cat]}),
CatListResponseHeaders
)
}),
]:
...
Also, input parameters can be wrapped in a model, which allows this style:
response_body, response_headers = await client.get(body=request_body, headers=request_headers)