You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the following typeDefs with makeExecutableSchema should result in a GraphQLSchema that contains @auth directive but it fails when we define resolvers for an enum.
/** * directive that uses enum */consttypeDefs=` directive @auth(role: Role!) on FIELD | FIELD_DEFINITION enum Role { ADMIN USER } type Query { foo: String @auth(role: ADMIN) }`;
Works
/** * Produced GraphQLSchema has @auth directive */constschema=makeExecutableSchema({
typeDefs,});console.log(schema.getDirective('auth'))// outputs: auth
Doesn't work
/** * Produced GraphQLSchema has no @auth directive, because enum has resolvers */constschema=makeExecutableSchema({
typeDefs,resolvers: {Role: {ADMIN: 'A',USER: 'U'}}});console.log(schema.getDirective('auth'))// outputs: undefined
Using the following
typeDefs
withmakeExecutableSchema
should result in a GraphQLSchema that contains@auth
directive but it fails when we define resolvers for anenum
.Works
Doesn't work
Repro: https://stackblitz.com/edit/typescript-ktnvjs?file=index.ts
The text was updated successfully, but these errors were encountered: