You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I compose a supergraph with rover supergraph compose I get the GraphQL schema that includes all the Federation directives and internals. This schema is what is passed to Router to run the gateway, however clients will see a slimmed down version of this schema when running introspection that we call the "API Schema". This API Schema and the Supergraph Schema are actually different types of documents and might have slightly different fields and information (see fields marked with @inaccessible).
As a client developer I SHOULD be using the API schema to do my type generation, rather than the supergraph schema. If I want to get this API schema today I can:
I have to compose and pass a supergraph to a router and do introspection . You could automate this a bit with rover dev but it is not ideal
The text was updated successfully, but these errors were encountered:
smyrick
added
feature 🎉
new commands, flags, functionality, and improved error messages
triage
issues and PRs that need to be triaged
labels
Dec 4, 2024
@LongLiveCHIEF I guess it could output both or maybe there is even a separate command that takes the Supergraph Schema as input and gives you the API schema, but as a client developer today I want some automated way to get the API schema so I can use that to generate my types. If you use the supergraph schema today it technically can work as you don't need to worry about most supergraph metadata directive, however there are some features like @inaccessible that might be showing extra stuff that is not visible in the API schema compared to the Supergraph and that might also change in the future too
Command to pass in supergraph as input
rover supergraph api --supergraph-schema prod-schema.graphql --out prod-api-schema.graphql
Description
When I compose a supergraph with
rover supergraph compose
I get the GraphQL schema that includes all the Federation directives and internals. This schema is what is passed to Router to run the gateway, however clients will see a slimmed down version of this schema when running introspection that we call the "API Schema". This API Schema and the Supergraph Schema are actually different types of documents and might have slightly different fields and information (see fields marked with@inaccessible
).As a client developer I SHOULD be using the API schema to do my type generation, rather than the supergraph schema. If I want to get this API schema today I can:
rover dev
but it is not idealInstead a rover command to run locally would be nice:
# New command or flag rover supergraph apiSchema --supergraph-schema prod-schema.graphql
Notes
The function to do this lives in a couple places
The text was updated successfully, but these errors were encountered: