Open filippomc opened 3 weeks ago
Possibly related discussion: https://github.com/pydantic/pydantic/discussions/4242
If I don't add a new field the problem does not arise
so problem only appears when you ADD some field ? or always ?
If I don't add a field it's like Pydantic is considering the two classes equivalent and what I see is that the annotations are the same from the base class. When adding a field, that field is the only one within the annotations dict.
well I still do not understand you.. can you show two examples working and non working or something...
The not working example is the one I originally posted, and the application breaks on any path with the error above. These are a few ones that are working for me:
Working -- no inheritance:
class MySchema(Schema):
name: str
description: str = None
other: str
Working -- duplicate all base class fields
class ViewableContent(Schema):
name: str
description: str = None
class MySchema(ViewableContent):
name: str = None
description: str = None
other: str
Working -- subclassing but no new fields
class ViewableContent(Schema):
name: str
description: str = None
class MySchema(ViewableContent):
pass
Created an example project with all the examples
Describe the bug
I have a schema hierarchy such as:
Then add a router like the following:
When I run my application the following error is raised:
Versions: