Skip to content

Custom directive for INPUT_FIELD_DEFINITION not working #731

Open
@williamwjs

Description

@williamwjs

Description

Here's the sample schema as in https://github.com/graphql-java-kickstart/samples/blob/master/directives/src/main/resources/schema.graphqls#L1-L19

directive @range(
    min: Float!,
    max: Float!
) on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION

type Query {
    withInput(input: InputObject): Float
}

input InputObject {
    value: Float @range(min: 0.00, max: 10.00)
    nolimit: Float
    limit: Float @range(min: 11.00, max: 15.00)
}

When trying to run the below example query

{
  withInput(input: {value: 100})
}

Expected behavior

Render as error stating that the input value is not within 0-10

Actual behavior

{
  "data": {
    "withInput": 100
  }
}

Steps to reproduce the bug

  1. Checkout the sample repo and run the directive project https://github.com/graphql-java-kickstart/samples/blob/master/directives/src/main/resources/schema.graphqls
  2. Run the graphql query as I mentioned above

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