-
Notifications
You must be signed in to change notification settings - Fork 228
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
Add 'implementation' to the Glossary #1593
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following on from this thread in the GraphQL discord #wg channel...
🤔 Does an implementation have to be used to build a service? graphql-js
implements the parsing section of the GraphQL spec, and that can be used for building developer tooling, without ever being used to build a GraphQL service. I don't think this feels quite right yet...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this captures the intent more precisely?
Co-authored-by: Benjie <[email protected]>
Co-authored-by: Benjie <[email protected]>
I'm a slow writer but I wanted to say this: I simplified and left "optional features" out on purpose for now cause I'm still not 100% clear about it.
I'd love the spec to be more detailed about what an implementation is and what "support the type system definition language" means in this context. Is this for schema-first libraries? If yes, what should code-first libraries do? Or is this something else? What does "provide" mean? Expose them in introspection? Allow validation of the incoming SDL? Or maybe both? |
I'd say an implementation is anything that implements the GraphQL spec: a service, some tooling, etc
Yes, but for all other SDL-writing use cases; client-side schema extensions; tools that take introspection data and represent it as SDL (e.g. so it can be used by tooling such as graphql-schema-generator); services that allow extensions via SDL even if the original service is not SDL-first; etc.
In GraphQL.js you'd do
It means make it so that the directive can be used; e.g. for this document to be valid: scalar MyScalar @specifiedBy(url: "...") the implementation must provide the |
If we go back to the beginning - why is a distinction necessary? How does it change interpretation or conformance rules of the spec? |
Wondering about this too. If we're saying "service" == "implementation" everything would be much simpler. The spec has language specific to implementations though:
That doesn't make any sense to someone that just wants to have a conforming server. IMO the spec adresses 2 use different cases: Service function executeRequest(request: GraphQLRequest): GraphQLResponse { ... } Implementation function buildSchema(sdl: String, resolvers: Resolvers) GraphQLSchema { ... }
// potentially more (parseAst, validateOperation, etc...) A The important thing is that we don't want service to have to conform to all the "implementation" language. At least this is my current understanding of it but it's way different from what it was yesterday so it might still change 😅 ... |
Is this intentional though, or has it simply been used as the spec evolved without a common language? |
An implementation is something that implements the GraphQL spec. An implementation does not have to be able to execute requests - for example it might be limited to parsing the document syntax and constructing a schema from it, which it can then use for codegen, or docgen, or linting, or for validating your persisted documents, or some other purpose. A service does have to be able to execute requests, as written in the spec:
So "service" describes an implementation that can execute GraphQL requests. "Implementation" is a broader term, all services are implementations (or contain/wrap implementations and thus, from the point of view of someone issuing a GraphQL request, have the same perceived result and thus are implementations), but not all implementations are (or even can be) services.
I'm not sure this is the most intuitive or unambiguous way of putting it. The set of "all services" is indeed a subset of the broader set of "all implementations" - it is the subset that requires the ability to execute requests. That said, when looking at individuals, an implementation may support fewer (or different) GraphQL features than a service, so it's not true to say that an implementation must support everything that a service must support (an alternative interpretation of the quoted phrase).
What language in the GraphQL spec do we want a service to not have to conform to? Please pay close attention to RFC2119 when coming up with examples, quite a lot of the GraphQL specification is written in a way where if the use case is not relevant to your implementation, you don't need to implement it - for example, if you're not writing a GraphQL service then you don't need to be able to execute a GraphQL request. |
**Definition**: anything capable of executing a GraphQL request and returning | ||
a GraphQL response conforming to the specification. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the definition in the spec is quite clear, let's use that?
**Definition**: anything capable of executing a GraphQL request and returning | |
a GraphQL response conforming to the specification. | |
**Definition**: A GraphQL service generates a [response](https://spec.graphql.org/draft/#sec-Response) from a [request](https://spec.graphql.org/draft/#request) via [execution](https://spec.graphql.org/draft/#sec-Execution). |
No description provided.