Skip to content

Incorrect handling of directive argument of list type when non-list value is provided in schema  #2001

@dimdimych

Description

@dimdimych

According to the Graphql language Spec it is allowed to provide a non-list as a value for the list type inputs. According to the spec, if the value's type matches the list item type, the value is interpreted as a singleton list.

While it works in queries, it does not work in schemas, in particular in schema directives with the arguments of List Type.
For example the following fragment of a schema produces the error below:

directive @test( value: [String] ) on FIELD_DEFINITION
type TestType {
testField: Int @test(value: "some value")
}

Error: 'testField' [@47:5] uses an illegal value for the argument 'value' on directive 'test'. Argument value is 'StringValue', expected a list value

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions