-
-
Notifications
You must be signed in to change notification settings - Fork 144
Open
Labels
bugSomething isn't workingSomething isn't working
Description
How can we make a "custom filter method/field" as a required/mandatory field?
Describe the Bug
Consider that I have this filter class
@strawberry_django.filter(PayoutExecution, lookups=True)
class AnyFilter:
status: BaseFilterLookup[PayoutExecutionStatus] # Mandatory
@strawberry_django.filter_field()
def custom_field(
self,
info: Info,
value: BaseFilterLookup[PayoutExecutionStatus],
prefix: str,
queryset: QuerySet,
):
return Q(field_1=True)
For this AnyFilter
type, the generated schema looks like this
# schema.graphql
input AnyFilter {
status: PayoutExecutionStatusBaseFilterLookup!
AND: AnyFilter
OR: AnyFilter
NOT: AnyFilter
DISTINCT: Boolean
customField: PayoutExecutionStatusBaseFilterLookup
}
As we can see, the customField
is not required/mandatory - how can we fix that?
System Information
- Operating system: Linux
- Python version: Python 3.11.5
- Strawberry version (if applicable): strawberry-graphql-django==0.52.1
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working