Skip to content

Support lazy type references for Union members#1599

Open
TomasBayer wants to merge 1 commit intographql-python:masterfrom
TomasBayer:lazy-type-references-in-union-type
Open

Support lazy type references for Union members#1599
TomasBayer wants to merge 1 commit intographql-python:masterfrom
TomasBayer:lazy-type-references-in-union-type

Conversation

@TomasBayer
Copy link

@TomasBayer TomasBayer commented Feb 6, 2026

Fields, input fields, and arguments already support lazy type references via strings and lambdas to avoid circular imports. This PR adds the same support to member types of Unions. See this issue for details: #1600

Example:

  class SomeUnion(Union):
      class Meta:
          types = ("package.Type", lambda: AnotherType) 

This change is non-breaking.

This change allows union member types to be defined using string references
or functions, similar to how field, input field, or argument types can be
declared. The actual type classes will be resolved only during schema
construction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant