]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
🎨 [pre-commit.ci] Auto format from pre-commit.com hooks feat/custom-generate-json-schema 9873/head
authorpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Fri, 21 Jul 2023 13:51:23 +0000 (13:51 +0000)
committerpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Fri, 21 Jul 2023 13:51:24 +0000 (13:51 +0000)
fastapi/_compat.py

index a81394c00ef6e6fc9db6b4527594764566da03f6..a8c7cbde856afde395c491e20f7d8595a52ca4a5 100644 (file)
@@ -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