Skip to content

Commit

Permalink
Use the is_relation convenience property that schematools 6.1 provides
Browse files Browse the repository at this point in the history
  • Loading branch information
vdboor committed Oct 1, 2024
1 parent 550f95d commit 6af7590
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/dso_api/dynamic_api/filters/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def _get_filter_description(field: DatasetFieldSchema, lookup=None) -> str | dic

if field.is_geo:
return "GeoJSON | GEOMETRY(...)"
elif field.relation or field.nm_relation:
elif field.is_relation:
return "id"

prefix = OPENAPI_LOOKUP_PREFIX.get(lookup, "")
Expand Down
4 changes: 2 additions & 2 deletions src/dso_api/dynamic_api/filters/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def _translate_raw_value( # noqa: C901
def get_allowed_lookups(field_schema: DatasetFieldSchema) -> set[str]:
"""Find which field[lookup] values are possible, given the field type."""
try:
if field_schema.relation or field_schema.nm_relation or field_schema.is_primary:
if field_schema.is_relation or field_schema.is_primary:
# The 'string' type is needed for the deprecated ?temporalRelationId=.. filter.
field_type = "string" if field_schema.is_object else field_schema.type
return ALLOWED_IDENTIFIER_LOOKUPS | ALLOWED_SCALAR_LOOKUPS[field_type]
Expand Down Expand Up @@ -489,7 +489,7 @@ def _parse_filter_path(

if filter_part.reverse_field is not None:
parent = filter_part.reverse_field.related_table
elif field.relation or field.nm_relation:
elif field.is_relation:
parent = field.related_table
elif field.subfields:
# For sub-fields, treat this as a nested table
Expand Down

0 comments on commit 6af7590

Please sign in to comment.