Skip to content

Commit

Permalink
Merge pull request #23 from dotX12/dev
Browse files Browse the repository at this point in the history
Dev to master
  • Loading branch information
dotX12 authored Apr 24, 2023
2 parents ba91c2a + 124f1d2 commit 6d5d834
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pyfa_converter/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,15 @@ def make_form_parameter(field: ModelField) -> Any:
the result of `Depends on` if it is.
"""
if issubclass(field.type_, BaseModel):
field_type = type(field.type_) if not isinstance(field.type_, type) else field.type_

if issubclass(field_type, BaseModel):
# This is a sub-model.
assert hasattr(field.type_, _type_var_name), (
assert hasattr(field_type, _type_var_name), (
f"Sub-model class for {field.name} field must be decorated with"
f" `as_form` too."
)
attr = getattr(field.type_, _type_var_name)
attr = getattr(field_type, _type_var_name)
return Depends(attr) # noqa
else:
return cls.param_maker(field=field, _type=_type)
Expand Down

0 comments on commit 6d5d834

Please sign in to comment.