From 4fcdb31947f23c1bf9aa661dfd86079ea0a433b9 Mon Sep 17 00:00:00 2001 From: Matthew Evans <7916000+ml-evs@users.noreply.github.com> Date: Wed, 11 May 2022 22:43:47 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Add=20OpenAPI=20warning=20to=20"?= =?UTF-8?q?Body=20-=20Fields"=20docs=20with=20extra=20schema=20extensions?= =?UTF-8?q?=20(#4846)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sebastián Ramírez --- docs/en/docs/tutorial/body-fields.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/en/docs/tutorial/body-fields.md b/docs/en/docs/tutorial/body-fields.md index 1f38a0c5c..0cfe576d6 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.