I am very new to graphql and strawberry. I am developing graphql for my application and bumped into an issue which could not figure out.
So here is the sample code which returns RecursionError: maximum recursion depth exceeded in comparison
@strawberry.enum
class LogicalOperator(Enum):
AND = "and"
OR = "or"
@strawberry.input
class Condition(Generic[T]):
op: LogicalOperator = LogicalOperator.AND
fields: T | None = None
negate: bool = False
conditions: list["Condition[T]"] = strawberry.field(default_factory=list)
@strawberry.input
class InputFields:
a: str
b: int
@strawberry.type
class Data:
a: str
b: int
c: bool
@strawberry.type
class Query:
@strawberry.field
def data(self, filter: Condition[InoutFields]) -> list[Data]:
...
Can anyone help me figure out why I am getting this error while using Generic container while it works perfectly fine when I am not?
Following code works
@strawberry.input
class Condition():
op: LogicalOperator = LogicalOperator.AND
fields: InputFields | None = None
negate: bool = False
conditions: list["Condition"] = strawberry.field(default_factory=list)
I want to use Filter object for lot of different data objects. Without doing so I need to define Filter class for each such data objects
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too