RFC 3 / Accepted

OneOf inhabitability

Opened on
Merged on

At a glance

Project
GraphQL Spec
Identifier
#1211
Stage
RFC 3 / Accepted
Champion
@jbellenger
Updated
2026-11-26
Latest activity
Pull request merged on
Source

Pull request description

OneOf types can form graphs for which finite values cannot be created.

The simplest example of this is a self-recursing OneOf type:

input A @oneOf { a:A }

While this is the simplest form, OneOfs can also be combined with non-OneOf input object types to create other uninhabited types:

input A @oneOf { b:B }
input B { a:A! }

These kinds of types are considered valid on two fronts today:

  1. They are valid as OneOf types because all field types are nullable and there are no default values
  2. They are valid as a circular input object because there are no unbreakable chains of non-null non-list fields

While this follows the letter of the Circular References part of the spec, it violates the spirit of the spec in that there is no way to create a finite, legal value for these types. I propose that these topologies be declared invalid.

I took a stab at reworking the Circular References section to consider OneOfs and added a more formal specification framed around finite values.

Timeline

September 2026

  • Pull request merged on by leebyron
  • @leebyron committed "Update spec/Section 3 -- Type System.md" on
  • Discussed in GraphQL WG

    The September Secondary Working Group for the GraphQL specification met to review several agenda items and discuss updates to the specification. The group reviewed and approved three items for merge: one-off inhabitability, allow empty selection sets, and clarification of response position definitions. They also discussed error propagation rules, with Benjie proposing that sibling errors should not be added after propagation, which the group agreed to merge with minor editorial changes. The team reviewed the HTTP specification updates, including notes about new status code 294 for partial success, and decided to proceed with the spec cuts planned for the following Thursday. Rob presented updates on the defer stream specification, focusing on improvements to the visited fragments algorithm to prevent potential complexity explosions, which Benjie agreed to review for potential security issues.

    Zoom summary · GraphQL WG · 2026-09-17

    The GraphQL specification working group met to review several agenda items. Lee successfully merged the one-off inhabitability feature after making a minor factual correction about field nullability. The group then moved on to discuss the allow empty selection sets feature, which was previously approved to RFC 3 and had undergone final editorial changes including added examples and counterexamples.

    Zoom summary · GraphQL WG · 2026-09-17
  • @benjie committed "Editorial: be more explicit" on
  • Advanced to RFC 3 on by benjie
  • Discussed in GraphQL WG

    The GraphQL Primary Working Group held their September meeting to discuss specification updates and review ongoing proposals. The group first addressed the spec release timeline, with Benjie and Lee planning to work on cutting the September 2026 release over the next month, though they left open the possibility of delaying to November if needed. James provided an update on the one-of-inhabitability proposal, which has been merged into GraphQL JS and is now ready for RFC3 status. The working group then spent significant time discussing Mark's struct proposal, which aims to introduce polymorphic, structured types that can be used both as inputs and outputs. The discussion centered on whether to use input unions or one-of on outputs, with Michael strongly advocating against introducing a third polymorphism approach and suggesting using existing one-of functionality instead. The group debated various implementation details including type versioning, selection sets, and how structs would handle complex nested types like GeoJSON. While no final decisions were made, the working group agreed to use one-of on outputs as the simplest approach moving forward, with Mark planning to share a Cloudflare demo to illustrate the concept in practice.

    Zoom summary · GraphQL WG · 2026-09-03
    Next Steps

    Benjie: Review and tag the "inhabitability" pull request as RFC3, and perform a final editorial review before merging it into the September 2026 release.

    Zoom summary · GraphQL WG · 2026-09-03

    The GraphQL Primary Working Group meeting covered several key topics including spec releases, grants, and technical proposals. Benjie and Lee will work on cutting the GraphQL spec release in the coming weeks, aiming for a September tag, though there's discussion about potentially delaying to November if needed. The group approved RFC3 status for James's pull request regarding one-of-inhabitable types, which has been implemented in GraphQL JS. Mark presented a detailed proposal for "structs" in GraphQL, explaining how it could address issue 300 and enable more efficient handling of complex object types, though he acknowledged the explanation was complex and would provide more details in a future blog post. The meeting also included updates on grants, with 13K remaining in the 2026 budget, and Martin encouraged anyone interested in contributing to the ecosystem to submit proposals.

    Zoom summary · GraphQL WG · 2026-09-03

July 2026

  • Marked as Ready for Next Stage on by benjie
  • @benjie committed "Merge branch 'main' into jbellenger-oneof-inhabitability" on
  • Advanced to RFC 2 on by leebyron
  • Discussed in GraphQL WG

    The GraphQL Working Group held their July meeting to review multiple specification proposals and updates. The group discussed best practices for writing robust applications, with Martin presenting a new documentation page on handling schema changes that received approval for immediate merging. James updated the team on one-of-inhabitability specifications, which moved to Stage 2 pending final review, while Pascal provided an overview of OTel semantic conventions requiring TSC approval before merging. Benjie presented several proposals including sibling errors, empty selection sets, empty object types, interfaces with no fields, and unions with no members, with the group supporting these changes and moving them to RFC 2 status. The team also reviewed the GraphQL over HTTP specification, which was nearly ready for release with only minor editorial changes remaining. The conversation ended with plans to complete spec freeze preparations for the upcoming August meeting and September/October specification cut.

    Zoom summary · GraphQL WG · 2026-07-02

    The team discussed reordering agenda items, with Pascal requesting to move his item higher and Benjie suggesting to prioritize one-off items. Martin presented a proposal for adding guidance on writing robust applications to handle schema changes, particularly for new enum values and union types, which the team agreed to merge quickly and iterate on later. James then discussed a PR regarding one-of inhabitability in the GraphQL spec, explaining that it addresses issues with infinite values and recursive input types, with the implementation already in place in GraphQL JS.

    Zoom summary · GraphQL WG · 2026-07-02

    The team discussed whether to allow empty values in input types, with James and Leebyron agreeing that existing rules around input objects already handle null values sufficiently. They reviewed a specification that is ready to move from stage 2 to stage 3, with Benjie raising a minor concern about potential confusion regarding input object types but deciding to leave the text as-is. Pascal provided an update on OTEL, mentioning he addressed comments and implemented opinionated choices where decisions were needed, with the specification now ready for merge pending feedback from Apollo team members.

    Zoom summary · GraphQL WG · 2026-07-02

May 2026

  • 2 commits pushed on
  • 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

    James: Review and iterate on the GraphQLJS pull request for one-of inhabitability, ensuring error reporting follows existing patterns for cycles, addressing diagnostic issues raised, and investigating/fixing performance concerns.

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

    Yaacov: Set up a benchmark in a separate pull request to validate the performance of the one-of inhabitability changes in GraphQLJS.

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

    James: Add a note to the pull request thread about the potential performance issue for reviewers.

    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
    GraphQL Input Object Type Issue

    James explained an issue with one-of input object types in GraphQL, where the rules allow types to be defined but prevent creating valid values, similar to problems with recursive input objects. Yaacov outlined the process for merging the pull request into GraphQLJS, emphasizing the need for code review and approval before the spec change, particularly to include it in version V17. Benjie reviewed the test cases but noted the need for further code review, while Martin confirmed the pull request addresses the issue and suggested improving diagnostics as a secondary step.

    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

March 2026

  • Advanced to RFC 1 on by leebyron
  • Discussed in GraphQL WG

    The GraphQL specification working group meeting focused on several key topics including the upcoming Working Group Day on May 8th, the Issue Club initiative for reviewing and grooming GraphQL repository issues, and the GAPS (GraphQL Extension Proposal System) project for community specifications. The group discussed the implementation of one-of inhabitability validation rules and the ongoing work on the defer and stream specification changes. A significant portion of the meeting was dedicated to debating the numbering system for GAPS, with participants weighing the benefits of an incremental numbering approach versus a more structured categorization system, ultimately deciding to use pull request numbers for simplicity while maintaining clear delineation between RFCs and other issues.

    Zoom summary · GraphQL WG · 2026-03-05
    GraphQL One-of Input Fix

    James presented a pull request addressing an issue with one-of input objects in GraphQL, explaining the problem and demonstrating a solution through a small demo. The team agreed that the proposed fix was worth implementing, moving it to RFC1 status. James expressed satisfaction with the current approach, which maintains the one-of type's non-null requirement for fields while allowing for a more flexible implementation. The group decided to implement the fix in both GraphQLJS and Apollo Kotlin, with Lee suggesting that once multiple implementations are complete, the solution would likely be promoted to RFC2.

    Zoom summary · GraphQL WG · 2026-03-05
  • @jbellenger committed "feedback" on

February 2026