Skip to content
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

Variables not working with Prisma Filters #959

Closed
gmiserez opened this issue Aug 6, 2019 · 1 comment · Fixed by #960
Closed

Variables not working with Prisma Filters #959

gmiserez opened this issue Aug 6, 2019 · 1 comment · Fixed by #960
Assignees
Milestone

Comments

@gmiserez
Copy link
Contributor

gmiserez commented Aug 6, 2019

Hi,

We've recently started using HotChocolate 9.1.0-preview.XX and its PRISMA Filters.
While the filters are mostly working great, we've noticed that we have an issue when the filters are passed as variables instead of directly in the Query.

In short, this works:

query getCitiesStartingWithP{
  cities(first:10, where:{  name_starts_with: "P"}){
    nodes{
      name
    }
  }
}

This doesn't work:

Query:

query getCitiesStartingWithP2($where: CityFilter){
  cities(first:10, where:$where){
    nodes{
      name
    }
  }
}

Variables:

{
  "where":{
    "name_starts_with": "P"
  }
}

Steps to reproduce
1- Clone demo repository from here
2- Run the Hotchocolate endpoint and test the two given queries against it

Expected behavior
Both queries should work

Obtained behavior
getCitiesStartingWithP2 returns his error:

{
  "errors": [
    {
      "message": "Unexpected Execution Error",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "cities"
      ],
      "extensions": {
        "message": "Expression of type 'System.Object' cannot be used for parameter of type 'System.String' of method 'Boolean Contains(System.String)'\r\nParameter name: arg0"
      }
    }
}

Context

  • HotChocolate 9.1.0-preview.42
  • Tested with Altaïr GraphQL Client
@gmiserez
Copy link
Contributor Author

gmiserez commented Aug 6, 2019

I take it it will be solved with this PR?
#960

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants