Skip to content

[GraphQL] ExistsFilter does not work #1857

Closed
@IonBazan

Description

@IonBazan

ExistsFilter does not work with GraphQL.

Minimal example:

{
  user(posts:{exists: true}) {
    edges {
      node {
        id
        username
      }
    }
  }
}

Returns all users, not only those, who have any posts.

This is because the filter expects string "true"|"false" or integer 1|0. However, GraphQL expects a boolean there.
The fix seems easy: adding true and false to

if (\in_array($value[self::QUERY_PARAMETER_KEY], ['true', '1', '', null], true)) {
$value = true;
} elseif (\in_array($value[self::QUERY_PARAMETER_KEY], ['false', '0'], true)) {

I will try to provide a PR when I add some test to these cases.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions