RFC X / Rejected

Prohibit root mutation and subscription types from implementing interfaces

Opened on
Closed on

At a glance

Project
GraphQL Spec
Identifier
#1225
Stage
RFC X / Rejected
Champion
@robrichard
Updated
2026-11-26
Latest activity
Marked as Rejected on
Source

Pull request description

I ran into this issue working on validation rules for @defer and @stream: We would like to prevent @defer and @stream from being used on root level mutation or subscription fields, since these fields have special meaning.

One approach for a validation rule for this would be to do an algorithm like CollectFields to gather all the root level fields by traversing through fragment spreads. This is what's currently done in the (Subscription Operation Definitions - Single Root Field)[https://spec.graphql.org/September2025/#sec-Single-Root-Field] rule.

An easier approach is to just check the parent type and see if that type is the root subscription or mutation field, which is what I opted for.

That validation rule looks something like this:

- Let {mutationType} be the root Mutation type in {schema}.
- Let {subscriptionType} be the root Subscription type in {schema}.
- If {directiveName} is "defer" or "stream":
  - The parent type of {directive} must not be {mutationType} or
    {subscriptionType}.

But this could be bypassed if these root fields implement an interface. Example:

schema {
  query: Query
  mutation: MutationRoot
}

type Query {
  field: String
}

interface SomeInterface {
  test: String
}

type MutationRoot implements SomeInterface {
  test: String
}
mutation {
  ...mutationFragment
}
fragment mutationFragment on SomeInterface {
  ... @defer(label: "bad") {
    test
  }
}

This is a breaking change, but i'd like to see if there are any use cases for this or if we think it's used by the community. If not this could simplify defer/stream and possibly future validation rules, otherwise I can switch to the collectFields approach.

Further question - should we also expand this validation to union types? It's not required for this validation use case but might also be nice to have.

GraphQL-JS PR: https://github.com/graphql/graphql-js/pull/4669

Timeline

November 2026

June 2026

May 2026

  • Advanced to RFC 0 on by benjie
  • Top comment edited on by robrichard
  • Discussed in GraphQL WG

    The May edition of the GraphQL Specification Working Group meeting covered several key topics including one-of-inhabitability, prohibiting root mutation and subscription types from implementing interfaces, and the potential transfer of projects like GraphQL PHP into the GraphQL organization. The group discussed the GraphQL over HTTP specification, with Martin presenting a proposal to move legacy protocol details to an appendix while maintaining compatibility. Benoit provided an update on the Directives on Directives proposal, which has been implemented in GraphQLJS and is ready for RFC3. Pascal raised questions about schema namespaces and their potential benefits for LLM interactions and schema composition. Mark introduced GAPS (GraphQLEcology Additional Specifications), a new home for community-written specifications that don't fit within the main GraphQL specification, and discussed the governance model and workflow for submitting and managing GAPS proposals.

    Zoom summary · GraphQL WG · 2026-05-07
    Next Steps

    Rob: Update the validation rules for defer/stream to use the more thorough validation approach (walking through fragment spreads) and leave a summary comment on the relevant issue/PR.

    Zoom summary · GraphQL WG · 2026-05-07

    The GraphQL Specification Working Group meeting began with introductions and a review of the agenda, which included topics such as one-off inhabitability, prohibiting root mutation and subscription types from implementing interfaces, transferring projects like GraphQL PHP into the GraphQL organization, project adoption guidelines, GraphQL over HTTP specification, and Directives on Directives proposal. Pascal announced that the OpenTelemetry Semantic Conventions pull request he posted is ready for review and approval. The group agreed to create an issue in the main workgroup repository to discuss the pull request further and potentially merge it into the semantic conventions report. The meeting also touched on the availability of grants for key initiatives and the importance of submitting grant applications when needed.

    Zoom summary · GraphQL WG · 2026-05-07

    The team discussed schema validation for cyclic errors, where Benjie explained that multiple errors per location are acceptable when validation rules depend on each other's assumptions. James agreed to follow up on ensuring the new approach fits existing patterns for cyclic input validation. The team also identified performance concerns with the current implementation, with Yaacov offering to set up a benchmark to address this issue. Finally, Rob presented work on prohibiting defer and stream directives on root mutation and subscription fields, highlighting a potential bypass issue through interface implementation that needs further consideration.

    Zoom summary · GraphQL WG · 2026-05-07
    Interface Prevention on Root Mutations

    The team discussed a proposal to prevent interfaces on root mutation and subscription types, with NYC explaining that allowing query types anywhere in the graph serves important use cases for nested querying and subgraph composition. Benjie clarified that this proposal specifically targets mutation and subscription root types, as it doesn't make sense to embed them in queries, and the team hasn't encountered many use cases for interfaces on mutation or subscription root types. The discussion touched on potential implications for nested mutation fields and namespaces, though the team agreed this approach might not be suitable for all use cases like namespaces.

    Zoom summary · GraphQL WG · 2026-05-07

    The team discussed implementing fields merge rules for GraphQL mutations and subscriptions. They decided to move forward with a more thorough validation approach rather than implementing the proposed restrictions on interfaces. The group agreed to leave the discussion open for further consideration but will proceed with the updated validation rules for stream and defer functionality. Martin then addressed a governance decision regarding the transfer of the GraphQL PHP project to the GraphQL organization, ultimately recommending to decline the proposal to maintain diversity in implementations and prevent the appearance of favoring one implementation over others.

    Zoom summary · GraphQL WG · 2026-05-07

April 2026