-
Notifications
You must be signed in to change notification settings - Fork 55
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
Allow @boundary enum, @boundary scalar, and @boundary input #10
Comments
For things like It also needs the ability to be defined in multiple services so will need |
Yeah I think reusing |
Yeah having the same directive is a good idea I think, since the semantics are essentially the same. There's two things here, we want to be able to have In the In the Same with It might be safer to have one service that defines the common types we use, mark these with a |
I would only allow |
I was confused here for a sec, I thought you meant the GraphQL union, not the set union :) I think we should take the more conservative approach of only allowing |
I don't think this is necessary. I think it's fine (and even preferable) for each service schema to be defined independently. Checking that a service's schema is mergeable in the graph should be done during CI. |
My reasoning is there is already quite a bit of boilerplate that needs to be included in each service to join the gateway. eg. directive @boundary on OBJECT
directive @namespace on OBJECT
interface Node {
id: ID!
}
type Service {
name: String! # unique name for the service
version: String! # any string
schema: String! # the full schema for the service
}
type Query {
service: Service!
node(id: ID!): Node
} The locations which we have to update this if we start adding/changing things will start growing, it may even make it difficult to roll out an addition. Eg: |
@pkqk I totally get your point that rolling out changes to |
Summary from IRL discussion: We decided for our use case we could handle the downtime of removing some services from the gateway and rolling out schema updates in a co-ordinated way. We might later want to be able to do this in a highly available way, one idea we thought of was to have a way to tell bramble a schema change was acceptable and any new services joining with the change would be accepted. |
FWIW, I wrote these sorts of validations for the Node GraphQL Tools schema stitching package, and landed on the following rules:
|
To distill this down to a basic 2.0 spec, my suggestion would be:
|
@gmac wouldn't disallowing divergence in Input objects also making rolling out changes to the object one service at a time difficult. Our current plan is removing the affected services and adding all the new ones but it's not a method I'm happy with. If one service adds a new field to an Input object, but it's being passed to a service that doesn't yet accept it, the two outcomes I can think of are:
Both options could be surprising, though removing the fields is similar to your comment about divergent Enum values? |
That’s a fair point on the input divergence also being blocking. I know GQL Tools handles this by always filtering inputs to the subservice schema, but I don’t love that the approach requires subservice schemas to be individually present for gateway operations (which works against #99). Maybe the gateway composition could cache a minimal delta of fields that must be removed from specific services when this applies? Denying requests feels like a tricky outcome that could have small mistakes translate into large outages. |
Shared enums would be really useful to define standard values across services.
For example:
Similarly, shared scalars would be really useful to standardize the encoding of dates and timestamps for example.
For example:
Shared input types are a bit less useful, but one great use case is to standardize pagination:
I think the proper semantics for these new boundary types is that they each appear exactly once in the resulting merged schema. The schema merge operation would fail if the definitions of the boundary enums / scalars / inputs differ in any way. This does mean that changing the definition of any of these down the line requires a simultaneous upgrade of all the affected services, but I think that's a price worth paying.
Thoughts @Ackar @pkqk ?
The text was updated successfully, but these errors were encountered: