Skip to content

Commit

Permalink
Resolve #243. Replace deprecated BaseModel.__fields__
Browse files Browse the repository at this point in the history
  • Loading branch information
theferrit32 committed Sep 6, 2023
1 parent 9c3ca34 commit a21cdc2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ga4gh/vrs/_internal/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,23 @@ def pydantic_class_refatt_map():
))
# Types directly reffable
reffable_classes = list(filter(
lambda c: ('id' in c.__fields__
lambda c: ('id' in c.model_fields
and is_identifiable(c)),
model_classes
))
# Types reffable because they are a union of reffable types
union_reffable_classes = []
for model_class in model_classes:
if issubclass(model_class, RootModel):
flattened_type_annotation = flatten_type(model_class.__fields__["root"].annotation)
flattened_type_annotation = flatten_type(model_class.model_fields["root"].annotation)
print("flattened_type_annotation: " + str(flattened_type_annotation))
if overlaps(reffable_classes, flattened_type_annotation):
union_reffable_classes.append(model_class)
reffable_fields = {}
# Find any field whose type is a subclass of a reffable type,
# or which is a typing.List that includes a reffable type.
for model_class in model_classes:
fields = model_class.__fields__
fields = model_class.model_fields
class_reffable_fields = []
for fieldname, field in fields.items():
if fieldname == 'root':
Expand Down

0 comments on commit a21cdc2

Please sign in to comment.