Skip to content

Commit

Permalink
Fix private member access
Browse files Browse the repository at this point in the history
  • Loading branch information
GDYendell committed Aug 12, 2024
1 parent f4d757e commit 3f70014
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/pvi/_format/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def create_schema(cls) -> dict[str, Any]:
Formatter itself is not included, as it should not be instanstiated directly.
"""
cls._rebuild_child_models()
cls.rebuild_child_models()
return cls.type_adapter().json_schema()

def format(self, device: Device, path: Path) -> None:
Expand Down
6 changes: 3 additions & 3 deletions src/pvi/typed_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,16 @@ def model_json_schema(
):
"""Ensure all child models have type field added before generating schema."""
if not cls.models_typed:
TypedModel._rebuild_child_models()
TypedModel.rebuild_child_models()

return super().model_json_schema(by_alias, ref_template, schema_generator, mode)

@classmethod
def _rebuild_child_models(cls):
def rebuild_child_models(cls):
"""Recursively rebuild all subclass models to add type into core schema."""
for subclass in cls.__subclasses__():
subclass.model_rebuild(force=True)
subclass._rebuild_child_models()
subclass.rebuild_child_models()

@classmethod
def _tag(cls):
Expand Down

0 comments on commit 3f70014

Please sign in to comment.