Skip to content

DSL code not working with graphql-core 3.3.0a12 #588

Closed

Description

@leszekhanusz

The gql pre-release version is not working with the latest graphql-core version (3.3.0a12), the DSL code is not working anymore, which also means that any code fetching the schema from the backend will not work since we are now using the DSL code to generate the introspection query.

tests are failing with:

ERROR tests/starwars/test_dsl.py - TypeError: InlineFragmentNode.__init__() missing 1 required keyword-only argument: 'selection_set'

mypy errors showing the problems:

gql/utilities/parse_result.py:127: error: Property "name" defined in "OperationDefinitionNode" is read-only  [misc]
gql/utilities/parse_result.py:241: error: Argument "selections" to "SelectionSetNode" has incompatible type "list[FieldNode]"; expected "tuple[SelectionNode, ...]"  [arg-type]
gql/dsl.py:436: error: Argument "value" to "ArgumentNode" has incompatible type "ValueNode | None"; expected "ValueNode"  [arg-type]
gql/dsl.py:599: error: Property "alias" defined in "FieldNode" is read-only  [misc]
gql/dsl.py:670: error: Property "selections" defined in "SelectionSetNode" is read-only  [misc]
gql/dsl.py:802: error: Argument 4 to "OperationDefinitionNode" has incompatible type "**dict[str, NameNode]"; expected "Location | None"  [arg-type]
gql/dsl.py:860: error: Argument "type" to "NonNullTypeNode" has incompatible type "TypeNode"; expected "NamedTypeNode | ListTypeNode"  [arg-type]
gql/dsl.py:927: error: Argument "type" to "VariableDefinitionNode" has incompatible type "TypeNode | None"; expected "TypeNode"  [arg-type]
gql/dsl.py:934: error: Argument "directives" to "VariableDefinitionNode" has incompatible type "tuple[DirectiveNode, ...]"; expected "tuple[ConstDirectiveNode, ...]"  [arg-type]
gql/dsl.py:1144: error: Property "arguments" defined in "FieldNode" is read-only  [misc]
gql/dsl.py:1147: error: Argument "value" to "ArgumentNode" has incompatible type "ValueNode | None"; expected "ValueNode"  [arg-type]
gql/dsl.py:1178: error: Property "selection_set" defined in "FieldNode" is read-only  [misc]
gql/dsl.py:1185: error: Property "directives" defined in "FieldNode" is read-only  [misc]
gql/dsl.py:1257: error: Missing named argument "selection_set" for "InlineFragmentNode"  [call-arg]
gql/dsl.py:1269: error: Property "selection_set" defined in "InlineFragmentNode" is read-only  [misc]
gql/dsl.py:1277: error: Property "type_condition" defined in "InlineFragmentNode" is read-only  [misc]
gql/dsl.py:1288: error: Property "directives" defined in "InlineFragmentNode" is read-only  [misc]
gql/dsl.py:1341: error: Property "directives" defined in "FragmentSpreadNode" is read-only  [misc]
gql/dsl.py:1385: error: Property "value" defined in "NameNode" is read-only  [misc]
gql/dsl.py:1455: error: Argument 3 to "FragmentDefinitionNode" has incompatible type "**dict[str, tuple[VariableDefinitionNode, ...]]"; expected "Location | None"  [arg-type]
gql/dsl.py:1519: error: Argument "definitions" to "DocumentNode" has incompatible type "list[Any]"; expected "tuple[DefinitionNode, ...]"  [arg-type]

Workaround: pin graphql-core to 3.3.0a11

Activity

  1. added
    type: bug
    status: needs investigation
    on Mar 30, 2026
  2. Cito commented on Mar 31, 2026

    @Cito
    Member

    The AST module hast been optimized in this version to improve performance. This is intentional and the read-only types are in line with the typing in GraphQL.js upstream. Can you adapt in GQL?

    Note that GraphQL-core 3.3 is still an alpha release, and AST is a low-level API. Breaking changes are rare, but can happen.

  3. leszekhanusz commented on Mar 31, 2026

    @leszekhanusz
    CollaboratorAuthor

    Can you adapt in GQL?

    That won't be easy, the whole point of the DSL code in GQL is to progressively modify the AST programmatically. I suppose we'll have to save the whole structure in the classes in GQL and only create the graphql-core classes at the end.

  4. Cito commented on Mar 31, 2026

    @Cito
    Member

    That would be probably the best. The AST nodes are supposed to be immutable.

  5. removed
    status: needs investigation
    on Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions