Skip to content

Commit

Permalink
Merge pull request #1030 from caarmen/fix-pydantic2-blueprint
Browse files Browse the repository at this point in the history
Fix the blueprint for pydantic version 2
  • Loading branch information
tfranzel authored Nov 13, 2023
2 parents edce053 + d1b874a commit fbbcab3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/blueprints/pydantic2.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ def get_name(self, auto_schema, direction):
def map_serializer(self, auto_schema, direction):

# let pydantic generate a JSON schema
schema = model_json_schema(self.target, ref_template="#/components/schemas")
schema = model_json_schema(self.target, ref_template="#/components/schemas/{model}")

# pull out potential sub-schemas and put them into component section
for sub_name, sub_schema in schema.pop("definitions", {}).items():
for sub_name, sub_schema in schema.pop("$defs", {}).items():
component = ResolvedComponent(
name=sub_name,
type=ResolvedComponent.SCHEMA,
Expand Down

0 comments on commit fbbcab3

Please sign in to comment.