-
Notifications
You must be signed in to change notification settings - Fork 73
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
Nested InputObjects don't get populated #472
Comments
That happens because you need to declare type Range = { Min: int; Max: int }
let inputs = [
Define.Input ("count", IntType)
Define.Input ("range", Nullable (Define.InputObject<Range>("RandomRange", [
Define.Input ("min", IntType)
Define.Input ("max", IntType)
])))
] As |
There are 2 options to fix
|
@xperiandri thanks, I appreciate your help. Defining a Range type works. I suppose I could dynamically create a new type and then use reflection to call the A nice option (from the library side) besides |
Have you tried that? Doesn’t it work? |
I've tried with let randoms =
let inputs = [
Define.Input ("count", IntType)
Define.Input ("range", Nullable (Define.InputObject<System.Text.Json.JsonElement>("Range", [
Define.Input ("min", IntType)
Define.Input ("max", IntType)
])))
]
let renderRandoms (ctx:ResolveFieldContext) (r:Root) =
[ for i in 1..ctx.Arg("count") -> System.Random.Shared.Next() ]
Define.Field ("random", ListOf IntType, "Render random numbers", inputs, renderRandoms) ... but it's resulting in a runtime error when the app starts:
|
What about Dictionary? |
Or dynamic |
Similarly |
Thanks for testing! |
Thanks @xperiandri, based on your hints, I managed to patch the code in #475 ... and that fixes my issue. (ignore the link just above this comment: I somehow managed to commit too many files into the pool request, so I closed that request and made a new one). |
I've added a small random generator query to star-wars-api example:
and plugged it into existing Query:
Now I can say
and get
Problem
When I call
The
ctx.args("range")
is always passed as an empty unpopulatedobj()
without any type or properties,whereas
ctx.args("count")
works as expected.The text was updated successfully, but these errors were encountered: