How to set up an enum to allow multiple enums in a query? GraphQL Ruby
I have an enum, item_status.rb
defined in app/graphql/graph/enums
that looks something like this:
Graph::Enums::ItemStatus = GraphQL::EnumType.define do
name "ItemStatus"
description "lorem ipsum"
value "GOOD", "item is good", value: "good"
value "NORMAL", "item is normal", value: "normal"
value "BAD", "item is bad", value: "bad"
end
It’s defined in my schema.graphql
like this:
enum ItemStatus {
GOOD
NORMAL
BAD
}
I want to send a query from my front-end that contains multiple values for ItemStatus, for example in my queryVariables I’d send status: ["GOOD", "NORMAL"]
and I want to receive all items with either of those statuses back. How do I modify my schema to accept an array of values as well as a single value?
Read more here: Source link