Skip to content

Add oneOf blog post #2011

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 9 commits into
base: source
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/pages/blog/2025-06-19-multioption-inputs-with-oneof/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,42 @@ input GalleryInput {
including Ruby, Java, JavaScript and .NET already ship `@oneOf` as a stable
feature

You might wonder why this is expressed as a directive in SDL rather than
explicitly having a new type keyword; Brad Baker, contributor to GraphQL-Java,
summed it up in [this comment back in
2023](https://github.com/graphql/graphql-spec/pull/825#issuecomment-1659900665):

> use of the directive means that:
>
> - it's minimally invasive in terms of SDL tooling that might be out there,
> - it's minimally invasive in terms of Introspection,
> - it's minimally invasive in terms of engine implementation, it proved quite easy to implement in graphql-java.
>
> Great stuff!

Since then there have been a number of reports of success:

> I'm very happy with where this landed. We'd use it internally at my company. -- [Ethan Resnick](https://github.com/graphql/graphql-spec/pull/825#issuecomment-2128262620)

> More positive feedback: We are using it at HubSpot through the graphql-java implementation and look forward to it becoming standardized. -- [Henry Q. Dineen](https://github.com/graphql/graphql-spec/pull/825#issuecomment-2128324080)

> I implemented support for OneOf input objects for the Caliban GraphQL library (Scala) [...] it's been fairly straightforward implementing support for it and I couldn't really identify any areas that could have been improved. -- [kyri-petrou](https://github.com/kyri-petrou)

> We have been eagerly waiting at Jobber for this to land as well. [...] We have many use cases internally for it and we're very excited to see this land! -- [Clinton Pahl](https://github.com/graphql/graphql-spec/pull/825#issuecomment-2135724148)

> Colleagues at work (Atlassian) have been really happy with @oneOf, works exactly as you want it to and I haven't heard any negative feedback. -- [Donna Zhou](https://github.com/dondonz)

## Availability

`@oneOf` is already available in the following implementations of GraphQL:

- GraphQL.js v16+
- GraphQL Ruby v2.0.21+
- GraphQL.NET v8+
- GraphQL Java v21.2+
- HotChocolate v16.0.0+
- Probably others!
Copy link
Member Author

Choose a reason for hiding this comment

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

@graphql/implementers If you already support @oneOf, please let me know!

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

We just added support to https://github.com/webonyx/graphql-php.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @patrick91 and @spawnia; fancy adding suggestions in the style of the others (i.e. with version numbers)? For GraphQL Core, do GraphQL Core (python) or similar to make it clear to readers.

Copy link
Member

Choose a reason for hiding this comment

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

So does Yoga and Hive Gateway!

Copy link
Member Author

@benjie benjie Jul 11, 2025

Choose a reason for hiding this comment

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

Thanks @enisdenjo! I'm currently only listing GraphQL implementations otherwise the list would get too long! Most things that consumes one of these implementations should support @oneOf by extension.


## The bottom line

`@oneOf` allows for more expressive, capable, and less overwhelming schemas,
Expand Down
Loading