Load the following schema into dgraph. I am using the v21.03.0 docker container running locally
type Equipment @key(fields: "id") {
id: ID!
name:String!
events:[Event]
}
type Event @key(fields: "id") {
id:ID!
name:String
timestamp:DateTime @search
value:String
}
Then, using the following index.js for the graphql gateway, start the gateway with node index.js
const { ApolloServer } = require('apollo-server');
const { ApolloGateway } = require("@apollo/gateway");
const gateway = new ApolloGateway({
serviceList: [
{ name: 'core', url: 'http://localhost:8080/graphql' }
],
});
const server = new ApolloServer({
gateway,
subscriptions: false,
});
server.listen().then(({ url }) => {
console.log(`🚀 Server ready at ${url}`);
});
I get the following error
GraphQLSchemaValidationError: Unknown directive "search".
at ApolloGateway.createSchema (/Users/geoffreynunan/Documents/GitHub/Libre-server/node_modules/@apollo/gateway/dist/index.js:207:19)
at ApolloGateway.<anonymous> (/Users/geoffreynunan/Documents/GitHub/Libre-server/node_modules/@apollo/gateway/dist/index.js:178:32)
at Generator.next (<anonymous>)
at fulfilled (/Users/geoffreynunan/Documents/GitHub/Libre-server/node_modules/@apollo/gateway/dist/index.js:5:58)
at processTicksAndRejections (node:internal/process/task_queues:94:5) {
errors: [
GraphQLError: Unknown directive "search".
at Object.Directive (/Users/geoffreynunan/Documents/GitHub/Libre-server/node_modules/graphql/validation/rules/KnownDirectives.js:61:29)
at Object.enter (/Users/geoffreynunan/Documents/GitHub/Libre-server/node_modules/graphql/language/visitor.js:324:29)
at visit (/Users/geoffreynunan/Documents/GitHub/Libre-server/node_modules/graphql/language/visitor.js:242:26)
at Object.validateSDL (/Users/geoffreynunan/Documents/GitHub/Libre-server/node_modules/graphql/validation/validate.js:93:22)
at buildSchemaFromDefinitionsAndExtensions (/Users/geoffreynunan/Documents/GitHub/Libre-server/node_modules/@apollo/federation/dist/composition/compose.js:150:25)
at Object.composeServices (/Users/geoffreynunan/Documents/GitHub/Libre-server/node_modules/@apollo/federation/dist/composition/compose.js:221:30)
at Object.composeAndValidate (/Users/geoffreynunan/Documents/GitHub/Libre-server/node_modules/@apollo/federation/dist/composition/composeAndValidate.js:13:41)
at ApolloGateway.createSchema (/Users/geoffreynunan/Documents/GitHub/Libre-server/node_modules/@apollo/gateway/dist/index.js:199:49)
at ApolloGateway.<anonymous> (/Users/geoffreynunan/Documents/GitHub/Libre-server/node_modules/@apollo/gateway/dist/index.js:178:32)
at Generator.next (<anonymous>) {
locations: [ { line: 15, column: 22 } ]
}
]
}
If I remove the @search directive from the dgraph schema, the gateway starts successfully