webonyx / graphql-php

PHP implementation of the GraphQL specification based on the reference implementation in JavaScript
https://webonyx.github.io/graphql-php
MIT License
4.64k stars 564 forks source link

Deep filtering doesn't call parseValue on ScalarType #1619

Closed TomHAnderson closed 5 days ago

TomHAnderson commented 6 days ago

I have a library https://github.com/API-Skeletons/doctrine-orm-graphql that adds filters to types (as well as creates types). This works fine when I query on the root query. But not when I query on a collection.

This works:

{
  performances(filter: { date: { gte: "1995-01-01" } }) {
    edges {
      node {
        date
      }
    }
  }
}

But this doesn't:

{
  artists {
    edges {
      node {
        performances(filter: { date: { gte: "1995-01-01" } }) {
          edges {
            node {
              date
            }
          }
        }
      }
    }
  }
}

Feel free to run this on https://ldog.apiskeletons.dev/graphiql

Now, my code creates two different InputObjectTypes by the same function for these filters but they're both the same Date type for gte. I've exhausted avenues this could be happening in my library.

The problem I'm getting is parseValue of the scalar Date type isn't called in the second query. Can you comment?

spawnia commented 6 days ago

Do the array $args that are passed to the resolver of Query.performances differ from what is passed to the nested field?

TomHAnderson commented 6 days ago

This looks like a problem with my parseLiteral s on my types. Will update when I know for sure.

TomHAnderson commented 5 days ago

That was the problem. I've solved it.