strawberry codegen --schema schema.graphql
generates models referencing postponed types as its class variable instead of using a string to be deferred.
From schema, the following code has been generated. In this example, AccessCredentialFilter is referencing itself inside the model
@strawberry.input
class AccessCredentialFilter:
and_: list[AccessCredentialFilter | None] | None = strawberry.field(name="and")
However, it should rather be
@strawberry.input
class AccessCredentialFilter:
and_: list[Union["AccessCredentialFilter", None]] | None = strawberry.field(name="and")
or
@strawberry.input
class AccessCredentialFilter:
and_: list[Optional["AccessCredentialFilter"]] | None = strawberry.field(name="and")
It seems there was a related discussion: #769
but not sure if it was discussed in the context of codegen.
I'd be happy to contribute if I can be directed to the right part of the code.
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