-
-
Notifications
You must be signed in to change notification settings - Fork 612
Open
Labels
bugSomething isn't workingSomething isn't working
Description
strawberry codegen --schema schema.graphql generates models referencing postponed types as its class variable instead of using a string to be deferred.
Describe the Bug
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")System Information
- Operating system: Ubuntu 22.04
- Strawberry version (if applicable): 0.248.1
Additional Context
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working