Comments (3)
Yeah this has been annoying me for a bit, but I've been ignoring it. Does Apollo have any guidance here?
from apollo-federation-ruby.
The Apollo Federation spec says to include all uses of federation-specific directives but there's no mention of the directive definitions, although all of the spec examples omit the directive definitions.
I followed the @apollo/subgraph
setup instructions to create a simple test server using the official Apollo libraries:
import gql from 'graphql-tag';
import { ApolloServer } from '@apollo/server';
import { startStandaloneServer } from '@apollo/server/standalone'
import { buildSubgraphSchema } from '@apollo/subgraph';
const typeDefs = gql`
extend schema @link(url: "https://specs.apollo.dev/federation/v2.0", import: ["@key", "@shareable"])
type Query {
me: User
}
type User @key(fields: "id") {
id: ID!
username: String
}
`;
const resolvers = {};
const server = new ApolloServer({
schema: buildSubgraphSchema({ typeDefs, resolvers }),
});
const { url } = await startStandaloneServer(server, {
listen: { port: 4000 },
});
console.log(`🚀 Server ready at: ${url}`);
Querying Query._service.sdl
returns a schema with federation directive definitions:
schema
@link(url: "https://specs.apollo.dev/link/v1.0")
{
query: Query
}
extend schema
@link(url: "https://specs.apollo.dev/federation/v2.0", import: ["@key", "@shareable"])
directive @link(url: String, as: String, for: link__Purpose, import: [link__Import]) repeatable on SCHEMA
directive @key(fields: federation__FieldSet!, resolvable: Boolean = true) repeatable on OBJECT | INTERFACE
directive @federation__requires(fields: federation__FieldSet!) on FIELD_DEFINITION
directive @federation__provides(fields: federation__FieldSet!) on FIELD_DEFINITION
directive @federation__external(reason: String) on OBJECT | FIELD_DEFINITION
directive @federation__tag(name: String!) repeatable on FIELD_DEFINITION | OBJECT | INTERFACE | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
directive @federation__extends on OBJECT | INTERFACE
directive @shareable on OBJECT | FIELD_DEFINITION
directive @federation__inaccessible on FIELD_DEFINITION | OBJECT | INTERFACE | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
directive @federation__override(from: String!) on FIELD_DEFINITION
type Query {
me: User
_entities(representations: [_Any!]!): [_Entity]!
_service: _Service!
}
type User
@key(fields: "id")
{
id: ID!
username: String
}
enum link__Purpose {
"""
`SECURITY` features provide metadata necessary to securely resolve fields.
"""
SECURITY
"""
`EXECUTION` features provide metadata necessary for operation execution.
"""
EXECUTION
}
scalar link__Import
scalar federation__FieldSet
scalar _Any
type _Service {
sdl: String
}
union _Entity = User
So in summary, the Apollo tooling works fine with or without the directive definitions but their reference implementation does include the directives the Query._service.sdl
field.
from apollo-federation-ruby.
@jturkel Interesting. Our sdl field calls our federation_sdl
helper, which does not include those definitions, so we should probably add them...
from apollo-federation-ruby.
Related Issues (20)
- Enabling federated tracing breaks multiplex HOT 5
- unable to configure federation directive namespace HOT 7
- Find a home for MinimumWageMailer and its templates HOT 1
- Using a dataloader inside `resolve_reference` does not work HOT 10
- passing `@federation__shareable` to type PageInfo HOT 17
- The automated release is failing 🚨
- Add `resolvable` argument to `key` directive HOT 2
- v3.4.x updates federation directive version to 2.3, fails schema checks with Apollo Studio HOT 17
- The automated release is failing 🚨
- support @composeDirective
- Representation fields in entity queries are not validated at query execution time HOT 5
- support @cacheControl HOT 1
- Namespace all federation directives HOT 2
- Fowarding headers from Supergraph to subgraphs HOT 2
- Examples - Share
- Development / maintenance status of this gem HOT 6
- Federation directives are not showing up in SDL output HOT 1
- Gateway will merge incorrect data if subgraph changes entity order
- Bug: Orphan types are ignored since version 3.8.5 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apollo-federation-ruby.