-
-
Notifications
You must be signed in to change notification settings - Fork 799
Open
Labels
Milestone
Description
Product
Hot Chocolate
Version
15.1.11
Link to minimal reproduction
https://github.com/tomasjancicka/HotChocolate-RelativeCursors-bug
Steps to reproduce
- Configure global paging options:
builder.Services
.AddGraphQLServer()
.ModifyPagingOptions(opt =>
{
opt.MaxPageSize = 5;
});
- Configure per case options:
[UseConnection(MaxPageSize = 3)] - Execute a query with first: 10
query {
testGlobalPagingOptions(first: 10, after: null, last: null, before: null) {
edges {
cursor
node {
id
timestamp
value
}
}
pageInfo {
endCursor
hasNextPage
hasPreviousPage
startCursor
}
}
}
- Execute a second query with first: 5
query {
testPerCasePagingOptions(first: 5, after: null, last: null, before: null) {
edges {
cursor
node {
id
timestamp
value
}
}
pageInfo {
endCursor
hasNextPage
hasPreviousPage
startCursor
}
}
}
What is expected?
MaxPageSize (global or per case) should limit the number of items returned for PageConnection.
Expected response should be similar to this:
{
"errors": [
{
"message": "The maximum allowed items per page were exceeded.",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"testGlobalPagingOptions"
],
"extensions": {
"code": "HC0051",
"fieldCoordinate": "Query.testGlobalPagingOptions",
"requestedItems": 10,
"maxAllowedItems": 5
}
}
],
"data": {
"testGlobalPagingOptions": null
}
}
What is actually happening?
MaxPageSize option is ignored for PageConnection for both global configuration by .ModifyPagingOptions(...) and per case configuration[UseConnection(MaxPageSize = 3)]. The response contains the request number of items even though it exceeds the set limit.
Relevant log output
Additional context
No response