Skip to content

Commit c41a776

Browse files
committed
fix: Handle inherited fields
They were skipped because we checked the type of class members instead of their kind (meaning aliases would be skipped). Issue-17: #17
1 parent 0379f9d commit c41a776

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/griffe_pydantic/static.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
ExprKeyword,
1717
ExprName,
1818
Function,
19+
Kind,
1920
Module,
2021
dynamic_import,
2122
get_logger,
@@ -156,12 +157,13 @@ def process_class(cls: Class, *, processed: set[str], schema: bool = False) -> N
156157
cls.extra[common.self_namespace]["schema"] = common.json_schema(true_class)
157158

158159
for member in cls.all_members.values():
159-
if isinstance(member, Attribute):
160-
process_attribute(member, cls, processed=processed)
161-
elif isinstance(member, Function):
162-
process_function(member, cls, processed=processed)
163-
elif isinstance(member, Class):
164-
process_class(member, processed=processed, schema=schema)
160+
kind = member.kind
161+
if kind is Kind.ATTRIBUTE:
162+
process_attribute(member, cls, processed=processed) # type: ignore[arg-type]
163+
elif kind is Kind.FUNCTION:
164+
process_function(member, cls, processed=processed) # type: ignore[arg-type]
165+
elif kind is Kind.CLASS:
166+
process_class(member, processed=processed, schema=schema) # type: ignore[arg-type]
165167

166168

167169
def process_module(

0 commit comments

Comments
 (0)