Closed
Description
Deployment Type
Self-hosted
NetBox Version
v4.0.0
Python Version
3.8
Steps to Reproduce
Found while updating the GraphQL docs for Strawberry. When the sub-field is defined as a function the filtering logic is not applied to it and therefore filtering logic won't work. For example the following query with sub-filter doesn't work:
{
device_list {
id
name
interfaces(filters: {enabled: {exact: true}}) {
name
}
}
}
This is because it is defined as a function:
@strawberry_django.field
def interfaces(self) -> List[Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')]]:
return self.interfaces.all()
If it is defined as a line type the filtering does work, but this will not work for fields that have to be defined as functions because the accessor is different:
interfaces: List[Annotated["InterfaceType", strawberry.lazy('dcim.graphql.types')]]
Adding the filters directly to the decorator does not work either:
@strawberry_django.field(filters=InterfaceFilter)
Expected Behavior
Filtering should work on all sub-objects
Observed Behavior
Filtering does not work on sub sub-objects.