-
Notifications
You must be signed in to change notification settings - Fork 362
Implementing federation spec #280
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
Conversation
...-federation/src/main/kotlin/com/expedia/graphql/federation/FederationSchemaGeneratorHooks.kt
Outdated
Show resolved
Hide resolved
f5fac85
to
b175ada
Compare
Codecov Report
@@ Coverage Diff @@
## master #280 +/- ##
============================================
+ Coverage 64.56% 68.15% +3.58%
- Complexity 194 263 +69
============================================
Files 103 115 +12
Lines 1064 1275 +211
Branches 152 196 +44
============================================
+ Hits 687 869 +182
- Misses 363 385 +22
- Partials 14 21 +7
Continue to review full report at Codecov.
|
…in-schema-generator to generate federated GraphQL schemas. Federated GraphQL architecture is an alternative to schema stitching approach that relies on declarative programming composition of schemas. graphql-kotlin-federation adds support for the following: new @key, @extends, @external, @requires and @provides directives new _FieldSet and _Any scalar types new _Entity union type of all federated types new _service query that returns _Service object with sdl field new _entity query that returns list of _Entity objects In order to generate federate schemas we have to annotate the underlying type with proper new directives and then use new toFederatedSchema function to build the schema (instead of toSchema function from graphql-kotlin-schema-generator). FederatedSchemaGeneratorHooks also require to specify FederatedTypeRegistry that holds a mapping between federated type names and their corresponding resolver. Those new FederatedTypeResolvers are used to instantiate the federated types based on the federated _entity query generated from the gateway. See: https://www.apollographql.com/docs/apollo-server/federation/introduction/ Resolves: ExpediaGroup#238
type _Service { | ||
sdl: String! | ||
} | ||
``` |
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.
could be interesting to default the type description and add a link to section in the spec.
People will keep getting confused by _Entity
and _Service
for a while
graphql-kotlin-federation/README.md
Outdated
} | ||
``` | ||
|
||
#### Extended Service |
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.
Should precise which service ReviewService
here I believe
* class User( | ||
* @property:ExternalDirective val userId: String, | ||
* @property:ExternalDirective val name: String | ||
* ) |
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.
Does it mean if we have a third property here it wouldn't be exposed in the graph?
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.
it would result in invalid schema
} | ||
|
||
type Query { | ||
_service: _Service |
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.
If the service is not "federate-able" should its SDL contain _service
?
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.
yes -> #280 (comment)
* Create new graphql-kotlin-federation module that extends graphql-kotlin-schema-generator to generate federated GraphQL schemas. Federated GraphQL architecture is an alternative to schema stitching approach that relies on declarative programming composition of schemas. graphql-kotlin-federation adds support for the following: new @key, @extends, @external, @requires and @provides directives new _FieldSet and _Any scalar types new _Entity union type of all federated types new _service query that returns _Service object with sdl field new _entity query that returns list of _Entity objects In order to generate federate schemas we have to annotate the underlying type with proper new directives and then use new toFederatedSchema function to build the schema (instead of toSchema function from graphql-kotlin-schema-generator). FederatedSchemaGeneratorHooks also require to specify FederatedTypeRegistry that holds a mapping between federated type names and their corresponding resolver. Those new FederatedTypeResolvers are used to instantiate the federated types based on the federated _entity query generated from the gateway. See: https://www.apollographql.com/docs/apollo-server/federation/introduction/ Resolves: ExpediaGroup#238
* Create new graphql-kotlin-federation module that extends graphql-kotlin-schema-generator to generate federated GraphQL schemas. Federated GraphQL architecture is an alternative to schema stitching approach that relies on declarative programming composition of schemas. graphql-kotlin-federation adds support for the following: new @key, @extends, @external, @requires and @provides directives new _FieldSet and _Any scalar types new _Entity union type of all federated types new _service query that returns _Service object with sdl field new _entity query that returns list of _Entity objects In order to generate federate schemas we have to annotate the underlying type with proper new directives and then use new toFederatedSchema function to build the schema (instead of toSchema function from graphql-kotlin-schema-generator). FederatedSchemaGeneratorHooks also require to specify FederatedTypeRegistry that holds a mapping between federated type names and their corresponding resolver. Those new FederatedTypeResolvers are used to instantiate the federated types based on the federated _entity query generated from the gateway. See: https://www.apollographql.com/docs/apollo-server/federation/introduction/ Resolves: ExpediaGroup#238
Create new
graphql-kotlin-federation
module that extendsgraphql-kotlin-schema-generator
to generate federated GraphQL schemas. Federated GraphQL architecture is an alternative to schema stitching approach that relies on declarative programming composition of schemas.graphql-kotlin-federation
adds support for the following:@key
,@extends
,@external
,@requires
and@provides
directives_FieldSet
and_Any
scalar types_Entity
union type of all federated types_service
query that returns_Service
object withsdl
field_entity
query that returns list of_Entity
objectsIn order to generate federate schemas we have to annotate the underlying type with proper new directives and then use new
toFederatedSchema
function to build the schema (instead oftoSchema
function fromgraphql-kotlin-schema-generator
).FederatedSchemaGeneratorHooks
also require to specifyFederatedTypeRegistry
that holds a mapping between federated type names and their corresponding resolver. Those newFederatedTypeResolver
s are used to instantiate the federated types based on the federated_entity
query generated from the gateway.See: https://www.apollographql.com/docs/apollo-server/federation/introduction/
Resolves: #238