Skip to content

OneOf Inhabitability#4248

Open
jbellenger wants to merge 1 commit intographql-java:masterfrom
jbellenger:jbellenger-oneof-inhabitability
Open

OneOf Inhabitability#4248
jbellenger wants to merge 1 commit intographql-java:masterfrom
jbellenger:jbellenger-oneof-inhabitability

Conversation

@jbellenger
Copy link
Contributor

@jbellenger jbellenger commented Feb 17, 2026

This PR implements the validation described at graphql/graphql-spec#1211

More discussion is at the link above, but the core issue is around uninhabited OneOf types -- the property that a type can be defined in a way that a value cannot be generated for it.

The simplest example of an uninhabited type is this recursive OneOf:

input A @oneOf { a:A }

While this type definition is currently valid by the rules of OneOf types and circular input types, it violates the spirit of the Circular References because it does not allow construction of a finite value. This uninhabitation property applies to any closed subgraph of OneOf types.

This PR adds a new validator for OneOf inhabitation. I've tried to follow the existing conventions, but any feedback on style or substance is welcome.

Copy link
Member

@bbakerman bbakerman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this

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.

2 participants

Comments