-
Notifications
You must be signed in to change notification settings - Fork 95
[Feature Request] Apollo Federation Support #297
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
Comments
Hi Nihal. Thanks for using the plugin. Like you mention, these directives are custom, and the plugin only ships with the directives that are described in the GraphQL spec. This is intentional, as new GraphQL frameworks appear all the time. For this reason you have to declare framework directives yourself, and ensure that they're picked up as part of schema discovery. You can look at an example at https://github.com/jimkyndemeyer/graphql-config-examples/tree/master/extend-client-fields-and-directives which shows how to work with the Extending non-existing types violates the GraphQL Spec https://graphql.github.io/graphql-spec/June2018/#sec-Object-Extensions validation "The named type must already be defined and must be an Object type." As such, I noted one interesting comment in your code example: # (Apollo Server allows extend, graphql-java requires @extends) If you declared your directives as expected, and used Best regards, |
Thanks for the detailed response! I completely understand that you wouldn't want to add these directives by default. However, since Apollo Federation has gathered quite a bit of support (including graphql-ruby, graphql-java, graphql-kotlin, gqlgen (go), graphene (python), and graphql-dotnet), I believe it would make sense to integrate this here so that users can easily build Federated schemas. Regarding the |
Looking at the examples of how to configure and extend the plugin (https://github.com/jimkyndemeyer/graphql-config-examples) perhaps a boilerplate example for Apollo Federation would help people get started. |
Perhaps I'm doing something wrong, but declaring a type in service A and then extending it using Service A type Foo @key(fields: "id") {
id: ID!
} Service B type Foo @extends @key(fields: "id") {
id: ID! @external
} Directives directive @key(fields: _FieldSet!) on OBJECT | INTERFACE
directive @extends on OBJECT | INTERFACE
EDIT: As a workaround I made some slight changes to my structure and |
@quintstoffers some work has been done recently in this PR #374 in 2.6.0, and we plan to continue our work on the schema splitting in different scenarios, but that's a huge amount of work. At this point, a dependency on the underlying One of the next steps I believe would be disabling this kind of error |
It looks like Federation 2 support is included in plugin version 3.4.0! Make sure to enable the setting in |
It would be great if the type A {
foo: String
}
type B {
a: A
bar: String @requires(fields:
"""
a {
foo
}
""")
}
|
Apollo Federation makes uses of some custom directives:
https://www.apollographql.com/docs/apollo-server/federation/federation-spec/
Version and Environment Details
Operation system: macOS
IDE name and version: IntelliJ IDEA Ultimate 2019.2
Plugin version: 2.2.0
Expected Behaviour
The following directives should not produce errors:
(These directives must NOT be in the GraphQL file itself)
An
extend type TypeName
should be allowed to exist without the base type, as the base type may be defined by another serviceActual Behaviour
Unknown directive "XXX"
The extension 'TypeName' type [@x:x] is missing its base underlying type
Steps to Reproduce / Link to Repo with Reproduction and Instructions
The text was updated successfully, but these errors were encountered: