You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is mistakenly prescriptive in that it generates a filter expression with commas (or operators). See filtering syntax.
For example, let's assume we want to get posts that are featured, but are not tagged as tutorial. Assuming the negation operator (-), one may naively come up with an argument like this: filter: ["featured:true", "tag:-tutorial"] (the outcome of not having any other choice).
filter: ["featured:true", "tag:-tutorial"] from our GraphQL query will actually generate a content API query param like so (this would be URI encoded of course):
?filter=featured:true,tag:-tutorial
This is problematic, because in filtering syntax, a comma is actually an "or" operator and our intention was for it to be an "and" like so:
?filter=featured:true+tag:-tutorial
Solution
Support both arrays or a string as a query argument. The array argument should work as it does today and a string argument should be taken literally (this will allow support for filtering syntax).
This support would allow an argument that looks like the below.
filter: "featured:true+tag:-tutorial"
The text was updated successfully, but these errors were encountered:
Summary
Currently we accept a
filter
argument as an array of strings.ghost-graphql/packages/ghost-graphql/src/resolverCreators/createResourceConnectionResolver.ts
Line 23 in a61e740
This is mistakenly prescriptive in that it generates a filter expression with commas (or operators). See filtering syntax.
For example, let's assume we want to get posts that are featured, but are not tagged as
tutorial
. Assuming the negation operator (-
), one may naively come up with an argument like this:filter: ["featured:true", "tag:-tutorial"]
(the outcome of not having any other choice).filter: ["featured:true", "tag:-tutorial"]
from our GraphQL query will actually generate a content API query param like so (this would be URI encoded of course):This is problematic, because in filtering syntax, a comma is actually an "or" operator and our intention was for it to be an "and" like so:
Solution
Support both arrays or a string as a query argument. The array argument should work as it does today and a string argument should be taken literally (this will allow support for filtering syntax).
This support would allow an argument that looks like the below.
The text was updated successfully, but these errors were encountered: