graphql-java-tools icon indicating copy to clipboard operation
graphql-java-tools copied to clipboard

Last argument to field resolver is not checked when using the context class schema parser option

Open vojtapol opened this issue 5 years ago • 0 comments

To reproduce:

SchemaParserOptions options = SchemaParserOptions.newOptions()
    .contextClass(CustomContext.class)
    .build();
type Mutation {
  myMutation(
    id: ID!
    field: String!
    persist: Boolean!
  ): Entity
}

The following method field resolver is accepted:

public Entity myMutation(String id, String field, CustomContext context)

Although it is missing the persist parameter. This is because the CustomContext type is accepted as the last parameter.

Ideally this should throw just like in the case where DataFetchingEnvironment is used as the last parameter.

Not sure if it's possible.

vojtapol avatar Jul 14 '20 13:07 vojtapol