-
Notifications
You must be signed in to change notification settings - Fork 9
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
Better terms for supergraph, subgraph and public API needed. #11
Comments
How about "source schemas" for the schemas that are combined together (i.e. "SubSchema"), "composition schema" or "internal composed schema" for the schema that details how everything composes (the "SuperSchema"), and "final schema" or "resulting schema" or "exposed schema" or "external composed schema" for the schema that consumers of the API would see? We should avoid the term "public" IMO. |
I like |
As we discussed in the last meeting, I think we should reopen this issue. In my mind, the term source schema is too generic and not descriptive enough for our purposes. What we've tried to convey with the term subgraph schema at Apollo is that these schemas are designed as part of a larger graph (which is also why we call out 'composable' as a design principle). In our experience, the notion of subgraphs composing into a supergraph makes intuitive sense to people and helps clarify the architecture. I see how the term graph doesn't occur explicitly in the GraphQL specification, but it's called GraphQL for a reason :) A schema does describe a data graph, and I don't think we should shy away from using that term. Composition isn't just a syntactic process that refers to combining schema documents, but a way of building a larger graph out of component parts. |
Disclaimer/context: I work extensively with GraphQL practitioners in Hasura’s community/user base (and also speak to a lot of GraphQL users who don’t use Hasura). A lot of the users in the GraphQL ecosystem will be in agreement with @martijnwalraven on this - the terms subgraph and supergraph are very well and implicitly understood by developers (without any vendor-specific connotations). I believe these terms are very helpful when talking about development, ownership, CI/CD, governance, etc. of the “entities”/schemas being composed into a single unified graph. I would like to propose that that we stick to subgraph and supergraph as the choice of terms. PS: Still reading up on public API or PublicSchema, and will shortly get back on that as well. |
Thank you for sharing your thoughts on these topics @martijnwalraven and @dsandip; your wealth of experience with these terms is very valuable. I think it's worth noting that the colloquial term for something and the strictly specified term do not have to match, but the specified terms must be very well defined and unambiguous.
The GraphQL specification itself only uses the standalone term "graph" twice:
and
The latter of which is referring to graph in the mathematical sense, and the former is talking about your business entities, not the actual GraphQL schema itself. As Martijn said: "A schema does describe a data graph", or more specifically a schema provides an API to describe, traverse, access data from and mutate a data graph. In GraphQL terms, I'd argue that a "single unified graph" would refer not to the schema, but to the business entities that the schema may represent - the data graph. A schema you build to access this data graph might be referred to as a "single unified schema". Expanding on this, the term "subgraph" and "supergraph" would appear to refer again to the business entities - the data graph; whereas terms like "subschema" and "superschema" would refer to the schemas themselves. Then we have the issue that "subschema" sounds like it's "less than" a schema, and "superschema" sounds like it's "more than" a schema. The terms are also confusing when you think about subclasses and superclasses - a subclass inherits from a superclass, but in GraphQL a superschema inherits from a subschema? Of course the real analogy is to set theory: the subschemas are a subset of the superschema, and the superschema is a union of all the subschemas. Even then the "superschema" doesn't add things that weren't present in the subschemas, so is it truly a superset? 🤔 What we're talking about really are a number of smaller GraphQL schemas that are composed together to form one larger GraphQL schema that represents them all. This composite schema then sources data from these smaller schemas to honour requests.
This is indeed valid criticism, I can definitely imagine that the term "source schema" could be used in a lot of contexts (e.g. proxying, schema stitching, client usage, etc), we could make it more specific by prefixing with the use case: "composition source schema", or come up with a better term. I'm not aware of the term in popular usage in other scenarios though? TL;DR: My primary concern is that the term "graph" in specification terms refers to the underlying data graph, not the schemas that you might build to enable access to this data graph. When we refer to schemas in the specification, we should call them "schemas". |
That's a fair distinction. We use the terms subgraph schemas and supergraph schemas when explicitly referring to the GraphQL schemas instead of the data graphs themselves. That also avoids terms like subschema and superschema, which as you point out are misleading because it doesn't really make sense to think of these as 'less than' or 'more than' a schema. They are both complete schemas that describe particular graphs, but subgraph and supergraph refer to their roles within a federated architecture. |
Great points @benjie @martijnwalraven! I think |
I think the terms However we can still refer to those components like eg
|
(I think the term "server" should be avoided, "service" is preferable as in the GraphQL spec. My feeling is we don't need to get into transport mechanics in this spec.) |
That makes sense. Using |
We did a brainstorm on the meeting on Feb 15 and came up with some more terms
|
Some ideas / takes:
|
The term graph is not really used in the graphql core spec. When we talk about the composition in the boundaries of the spec we are using schema documents to compose from it a annotated single schema. I discussed this a bit with @benjie and we both feel that supergraph, subgraph and public API are not good terms.
"SubSchema" => a partial part of the "Superschema"
"SuperSchema" => annotated schema aka executor config
"PublicSchema" => the schema we expose to the enduser
These are also not good terms and we need to reflect a bit on better terms.
The text was updated successfully, but these errors were encountered: