Martin Schulze created SLING-13175:
--------------------------------------
Summary: [GraphQL] Duplicate field aliases lose sub-fields present
only in the second alias after SLING-13152
Key: SLING-13175
URL: https://issues.apache.org/jira/browse/SLING-13175
Project: Sling
Issue Type: Bug
Components: GraphQL
Reporter: Martin Schulze
When a GraphQL query uses two aliases for the same fragment-reference field
(e.g. policyTabList: policy and policyTabDetailList: policy), sub-fields
requested exclusively in the second alias are silently dropped from the
response.
Root cause: the SelectedFieldWrapper constructor introduced in the [PR
#45|https://github.com/apache/sling-org-apache-sling-graphql-core/pull/45]
(SLING-13152) merge refactor moved subFieldMap.put() into the else branch, so
duplicate-FQN children were never added to the by-name multimap. This caused
hasDuplicateFieldByName() to return false, making AbstractFetcher resolve the
field against only the first alias's (shallower) selection set. Additionally,
the merge logic was not recursive, so fields nested two or more levels deep
(e.g. policy → policyCategories → policies) were never merged even when the
top-level alias was correctly detected as a duplicate.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)