From: Matthew Evans <7916000+ml-evs@users.noreply.github.com> Date: Wed, 11 May 2022 21:43:47 +0000 (+0100) Subject: 📝 Add OpenAPI warning to "Body - Fields" docs with extra schema extensions (#4846) X-Git-Tag: 0.78.0~29 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4fcdb31947f23c1bf9aa661dfd86079ea0a433b9;p=thirdparty%2Ffastapi%2Ffastapi.git 📝 Add OpenAPI warning to "Body - Fields" docs with extra schema extensions (#4846) Co-authored-by: Sebastián Ramírez --- diff --git a/docs/en/docs/tutorial/body-fields.md b/docs/en/docs/tutorial/body-fields.md index 1f38a0c5c5..0cfe576d68 100644 --- a/docs/en/docs/tutorial/body-fields.md +++ b/docs/en/docs/tutorial/body-fields.md @@ -57,6 +57,10 @@ You can declare extra information in `Field`, `Query`, `Body`, etc. And it will You will learn more about adding extra information later in the docs, when learning to declare examples. +!!! warning + Extra keys passed to `Field` will also be present in the resulting OpenAPI schema for your application. + As these keys may not necessarily be part of the OpenAPI specification, some OpenAPI tools, for example [the OpenAPI validator](https://validator.swagger.io/), may not work with your generated schema. + ## Recap You can use Pydantic's `Field` to declare extra validations and metadata for model attributes.