Skip to content

bug: @DgsEntityFetcher annotation does not prevent compilation when method arguments are incorrect #1618

@ghost

Description

Expected behavior

WHEN an entity fetcher is defined as such:

@DgsEntityFetcher(name = DgsConstants.STORE.TYPE_NAME)
public Store storeFetcher(final DgsDataFetchingEnvironment dfe, final Map<String, Object> values) {
    return Store.newBuilder().name("myStore").build();
}

THEN compilation should fail because the parameters are in the wrong order

Actual behavior

Compilation is successful and the service starts. When making this query:

query {
  _entities(representations: [{__typename: "Store", id: "123"}]) {
    ... on Store {
      name
    }
  }
}

the returned error states Exception while fetching data (/_entities) : argument type mismatch. This is a misleading error that appears to come from GraphQL, but actually comes from Java.

Steps to reproduce

# schema
type Store @key(fields: "id") {
  id: ID!
  name: String
}
  1. Create an entityfetcher with the signature described above.
  2. Attempt to invoke it with the query described above.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions