-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: @DgsEntityFetcher annotation does not prevent compilation when method arguments are incorrect #1618
Comments
Hi @aogilvie-indeed thanks for the well documented issue. What version of dgs-framework are you using? On latest (version 7.5.1) with no custom exception handler I get this error message:
You may be using a custom exception handler. The message on the latest version 7.5.1 with the default handler is not misleading and includes the java lang exception. Added a ticket internally for the compilation behavior. |
Hi @kailyak ! I'm using 5.4.1. However, my error message is identical to yours. My suggestion is that we catch this function signature problem at compile time and not at run time. Why build something that cannot be executed? Also, it's not clear that "argument type mismatch" is a Java problem with the entityfetcher and not a GraphQL problem with the type of one of the arguments sent in the query. |
I just want to +1 this issue, as I also faced the same error output and couldn't figure out why. Thankfully I found this post to resolve my issue and swap argument order, but this issue is very valid and should be addressed in two ways as @aogilvie-indeed is mentioning:
|
The OP Title is correct. The java method param names, and the schema names do not generate errors when they do not match. Tim |
It's not possible to implement this kind of check compile time with Java, but we could at least add a hint in the Intellij plugin. Also we could verify this at startup. |
Expected behavior
WHEN an entity fetcher is defined as such:
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:
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
The text was updated successfully, but these errors were encountered: