americanas-tech/restQL-golang

restQL is not multiplexing "from" requests when an array of objects is posted

ybere opened this issue · 1 comments

ybere commented

Defining a from query as in

img:  from images with id = $ids

And accessing it with command as in

curl -X POST -d {"ids":[1,2,3]} http://localhost:9000/run-query/img

works fine and give me back three responses as intended.

If the query definition changes to

img: from images with id = $ids._id

and the payload changes to

curl -X POST -d {"ids":[{"_id":1},{"_id":2},{"_id":3]} http://localhost:9000/run-query/img

the query ins't being multiplexed anymore.

Actually what is happening is that restQL is not founding the key ids._id on the body object and hence it is not multeplixing the request.

RestQL do not support object navigation from a variable parameter because variables can be used to refer to query parameters, for example curl -X POST -d {"ids":[1,2,3]} http://localhost:9000/run-query/img?foo=bar then $foo would resolve to bar, and query parameter can contain dots on its name hence restQL must treat ids._id as the complete name of the query parameter/body field/header to be used.