Skip to content

Commit

Permalink
Replace the use of update_forward_refs() with model_rebuild()
Browse files Browse the repository at this point in the history
  • Loading branch information
candleindark committed Dec 1, 2023
1 parent 739db75 commit 5528c3d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dandischema/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,10 @@ def ensure_value(cls, val: Union[Any, List[Any]]) -> Union[Any, List[Any]]:
_ldmeta = {"nskey": "schema"}


PropertyValue.update_forward_refs()
# This is mostly not needed at all since self-referencing models
# are automatically resolved by Pydantic in a pretty consistent way even in Pydantic V1
# https://docs.pydantic.dev/1.10/usage/postponed_annotations/#self-referencing-models
PropertyValue.model_rebuild()

Identifier = str
ORCID = str
Expand Down Expand Up @@ -1165,7 +1168,10 @@ class BioSample(DandiBaseModel):
}


BioSample.update_forward_refs()
# This is mostly not needed at all since self-referencing models
# are automatically resolved by Pydantic in a pretty consistent way even in Pydantic V1
# https://docs.pydantic.dev/1.10/usage/postponed_annotations/#self-referencing-models
BioSample.model_rebuild()


class CommonModel(DandiBaseModel):
Expand Down

0 comments on commit 5528c3d

Please sign in to comment.