Skip to content

Support lazy type references for Connection.Meta.node - #1610

Closed
Pyhroff wants to merge 1 commit into
graphql-python:masterfrom
Pyhroff:feat/lazy-connection-node
Closed

Pyhroff wants to merge 1 commit into
graphql-python:masterfrom
Pyhroff:feat/lazy-connection-node

Conversation

@Pyhroff

@Pyhroff Pyhroff commented Oct 24, 2026

Copy link
Copy Markdown

Part of #1600 (alongside #1599).

Summary

Fields, input fields, arguments, and Union (#1599) support lazy type references via dotted import strings or callables (lambda) to avoid circular imports across modules. However,
elay.Connection.Meta.node previously raised TypeError: issubclass() arg 1 must be a class when given a string or callable.

Changes

  • Convert ConnectionOptions.node into a property backed by _node that resolves lazy references via get_type(self._node).
  • Relax the Connection.init_subclass_with_meta node assertion to accept str and callables (inspect.isfunction / unctools.partial) in addition to concrete Graphene types and NonNull.
  • Safely derive �ase_name when Connection is subclassed without a custom
    ame and
    ode is a string or callable.
  • Add unit tests in graphene/relay/tests/test_connection.py covering string and lambda Meta.node definitions.

@Pyhroff Pyhroff closed this by deleting the head repository Nov 17, 2026
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