Discover Packages
github.com/followthepattern/graphql-go
example
federation
compatibility
command
Version:
v1.5.1
Opens a new window with list of versions in this module.
Published: Aug 19, 2023
License: BSD-2-Clause
Opens a new window with license information.
Imports: 7
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
README
ΒΆ
Apollo Federation Subgraph Compatibility
Overview
This application was created to demonstrate that the library is fully compatible with the Apollo Federation Subgraph spec .
Compatibility Results
Federation 1 Support Federation 2 Support
_service
π’ @key (single)
π’ @key (multi)
π’ @key (composite)
π’ repeatable @key
π’ @requires
π’ @provides
π’ federated tracing
π²
@link
π’ @shareable
π’ @tag
π’ @override
π’ @inaccessible
π’ @composeDirective
π’ @interfaceObject
π’
* This app intentionally does not demonstrate the use of Apollo Tracing since this is not part of the GraphQL spec. However, you can implement it yourself.
Test it yourself
The application also has the graphiql interface available at /graphiql
and you can play with the server. Particularly interesting queries are those using the _entities
resolver and providing different key representations of type _Any
. Below is a sample query you can play with. In order to run it:
Run go run .
Navigate to http://localhost:4001/graphiql
Copy the query below into the GraphiQL UI:
query ($representations: [_Any!]!) {
_entities(representations: $representations) {
__typename
...on DeprecatedProduct { sku package reason }
...on Product { id sku createdBy { email name } }
...on ProductResearch { study { caseNumber description } }
...on User { email name }
}
}
Paste this into the variables section:
{
"representations": [
{
"__typename": "DeprecatedProduct",
"sku": "apollo-federation-v1",
"package": "@apollo/federation-v1"
},
{
"__typename": "ProductResearch",
"study": {
"caseNumber": "1234"
}
},
{ "__typename": "User", "email": "support@apollographql.com" },
{
"__typename": "Product",
"id": "apollo-federation"
},
{
"__typename": "Product",
"sku": "federation",
"package": "@apollo/federation"
},
{
"__typename": "Product",
"sku": "studio",
"variation": { "id": "platform" }
}
]
}
After executing the query you should see the following result:
{
"data": {
"_entities": [
{
"__typename": "DeprecatedProduct",
"package": "@apollo/federation-v1",
"reason": "Migrate to Federation V2"
},
{
"__typename": "ProductResearch",
"study": {
"caseNumber": "1234",
"description": "Federation Study"
}
},
{
"__typename": "User",
"email": "support@apollographql.com",
"name": "Jane Smith"
},
{
"__typename": "Product",
"id": "apollo-federation",
"sku": "federation"
},
{
"__typename": "Product",
"id": "apollo-federation",
"sku": "federation"
},
{
"__typename": "Product",
"id": "apollo-studio",
"sku": "studio"
}
]
}
}
In case you want to run the compatiblity tests yourself:
npx @apollo/federation-subgraph-compatibility@1.2.1 pm2 --endpoint http://localhost:4001
Expand βΎ
Collapse β΄
Documentation
ΒΆ
There is no documentation for this package.
Source Files
ΒΆ
Click to show internal directories.
Click to hide internal directories.