Closed Trellian closed 6 years ago
Does this work?
query getRegions ($order: IwRegionPropertiesEnum) {
iwRegions (range: [0, 4], orderBy: $order) {
name
}
}
I can't get it to work, but... GraphiQL is doing something odd. When I paste the above (with a few extra columns included in the query), and then try to set up the variables, the typeahead functionality in the variables pane forces the following:
{
"order": "name"
}
or similar, for the other column names (if I add them to the query).
Executing the query then produces:
{
"data": {
"iwRegions": null
},
"errors": [
{
"message": "undefined passed as argument #0 for 'orderBy' operation. Call skipUndefined() method to ignore the undefined values.",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"iwRegions"
]
}
]
}
I also get this log trace:
Error: undefined passed as argument #0 for 'orderBy' operation. Call skipUndefined() method to ignore the undefined values.
at convertUndefined (C:\xampp\htdocs\iwallq\api\node_modules\objection\lib\queryBuilder\operations\ObjectionToKnexConvertingOperation.js:65:11)
at convertArgs (C:\xampp\htdocs\iwallq\api\node_modules\objection\lib\queryBuilder\operations\ObjectionToKnexConvertingOperation.js:36:14)
at KnexOperation.onAdd (C:\xampp\htdocs\iwallq\api\node_modules\objection\lib\queryBuilder\operations\ObjectionToKnexConvertingOperation.js:22:17)
at QueryBuilder.addOperation (C:\xampp\htdocs\iwallq\api\node_modules\objection\lib\queryBuilder\QueryBuilderOperationSupport.js:147:33)
at QueryBuilder.orderBy (C:\xampp\htdocs\iwallq\api\node_modules\objection\lib\queryBuilder\QueryBuilderBase.js:297:17)
at Object.query (C:\xampp\htdocs\iwallq\api\node_modules\objection-graphql\lib\argFactories.js:119:15)
at QueryBuilder.<anonymous> (C:\xampp\htdocs\iwallq\api\node_modules\objection-graphql\lib\SchemaBuilder.js:361:34)
at QueryBuilder.modify (C:\xampp\htdocs\iwallq\api\node_modules\objection\lib\queryBuilder\QueryBuilderBase.js:48:12)
at QueryBuilder.modify (C:\xampp\htdocs\iwallq\api\node_modules\objection\lib\queryBuilder\QueryBuilder.js:145:22)
at C:\xampp\htdocs\iwallq\api\node_modules\objection-graphql\lib\SchemaBuilder.js:220:17
at resolveFieldValueOrError (C:\xampp\htdocs\iwallq\api\node_modules\graphql\execution\execute.js:501:12)
at resolveField (C:\xampp\htdocs\iwallq\api\node_modules\graphql\execution\execute.js:465:16)
at C:\xampp\htdocs\iwallq\api\node_modules\graphql\execution\execute.js:314:18
at Array.reduce (<anonymous>)
at executeFields (C:\xampp\htdocs\iwallq\api\node_modules\graphql\execution\execute.js:311:42)
at executeOperation (C:\xampp\htdocs\iwallq\api\node_modules\graphql\execution\execute.js:239:122)
Note the line number at "node_modules\objection-graphql\lib\argFactories.js:119:15" should be 118, but I stuck a 'console.warn()' in at 118
@Trellian I found a bug in this. It's now fixed in master
Awesome! Thank you!
I'm trying to pass in the "orderBy:" parameter as a variable in the GraphiQL client, but I'm not sure how:
with variables:
but I get an error message:
How should I do this?
Thanks, Adrian