-
The API doesn't allow $keyword to be empty in the query. Is there a way to build a query conditionally like below? Eg:
|
Beta Was this translation helpful? Give feedback.
Answered by
budde377
Nov 28, 2023
Replies: 1 comment
-
Thanks for reaching out @abhiche. While I don't think the question is specific to this code-generator but a general GraphQL question, I believe the answer is: No. The GraphQL language does not support any conditional expressions. Instead, what you can do is to expose the query getOrders($filter: FilterInputType) {
orders(filter: $filter, sort: ["-date_created"]) {
id
order_no
date_created
channel
payment_method
shipping_name
phone
total_amount
status
}
}
This will allow you to conditionally generate any filter you need. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
budde377
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for reaching out @abhiche.
While I don't think the question is specific to this code-generator but a general GraphQL question, I believe the answer is: No.
The GraphQL language does not support any conditional expressions. Instead, what you can do is to expose the
filter
through a variable.This will allow you to conditionally generate any filter you need.