Skip to content

Directive not executed on loader field definition #1126

@amazzoccone

Description

@amazzoccone

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions