mercurius
mercurius copied to clipboard
Directive not executed on loader field definition
Hi, i have a graphql server with a custom directive @auth, defined in multiple places, but in field loaders it isn't executed.
Example:
type Query {
client(id: ID): Client @auth(type: "system")
}
type Client {
id: ID
name(format: String): String @auth(type: "system")
payload: JSON @auth(type: "system")
users(cursor: String, perPage: Int) @auth(type: "system")
admins(cursor: String, perPage: Int) @auth(type: "admin")
}
Directive definition:
typedef: directive @auth (type: String) on OBJECT | FIELD_DEFINITION | SCHEMA
transformer:
mapSchema(schema, {
[MapperKind.TYPE]: ...,
[MapperKind.ROOT_OBJECT]: ...,
[MapperKind.OBJECT_FIELD]: ...
})
In client query and name and payload fields the directive works as expected, but in both users and admins (loaders), it isn't.
¿It's a framework limitation? ¿An implementation error? ¿A bug?
Thanks for the support! I have been working with Mercurius for 3 years ago and i'm really satisfied, it has all we need to create a fast lightweight graphql server!
Thanks for reporting!
Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.