From: James Saunders Date: Fri, 29 Mar 2019 15:02:53 +0000 (+0200) Subject: :memo: Add note in response model docs: why not return type annotations (#109) X-Git-Tag: 0.10.3~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=714e68b5f05f75a5d8d55c837c9b714e2199e722;p=thirdparty%2Ffastapi%2Ffastapi.git :memo: Add note in response model docs: why not return type annotations (#109) * Update response model documentation to explain design choice Closes #101 * :memo: Update note about return function type annotation --- diff --git a/docs/tutorial/response-model.md b/docs/tutorial/response-model.md index 128206a40a..21b885ebbe 100644 --- a/docs/tutorial/response-model.md +++ b/docs/tutorial/response-model.md @@ -24,6 +24,9 @@ But most importantly: * Will limit the output data to that of the model. We'll see how that's important below. +!!! note "Technical Details" + The response model is declared in this parameter instead of as a function return type annotation, because the path function may not actually return that response model but rather return a `dict`, database object or some other model, and then use the `response_model` to perform the field limiting and serialization. + ## Return the same input data Here we are declaring a `UserIn` model, it will contain a plaintext password: