nearform / mercurius-apollo-registry

A Mercurius plugin for schema reporting to Apollo Studio
Other
11 stars 3 forks source link

Fetch schema from Apollo Registry #7

Open nigelhanlon opened 3 years ago

nigelhanlon commented 3 years ago

Currently, the plugin only allows you to upload a local schema to the Apollo registry. Since the registry acts as a central repository and source of truth for the GraphQL schema, it would also be good if the plugin could download and apply a schema to the running Mercurius instance.

Suggestions and Considerations

mcollina commented 3 years ago

I don't really understand what the benefit of this would be... I don't think we should replace the schema without replacing the code that handles it.

The only scenario I see this working is with federation: we could pull the schema and target URL for the services to mesh together.

simoneb commented 3 years ago

This is correct @mcollina. The whole idea behind having a registry is to use it in a Federated scenario. Otherwise, as you mention, if the service which publishes the schema is the same that consumes it, there's not much of a point, since the schema must be backed by a corresponding implementation. Therefore, the idea is that the services behind a Federated gateway each publish their schema to the registry, while the gateway reads the schema from the registry instead of building it at runtime from the underlying services.

This Netflix post explains this well and the picture below is clarifying. I'm sure you're familiar with this, I'm adding this for reference.

If your question is whether reading from the registry should be in this plugin or not, that's something we haven't discussed yet but we thought it would make sense to track as an issue.

image