I am getting the error "Validation error of type FieldsConflict" when i am not using aliases in my request. kindly confirm if this is expected or if there is a workaround
{
person(search: [{firstname: "DAN", lastname: "WATLER", country: "FRANCE"}])
{
firstname
lastname
country
age
address
}
person(search: [{firstname: "FRANK", lastname: "TEE", country: "FRANCE"}])
{
firstname
lastname
country
age
address
}
}
Above code gives validation error but if I use aliases shown below, error doesn't come and I get successful response.
I dont want to use aliases, please suggest if any workaround. Thanks !
{
dan: person(search: [{firstname: "DAN", lastname: "WATLER", country: "FRANCE"}])
{
firstname
lastname
country
age
address
}
frank: person(search: [{firstname: "FRANK", lastname: "TEE", country: "FRANCE"}])
{
firstname
lastname
country
age
address
}
}
Usually
GraphQL
returns data as JSON objects, and it is not possible to have 2 (valid) objects in a JSON document with the same key (in your caseperson
). Hence, it is pretty impossible to achieve what you are describing.The result of your first query would be something like:
And that is why you have to use
alias
.Another option would be to see if the GraphQL server has a query that returns a list of
person
and the result would be inside of an array, like: