graphiql
graphiql copied to clipboard
[graphiql] GraphiQL Explorer Plugin generates incorrect order_by syntax
Is there an existing issue for this?
- [x] I have searched the existing issues
Current Behavior
The GraphiQL Explorer plugin is generating incorrect syntax for order_by arguments. When using the Explorer UI to add ordering fields, it generates an object syntax instead of the required array of objects syntax.
When using the Explorer to add ordering fields, it generates queries like this:
query MyQuery {
billing(
order_by: {billingDate: Asc, billingId: Asc, customerId: Asc, paymentStatus: Asc}
) {
billingId
billingDate
}
}
It throws an error -
"data": null,
"errors": [
{
"message": "order_by expects a list of input objects with exactly one key-value pair per input object. Please split the input object with multiple key-value pairs into a list of single key-value pair objects."
}
]
}
Expected Behavior
The query should be generated with an array of objects syntax like this:
billing(
order_by: [{billingDate: Asc}, {billingId: Asc}, {customerId: Asc}, {paymentStatus: Asc}]
) {
billingId
billingDate
}
}
Steps To Reproduce
- Open GraphiQL Explorer
- Select a query field that supports ordering
- Add multiple order_by fields through the Explorer UI
- Observe the generated query syntax
Environment
- GraphiQL Version: 3.2.0
- graphiql/plugin-explorer: 2.0..0
- OS:
- Browser:
- Bundler:
reactVersion: 0.21.0graphqlVersion:
Anything else?
No response