R
R
Robur2019-03-12 01:03:44
Backend
Robur, 2019-03-12 01:03:44

How to describe a directive that takes a GraphQL type as a parameter?

I have a directive that changes types in a certain way, while receiving the name of one of the types as input. What is the correct way to describe a type parameter?

directive @combine(type: ????)

type TypeA {
   ...
}

type TypeB @combine (type: TypeA) {
  ...
}

What to substitute instead of ???
so far I've come up with this:
directive @combine(type: Type)

scalar Type

despite the fact that it works, it's not very correct - it's just a trick of the parser, and various tools break down on this.
Internally, the type variable is of type EnumValue, but this is how I understand the implementation details.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question