netbox
netbox copied to clipboard
Update and GraphQL filtering code to support new refactored code in latest strawberry-django library
Proposed Changes
Strawberry PR https://github.com/strawberry-graphql/strawberry-django/pull/478 overhauled the filtering code and it causes major breakages with our autotype decorator, specifically these two in their release notes:
Custom filters can be defined using a method with the @strawberry_django.filter_field decorator: https://strawberry-graphql.github.io/strawberry-django/guide/filters/#custom-filter-methods The default filter method can be overriden also by using a @strawberry_django.filter_field decorator: https://strawberry-graphql.github.io/strawberry-django/guide/filters/#overriding-the-default-filter-method
However it also seems to potentially have some bugs as for example on site_list if you add a filter for asn it excepts it in the GraphiQL browser editor, but in the output pane it says it's not a valid param and instead lists the params for the model type (not the filter) which is incorrect. Will have to investigate further post-beta.
Justification
Need to make the changes in our code to work with the latest strawberry and allow for future upgrades.