You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm on 1.0.0-M2 and trying to create a handler for a method with an optional field.
@QueryMapping
public Example example(@Argument Optional<String> relatedString) {
return exampleService.getExample(relatedString);
}
However, I keep getting the following response:
{
"errors": [
{
"message": "class java.util.Optional cannot be cast to class java.lang.String (java.util.Optional and java.lang.String are in module java.base of loader 'bootstrap')",
"locations": [
{
"line": 2,
"column": 5
}
],
"path": [
"example"
],
"extensions": {
"classification": "INTERNAL_ERROR"
}
}
],
"data": {
"example": null
}
}
When debugging, I found that relatedString was being double wrapped with Optional at runtime. In other words, the input to the method is actually Optional[Optional[stringThatMayBeHere]]. I assume that this is not intentional.
The text was updated successfully, but these errors were encountered:
Hi, I'm on 1.0.0-M2 and trying to create a handler for a method with an optional field.
However, I keep getting the following response:
When debugging, I found that
relatedString
was being double wrapped withOptional
at runtime. In other words, the input to the method is actuallyOptional[Optional[stringThatMayBeHere]]
. I assume that this is not intentional.The text was updated successfully, but these errors were encountered: