-
Notifications
You must be signed in to change notification settings - Fork 240
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
federation gateway should throw on type's conflicts #826
Comments
Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests. |
I have been looking at this today and have some code that works for the case above. However I'm trying to get a better understanding of what the defined behaviour should be for when federated service schemas come together more broadly (for example if it is not an entity type as above). Is there any specification or guidance on how federated service schemas should behave when they come together? I have been looking at the Apollo v1 documentation - is this what we want to follow? It would be great to have some more test cases to help write this feature. |
Good question! This is actually being fleshed out as we speak in the GraphQL Composite Schemas Working Group: https://github.com/graphql/composite-schemas-wg . Unfortunately, there is not much behavioural stuff yet so that will be available down the line - although I don't know how long this will be or what it will look like. E.g. it was discussed in the inaugural WG meet the other week about the fact that there are lots of valid ways to combine these schemas and how one would resolve a conflict such as this. In the meantime, following what Apollo has done is not a bad shout as I understand that Mercurius Federation was originally based on Apollo Federation? |
Indeed |
note that Mercurius fully support mercurius/test/gateway/requires-directive.js Line 124 in ef154c5
|
Just to give an example of some ambiguity here, the example given in the opening post for the first service schemas uses an entity type like so: type Order @key(fields: "id") {
id: ID!
name: String
} For extending entities in Apollo v1, the canonical way is as so: extend type Order @key(fields: "id") {
id: String! @external
surname: String
} I believe the following attempt to extend (in the initial example) should probably throw an error because it's not the defined way (at least as defined by Apollo v1) to extend an entity (here the key directive is not used so it is not even an entity definition): extend type Order {
surname: String
} |
Given the following schemas:
Node 1
Node 2
The gateway starts correctly instead of throwing.
This is a clear developer's error, as the
Node 2
's schema should use theextends
keyword:In this case, Mercurius should throw an error when:
extends
keywordextends
entity must not use theID!
property valueIn both the above cases, Apollo server trigger this error:
This would help developers to spot these schema conflicts at first gateway run.
The text was updated successfully, but these errors were encountered: