We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 584d4e6 commit b742a34Copy full SHA for b742a34
1 file changed
diracx-core/src/diracx/core/config/schema.py
@@ -48,7 +48,15 @@ def legacy_adaptor(cls, v):
48
"SerializableSet[str]",
49
"SerializableSet[SecurityProperty]",
50
}
51
- for field, hint in cls.__annotations__.items():
+
52
+ # To support inheritance, we have to find the annotation of all the MRO
53
+ # Skip the first classes (object, Pydantic.BaseModel, our BaseModel )
54
+ mro_annotations = {}
55
+ for mro_cls in cls.__mro__[::-1]:
56
+ if issubclass(mro_cls, BaseModel) and mro_cls != BaseModel:
57
+ mro_annotations.update(mro_cls.__annotations__)
58
59
+ for field, hint in mro_annotations.items():
60
# Convert comma separated lists to actual lists
61
if hint.startswith("set"):
62
raise NotImplementedError("Use SerializableSet instead!")
0 commit comments