-
Notifications
You must be signed in to change notification settings - Fork 330
Description
Hi,
We are migrating an application to Spring Graphql library from kickstart library, we have working queries/mutations. Our application has several queries to get a list of business entity with an input containing a generic filter object (field, operator and value). This filter input has a value property which is an Object type : depending on the operator (equal or in) it could be a String or a List (or anything else). We have created a GraphQLScalarType Object to represent this field.
We have an issue with this filter input and the scalar type for array values. When we pass an array of values we have this exception (the same works with the kickstart library):
org.springframework.beans.InvalidPropertyException: Invalid property 'value[0]' of bean class [issue.spring.graphql.objectlist.BusinessEntityFilterInput]: Property referenced in indexed property path 'value[0]' is neither an array nor a List nor a Map; returned value was [java.lang.Object@74123110]
There is no issue if the scalar type is used directly as input type.
We pushed a minimal application with tests to reproduce the error :
- clone the repo https://github.com/viico/SpringGraphqlObjectVariableArray
- launch test of
BusinessEntityControllerTestsclass (it is possible to start the application and send queries)
The application contains 2 queries :
filterValueIsInstanceOfListwhich return true if the value of input filter object is instance ofListinputIsInstanceOfListwhich return true if the input is instance ofList
We set up 4 tests :
inputIsInstanceOfList_listValue: working test with a an array of 2 values, the input is an instance ofListfilterValueIsInstanceOfList_stringValue: working test with aStringvalue (return false because it is not an array of values)filterValueIsInstanceOfList_withException: test failing with the exception above when passing aListof 2 valuesfilterValueIsInstanceOfList_withoutVariables: test without exception but with an interrogation, we put the input value directly in the GraphQL query and we have anArrayValueobject, shall we have aListinstead ?
After some research we don't see how to solve this issue (the exception) and finish our migration, could you help us ?
Thanks