Update and GraphQL filtering code to support new refactored code in latest strawberry-django library #9411

Closed
opened 2025-12-29 20:49:27 +01:00 by adam · 3 comments
Owner

Originally created by @arthanson on GitHub (Mar 29, 2024).

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.

Originally created by @arthanson on GitHub (Mar 29, 2024). ### 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.
adam added the type: housekeepingnetbox labels 2025-12-29 20:49:27 +01:00
adam closed this issue 2025-12-29 20:49:27 +01:00
Author
Owner

@github-actions[bot] commented on GitHub (Aug 21, 2024):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Aug 21, 2024): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. **Do not** attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@arthanson commented on GitHub (Sep 5, 2024):

blocked pending resolution of Strawberry AND, OR, NOT handling: #16024

@arthanson commented on GitHub (Sep 5, 2024): blocked pending resolution of Strawberry AND, OR, NOT handling: #16024
Author
Owner

@jeremystretch commented on GitHub (Mar 10, 2025):

Looks like this was resolved under #7598.

@jeremystretch commented on GitHub (Mar 10, 2025): Looks like this was resolved under #7598.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9411