graphql-platform icon indicating copy to clipboard operation
graphql-platform copied to clipboard

Using IdOperationFilterInputType as field filter type gives error when filtering

Open dalen opened this issue 11 months ago • 2 comments

Product

Hot Chocolate

Version

14.3.0

Link to minimal reproduction

https://github.com/dalen/hotchocolate-reproduction/tree/main/HotChocolateIdFilter

Steps to reproduce

On a filter input type set the filter for a field to .Type<IdOperationFilterInputType>() to make the filter use ID for the field instead of something like Int. Then try to query it.

{
  books(where:  {
     id:  {
        eq: 1
     }
  }) {
    nodes {
      id
      title
    }
  }
}

Response

{
  "errors": [
    {
      "message": "The node ID string has an invalid format.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "books"
      ],
      "extensions": {
        "originalValue": "1"
      }
    }
  ],
  "data": {
    "books": null
  }
}

What is expected?

Expect the filtering to work and convert the ID to the underlying type, just like if you set an attribute to use IdType.

What is actually happening?

Instead I get the above error.

Relevant log output


Additional context

Using id: { eq: "1"} with the ID as a string makes no difference.

dalen avatar Dec 20 '24 13:12 dalen

The error message here is the same as in https://github.com/ChilliCream/graphql-platform/issues/7346

But it seems like a separate (or wider) issue.

dalen avatar Dec 20 '24 13:12 dalen

I ran into this as well, I think the problem is that IdOperationFilterInputType is still trying to deserialize even if you haven't enabled Relay support via AddGlobalObjectIdentification()

rdb00 avatar Mar 18 '25 21:03 rdb00