apollo-ios-dev
apollo-ios-dev copied to clipboard
Add isOneOf to inspection query in ApolloSchemaDownloader
In https://github.com/apollographql/apollo-ios-dev/pull/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 🙏
@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/
Deploy request for apollo-ios-docc pending review.
Visit the deploys page to approve it
| Name | Link |
|---|---|
| Latest commit | cdfd9ab05e18d9633af099ac1af5b5131e26a095 |
✅ 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
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?
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.
@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!
How could I test this? I'm having a bit trouble understanding how everything works in the project, so any advice would be helpful!
I don't think there are any specific tests required for this - as it is right now. This is because the response is fed into our graphql-js frontend which will validate everything and convert it into SDL. There might be additional tests required for the logic we've identified in the above comments.
I've moved the base branch for this to v1 as we prepare for the 2.0 release of Apollo iOS; future 1.x releases will be from the v1 branch. If this work is also suitable for 2.0 we can prepare a separate PR for that once the future of this work is decided.
Also changing the status to Draft until the path forward is clearer.