netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
16.09k stars 2.58k forks source link

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

Open arthanson opened 7 months ago

arthanson commented 7 months ago

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.

github-actions[bot] commented 2 months ago

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.

arthanson commented 1 month ago

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