Skip to content

Commit

Permalink
Merge pull request #533 from radixdlt/fix-page-size-validation
Browse files Browse the repository at this point in the history
use same MaxPageSize as default page limit (100). Add validation that…
  • Loading branch information
krzlabrdx authored Oct 11, 2023
2 parents 59075d7 + 8e6f7de commit ae895c0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.0.2 - Babylon
Release Date: _unreleased_

- Changed default configuration value of MaxPageSize for endpoints to 100. Validate if max page size is higher than DefaultPageSize.

## 1.0.1 - Babylon
Release Date: _unreleased_

Expand Down
3 changes: 0 additions & 3 deletions apps/GatewayApi/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
"EnableSwagger": true,

"GatewayApi": {
"Endpoint": {
"MaxPageSize": 30,
},
"AcceptableLedgerLag": {
"PreventReadRequestsIfDbLedgerIsBehind": true,
"ReadRequestAcceptableDbLedgerLagSeconds": 60,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ internal class EndpointOptionsValidator : AbstractOptionsValidator<EndpointOptio
public EndpointOptionsValidator()
{
RuleFor(x => x.MaxPageSize).GreaterThan(0);
RuleFor(x => x.MaxPageSize)
.GreaterThanOrEqualTo(x => x.DefaultPageSize)
.WithMessage("{PropertyName} has to be bigger than {ComparisonProperty}. {PropertyName}:{PropertyValue}, {ComparisonProperty}:{ComparisonValue}");
RuleFor(x => x.DefaultNonFungibleIdsPageSize).GreaterThan(0);
RuleFor(x => x.DefaultTransactionsStreamPageSize).GreaterThan(0);
RuleFor(x => x.RequestTimeout).GreaterThan(TimeSpan.Zero);
Expand Down

0 comments on commit ae895c0

Please sign in to comment.