Skip to content

Add isOneOf to inspection query in ApolloSchemaDownloader #705

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

glenngijsberts
Copy link

In #537 the @oneOf directive was introduced. However, I noticed that the directive was not included in my schema when I did an introspection, and so the additional types were not generated.

I had a look at the source code, and noticed that the isOneOf was missing from the inspection query done in ApolloSchemaDownloader. I've added it, but I wasn't really able to test this, so I was hoping if somebody can point me in the right direction or help me out with this 🙏

@apollo-cla
Copy link

@glenngijsberts: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

Copy link

netlify bot commented Jul 10, 2025

👷 Deploy request for apollo-ios-docc pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit cdfd9ab

@apollo-librarian
Copy link

apollo-librarian bot commented Jul 10, 2025

✅ Docs preview ready

The preview is ready to be viewed. View the preview

File Changes

0 new, 7 changed, 0 removed
* (developer-tools)/apollo-mcp-server/(latest)/command-reference.mdx
* (developer-tools)/apollo-mcp-server/(latest)/quickstart.mdx
* (developer-tools)/apollo-mcp-server/(latest)/guides/index.mdx
* graphos/routing/(latest)/operations/subscriptions/configuration.mdx
* graphos/routing/(latest)/performance/caching/entity.mdx
* graphos/routing/v1/customization/native-plugins.mdx
* graphos/routing/v1/graphos-reporting.mdx

Build ID: 08d1b63c67a14a0de34272a3

URL: https://www.apollographql.com/docs/deploy-preview/08d1b63c67a14a0de34272a3

@calvincestari
Copy link
Member

Thanks for the PR @glenngijsberts - this seems correct but I'm not sure we can merge it yet since the OneOf spec change PR has not been merged yet.

@martinbonnin / @BoD - is this why isOneOf is commented out in the Kotlin introspection query?

@BoD
Copy link

BoD commented Jul 11, 2025

Indeed, selecting isOneOf on __Type will result in an error on servers that don't support it yet - breaking introspection.

To work around this, we implemented "2 step introspection":

  • the 1st step is a "pre-introspection" query to gather the capabilities of the server
  • 2nd step is the actual introspection query, based on info from the 1st step. What we do in Apollo Kotlin is that we use this base query with certain fields commented, that we programmatically rework (add more fields and such) depending on what is supported.

This can be seen here and here

Copy link
Member

@calvincestari calvincestari left a comment

Choose a reason for hiding this comment

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

@glenngijsberts - we can see from @BoD's reply that there needs to be more thought put into this change. We cannot break schema downloads for servers out there today so we'll need something like the 2-stage approach that Kotlin has in place.

@glenngijsberts
Copy link
Author

glenngijsberts commented Jul 12, 2025

@calvincestari @BoD makes sense 👍 I'm gonna have another look at this upcoming week, to see if it's possible to do something similar.

How could I test this? I'm having a bit trouble understanding how everything works in the project, so any advice would be helpful!

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.

4 participants