-
Notifications
You must be signed in to change notification settings - Fork 226
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
Context.arg
Wraps Optional Arguments inside another Option
#945
Comments
Thanks for the detailed report. Sorry I missed the notification somehow. Could you open a PR with a failing test in https://github.com/sangria-graphql/sangria/blob/main/modules/core/src/test/scala/sangria/schema/ArgsSpec.scala ? |
- See sangria-graphql#945 - Unit tests added to demonstrate the possible issue with Args that wraps optional arguments inside another Option;
@yanns - No worries and I also just came back from my holiday. As suggested, I raised #952 to demonstrate the unexpected behaviours related to arbitrary input objects and
The findings above match what I observed previously, although |
Thanks a lot for the PR! By using Is it something that also fix your case? |
@yanns - Amazing! It makes sense to me now that we need the
Thanks so much for your help! |
Overview
Given an argument
MyArg
of typeArgument[Option[MyInputObject]]
,context.arg(MyArg)
doesn't return a value of typeOption[MyInputObject]
within the 'resolve' function, but wraps the argument value inside anotherOption
and returnsOption[Option[MyInputObject]]
instead.Environment
This issue was verified in the following environment:
Reproduction
Example Code
Below is an example that demonstrates the issue.
Behaviours
The following line from the example above is supposed to be
Option[EchoMessageInput]
, but the log shows that the actual value isSome(Some(EchoMessageInput(Hello World!)))
, indicatingContext.arg
somehow wraps the argument value inside anotherOption
.Is there any misconfiguration in my example above that causes this undesired behaviour? Thank you.
The text was updated successfully, but these errors were encountered: