-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend "StringOperators" with "OR" and RegEx #543
Comments
One point to note is that in GraphQL we cannot have an input type like this: input StringOperators {
eq: String | [String!]
contains: String | [String!]
} This is because there is no support for union types in inputs: graphql/graphql-spec#488 Therefore there are 2 options:
I prefer version 2 because it is more explicit (it may be confusing why you need to pass an array of 1 value to Example: query {
orders(options: {
filter: {
state: {
in: ["Shipped", "Delievered", "PartiallyDelievered"]
}
}
}) {
items {
id
# ...
}
totalItems
}
}
|
I agree, in that case |
we can omit contains in multiple values as it's more advance use case that can be implemented by using RegEx. |
Opening this topic again in pursuance of inverted string filters that would allow us to query for all values that are NOT:
Ofc we can enlist all values we want, but having option to exclude values instaed would be handy and allows writing update-safe components (e.g. we add new "processing" order state and we might forget to include such state in "in" filter, where we aim to filter-out not placed orders. |
Is your feature request related to a problem? Please describe.
Currently only "eq" and "contains" filters that take single value are possible for strings. But sometimes we want to query for string OR string, or even write more complex check using RegEx.
Describe the solution you'd like
In practice the eq and contains could take in string | string[]. If an array is passed then it would do OR operations between array strings. E.g:
{ filter: state: { eq: ['Shipped', 'Delievered', 'PartiallyDelievered'] } }
The OR operation itself would be possible to do in RegEx itself, but extending current eq and contains shall be more straight-forward.
The text was updated successfully, but these errors were encountered: