Skip to content

Fix regression when query keys filter is not applied to the fetch query #515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ public PagedResult<Object> get(DataFetchingEnvironment environment) {
);

if (!queryKeys.isEmpty()) {
pagedResult.withSelect(
queryFactory.queryResultList(environment, maxResults, restrictedKeys.get())
);
pagedResult.withSelect(queryFactory.queryResultList(environment, maxResults, queryKeys));
} else {
pagedResult.withSelect(List.of());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1054,4 +1054,33 @@ public void testGraphqlTasksQueryWithEmbeddedVariablesWhereCriteria() throws Int

assertThat(result.toString()).isEqualTo(expected);
}

@Test
void testGraphqlTasksQueryWithAliases() {
// @formatter:off
String query ="""
query {
page1: Tasks(page: {start: 1, limit: 2}) {
select {
id
name
}
}
page2: Tasks(page: {start: 3, limit: 2}) {
select {
id
name
}
}
}
""";
// @formatter:on

Object result = executor.execute(query).getData();

String expected =
"{page1={select=[{id=1, name=task1}, {id=2, name=task2}]}, page2={select=[{id=5, name=task5}, {id=6, name=task6}]}}";

assertThat(result.toString()).isEqualTo(expected);
}
}