Skip to content

Repeated directives are ignored #615

Closed
@prgood

Description

@prgood

Description

The graphql-java library support repeatable directives as we can see here: graphql-java/graphql-java#1763
Example:
directive @Min(value : Int! = 0, country : String) repeatable on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION

But "SchemaParser" is reading only the first repeated directive like in the example below we got only the first directive triggered:

type Query {
    test(
        minField: Int @Min(value : 30, country: "BR"),   @Min(value : 10, country: "UK")
    )
}

I think this line is part of the issue:

if (!names.contains(directive.name)) {

Expected behavior

When more the one of a"repeatable" directive is applied to a field, all repeated directives should be processed.

Actual behavior

Only the first directive is been processed.

Steps to reproduce the bug

  1. Define a directive as "repeatable" like the example above.
  2. Apply this directive more then once to a single field.
  3. All directives should run

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions