Allow plugins to extend autotype decorator function #16091
Labels
complexity: medium
Requires a substantial but not unusual amount of effort to implement
status: under review
Further discussion is needed to determine this issue's scope and/or implementation
type: feature
Introduction of new functionality to the application
NetBox version
v4.0.1
Feature type
Change to existing functionality
Proposed functionality
Problem
NetBox 4.0 Plugin migration guide suggests using autotype_decorator to convert filtersets into strawberry filters. However, this decorator does not support a lot of existing filters (e.g.
ChoiceFilter
):This error also ruins all the work made by
autotype_decorator
for any other filters inside FilterSet. Hence, it would be very painful to handle it at the plugin side.Possible Solution
Just use Dependency Injection to inject
map_strawberry_type
insideautotype_decorator
:This would allow plugin developers to supply their own
map_strawberry_type_fn
for their own filters when usingautotype_decorator
.Use case
Plugin developers will be allowed to handle arbitrary filter types by themselves:
I can make a PR if you're okay with this change
Database changes
No response
External dependencies
No response
The text was updated successfully, but these errors were encountered: