diff --git a/pydantic/_internal/_generate_schema.py b/pydantic/_internal/_generate_schema.py index 4055a4e3e7..e95b7d6bd8 100644 --- a/pydantic/_internal/_generate_schema.py +++ b/pydantic/_internal/_generate_schema.py @@ -2337,12 +2337,12 @@ def get_schema_or_ref(self, tp: Any) -> Iterator[tuple[str, None] | tuple[str, C def resolve_original_schema(schema: CoreSchema, definitions: dict[str, CoreSchema]) -> CoreSchema | None: - if schema['type'] == 'definition-ref': - return definitions.get(schema['schema_ref'], None) - elif schema['type'] == 'definitions': + schema_type = schema['type'] + if schema_type == 'definition-ref': + return definitions.get(schema['schema_ref']) + elif schema_type == 'definitions': return schema['schema'] - else: - return schema + return schema class _FieldNameStack: