I have recently started using the Quarkus SmallRye implementation of GraphQL, and I am encountering this error when running queries. Let's say I have the following query implemented (domain is changed and entities are not complete, for simplicity):
WorkContract(id: "personId") {
startDate
endDate
company {
name
}
}
And this other query:
Person(id: "personId") {
id
name
addresses {
streetName
house
city
}
}
If I run each query separately, I get a successful response containing all the requested data for the provided personId. However, if I query them together like this:
query {
WorkContract(id: "personId") {
startDate
endDate
company {
name
}
}
Person(id: "personId") {
id
name
addresses {
streetName
house
city
}
}
}
The query is executed but there is data missing in the response, namely the addresses field under Person is an empty array (when there are actually addresses stored in the database). This missing data issue happens for all subfields of Person that have nested fields (id and name are correctly retrieved). When debugging it in a unit test, all the data seems to be there in the intermediate POJOs for Contract and Person, so I have no idea why it goes wrong at the very end. Note that Contract and Person have independent repositories and resolvers.
Is this behavior expected? What are the correct steps when implementing the resolvers and repositories so that a query can combine multiple independent entities?
Thanks in advance!