From: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 21 Jul 2023 13:51:23 +0000 (+0000) Subject: 🎨 [pre-commit.ci] Auto format from pre-commit.com hooks X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F9873%2Fhead;p=thirdparty%2Ffastapi%2Ffastapi.git 🎨 [pre-commit.ci] Auto format from pre-commit.com hooks --- diff --git a/fastapi/_compat.py b/fastapi/_compat.py index a81394c00e..a8c7cbde85 100644 --- a/fastapi/_compat.py +++ b/fastapi/_compat.py @@ -88,9 +88,14 @@ if PYDANTIC_V2: return super().generate_inner(schema["schema"]) return super().nullable_schema(schema) - def default_schema(self, schema: core_schema.WithDefaultSchema) -> JsonSchemaValue: + def default_schema( + self, schema: core_schema.WithDefaultSchema + ) -> JsonSchemaValue: json_schema = super().default_schema(schema) - if self.skip_null_schema and json_schema.get("default", PydanticUndefined) is None: + if ( + self.skip_null_schema + and json_schema.get("default", PydanticUndefined) is None + ): json_schema.pop("default") return json_schema