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 on MUTATION #2827

Open
daniil-kzn opened this issue Oct 13, 2023 · 0 comments
Open

Directive on MUTATION #2827

daniil-kzn opened this issue Oct 13, 2023 · 0 comments

Comments

@daniil-kzn
Copy link

daniil-kzn commented Oct 13, 2023

What happened?

  1. define directive @checkMutation on OBJECT | MUTATION in schema.graphqls
  2. add the new directive to mutation type Mutation @checkMutation {...}
  3. define the directive in the application gql config
gqlConfig.Directives.CheckMutation = func(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) {
    return nil, nil
}

What did you expect?

Application runtime goes to CheckMutation func

Minimal graphql.schema and models to reproduce

directive @checkMutation on OBJECT | MUTATION

input NewTodo {
  text: String!
  userId: String!
}

type Todo {
  id: ID!
  text: String!
  done: Boolean!
  user: User!
}

type Mutation @checkMutation {
    createTodo(input: NewTodo!): Todo!
}

versions

  • go run github.com/99designs/gqlgen version? - v0.17.36
  • go version? - go version go1.21.1 linux/amd64
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

1 participant