]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
:memo: Add note in response model docs: why not return type annotations (#109)
authorJames Saunders <james@businessoptics.biz>
Fri, 29 Mar 2019 15:02:53 +0000 (17:02 +0200)
committerSebastián Ramírez <tiangolo@gmail.com>
Fri, 29 Mar 2019 15:02:53 +0000 (19:02 +0400)
* Update response model documentation to explain design choice

Closes #101

* :memo: Update note about return function type annotation

docs/tutorial/response-model.md

index 128206a40a8ac1e642dea189acb790e6440a308b..21b885ebbe97f4bdaac88c70eb25251e0c5fd7be 100644 (file)
@@ -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: