Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directive not executed on loader field definition #1126

Open
amazzoccone opened this issue Dec 16, 2024 · 1 comment
Open

Directive not executed on loader field definition #1126

amazzoccone opened this issue Dec 16, 2024 · 1 comment

Comments

@amazzoccone
Copy link

amazzoccone commented Dec 16, 2024

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!

@mcollina
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants