-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
Hi, it throws me the following error when trying to add directive resolve functions to the schema.
I have checked with forEachField and astNode is always undefined, is it my configuration or is it a bug?
const schema = new GraphQLSchema({
directives: [
new GraphQLDirective({
name: 'isAuth',
locations: [ DirectiveLocation.FIELD_DEFINITION, DirectiveLocation.FIELD ]
})
],
query: new GraphQLObjectType({
name: 'Query',
fields: {
user: {
type: new GraphQLObjectType({
name: 'User',
fields: () => ({
id: { type: GraphQLNonNull(GraphQLInt) },
email: { type: GraphQLNonNull(GraphQLString) }
})
}),
args: { id: { type: GraphQLInt } },
resolve: (parent, args, context, info) => {
return { id: 1, email: '[email protected]' };
}
}
}
})
});
const directiveResolvers = {
isAuth(next, source, args, context, info) {
throw Error('Ups!');
}
};
const { addDirectiveResolveFunctionsToSchema } = require('graphql-directive');
addDirectiveResolveFunctionsToSchema(schema, directiveResolvers);
ticdenis and krishesk
Metadata
Metadata
Assignees
Labels
No labels