I am trying to define a GraphQL directive which has an array argument which looks like this:
input Data {
someField: String!
anotherField: String!
}
directive @someDirective( args: [Data!]! ) on OBJECT
type SomeType @someDirective( args: [{someField: "blah", anotherField: "blah"}] )
{
empty: String
}
If I change Data to be a type, the GraphQL compiler get the error:
"The type of @someDirective(args:) must be Input Type but got: [Data!]!."
The problem with using input is that there is no validation of the input by the compiler. This compiles fine:
type AnotherType @someDirective( args: [{blah: "blah", blah2: "blah"}] )
{
empty: String
}
Is it possible to define an object array argument for a directive which gets validated by the compiler?