Skip to content

Commit 6deb79f

Browse files
committed
Update usages of "paging" with "pagination"
1 parent dccb7c0 commit 6deb79f

File tree

12 files changed

+40
-39
lines changed

12 files changed

+40
-39
lines changed

docs/usage/options.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ options.AllowClientGeneratedIds = true;
2222

2323
## Pagination
2424

25-
The default page size used for all resources can be overridden in options (10 by default). To disable paging, set it to `null`.
25+
The default page size used for all resources can be overridden in options (10 by default). To disable pagination, set it to `null`.
2626
The maximum page size and number allowed from client requests can be set too (unconstrained by default).
2727

2828
You can also include the total number of resources in each response.
@@ -38,7 +38,7 @@ options.IncludeTotalResourceCount = true;
3838
```
3939

4040
To retrieve the total number of resources on secondary and relationship endpoints, the reverse of the relationship must to be available. For example, in `GET /customers/1/orders`, both the relationships `[HasMany] Customer.Orders` and `[HasOne] Order.Customer` must be defined.
41-
If `IncludeTotalResourceCount` is set to `false` (or the inverse relationship is unavailable on a non-primary endpoint), best-effort paging links are returned instead. This means no `last` link and the `next` link only occurs when the current page is full.
41+
If `IncludeTotalResourceCount` is set to `false` (or the inverse relationship is unavailable on a non-primary endpoint), best-effort pagination links are returned instead. This means no `last` link and the `next` link only occurs when the current page is full.
4242

4343
## Relative Links
4444

src/JsonApiDotNetCore.Annotations/Resources/Annotations/LinkTypes.shared.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ public enum LinkTypes
55
{
66
Self = 1 << 0,
77
Related = 1 << 1,
8-
Paging = 1 << 2,
8+
Pagination = 1 << 2,
99
NotConfigured = 1 << 3,
1010
None = 1 << 4,
11-
All = Self | Related | Paging
11+
All = Self | Related | Pagination
1212
}

src/JsonApiDotNetCore/Configuration/IJsonApiOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public interface IJsonApiOptions
9999
bool IncludeTotalResourceCount { get; }
100100

101101
/// <summary>
102-
/// The page size (10 by default) that is used when not specified in query string. Set to <c>null</c> to not use paging by default.
102+
/// The page size (10 by default) that is used when not specified in query string. Set to <c>null</c> to not use pagination by default.
103103
/// </summary>
104104
PageSize? DefaultPageSize { get; }
105105

src/JsonApiDotNetCore/Queries/IPaginationContext.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@
33
namespace JsonApiDotNetCore.Queries;
44

55
/// <summary>
6-
/// Tracks values used for pagination, which is a combined effort from options, query string parsing and fetching the total number of rows.
6+
/// Tracks values used for top-level pagination, which is a combined effort from options, query string parsing, resource definition callbacks and
7+
/// fetching the total number of rows.
78
/// </summary>
89
public interface IPaginationContext
910
{
1011
/// <summary>
11-
/// The value 1, unless specified from query string. Never null. Cannot be higher than options.MaximumPageNumber.
12+
/// The value 1, unless overridden from query string or resource definition. Should not be higher than <see cref="IJsonApiOptions.MaximumPageNumber" />.
1213
/// </summary>
1314
PageNumber PageNumber { get; set; }
1415

1516
/// <summary>
16-
/// The default page size from options, unless specified in query string. Can be <c>null</c>, which means no paging. Cannot be higher than
17-
/// options.MaximumPageSize.
17+
/// The default page size from options, unless overridden from query string or resource definition. Should not be higher than
18+
/// <see cref="IJsonApiOptions.MaximumPageSize" />. Can be <c>null</c>, which means pagination is disabled.
1819
/// </summary>
1920
PageSize? PageSize { get; set; }
2021

@@ -25,12 +26,12 @@ public interface IPaginationContext
2526
bool IsPageFull { get; set; }
2627

2728
/// <summary>
28-
/// The total number of resources. <c>null</c> when <see cref="IJsonApiOptions.IncludeTotalResourceCount" /> is set to <c>false</c>.
29+
/// The total number of resources, or <c>null</c> when <see cref="IJsonApiOptions.IncludeTotalResourceCount" /> is set to <c>false</c>.
2930
/// </summary>
3031
int? TotalResourceCount { get; set; }
3132

3233
/// <summary>
33-
/// The total number of resource pages. <c>null</c> when <see cref="IJsonApiOptions.IncludeTotalResourceCount" /> is set to <c>false</c> or
34+
/// The total number of resource pages, or <c>null</c> when <see cref="IJsonApiOptions.IncludeTotalResourceCount" /> is set to <c>false</c> or
3435
/// <see cref="PageSize" /> is <c>null</c>.
3536
/// </summary>
3637
int? TotalPageCount { get; }

src/JsonApiDotNetCore/QueryStrings/Internal/PaginationQueryStringParameterReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public virtual void Read(string parameterName, StringValues parameterValue)
7373
}
7474
catch (QueryParseException exception)
7575
{
76-
throw new InvalidQueryStringParameterException(parameterName, "The specified paging is invalid.", exception.Message, exception);
76+
throw new InvalidQueryStringParameterException(parameterName, "The specified pagination is invalid.", exception.Message, exception);
7777
}
7878
}
7979

src/JsonApiDotNetCore/Resources/IResourceDefinition.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public interface IResourceDefinition<TResource, in TId>
6060
/// An optional existing pagination, coming from query string. Can be <c>null</c>.
6161
/// </param>
6262
/// <returns>
63-
/// The changed pagination, or <c>null</c> to use the first page with default size from options. To disable paging, set
63+
/// The changed pagination, or <c>null</c> to use the first page with default size from options. To disable pagination, set
6464
/// <see cref="PaginationExpression.PageSize" /> to <c>null</c>.
6565
/// </returns>
6666
PaginationExpression? OnApplyPagination(PaginationExpression? existingPagination);

src/JsonApiDotNetCore/Serialization/Response/LinkBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private static string NoAsyncSuffix(string actionName)
8585
links.Related = GetLinkForRelationshipRelated(_request.PrimaryId!, _request.Relationship);
8686
}
8787

88-
if (_request.IsCollection && _paginationContext.PageSize != null && ShouldIncludeTopLevelLink(LinkTypes.Paging, resourceType))
88+
if (_request.IsCollection && _paginationContext.PageSize != null && ShouldIncludeTopLevelLink(LinkTypes.Pagination, resourceType))
8989
{
9090
SetPaginationInTopLevelLinks(resourceType!, links);
9191
}

test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/PaginationWithTotalCountTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
8888

8989
ErrorObject error = responseDocument.Errors[0];
9090
error.StatusCode.Should().Be(HttpStatusCode.BadRequest);
91-
error.Title.Should().Be("The specified paging is invalid.");
91+
error.Title.Should().Be("The specified pagination is invalid.");
9292
error.Detail.Should().Be("This query string parameter can only be used on a collection of resources (not on a single resource).");
9393
error.Source.ShouldNotBeNull();
9494
error.Source.Parameter.Should().Be("page[number]");
@@ -185,7 +185,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
185185

186186
ErrorObject error = responseDocument.Errors[0];
187187
error.StatusCode.Should().Be(HttpStatusCode.BadRequest);
188-
error.Title.Should().Be("The specified paging is invalid.");
188+
error.Title.Should().Be("The specified pagination is invalid.");
189189
error.Detail.Should().Be("This query string parameter can only be used on a collection of resources (not on a single resource).");
190190
error.Source.ShouldNotBeNull();
191191
error.Source.Parameter.Should().Be("page[size]");
@@ -463,7 +463,7 @@ public async Task Cannot_paginate_in_unknown_scope()
463463

464464
ErrorObject error = responseDocument.Errors[0];
465465
error.StatusCode.Should().Be(HttpStatusCode.BadRequest);
466-
error.Title.Should().Be("The specified paging is invalid.");
466+
error.Title.Should().Be("The specified pagination is invalid.");
467467
error.Detail.Should().Be($"Relationship '{Unknown.Relationship}' does not exist on resource type 'webAccounts'.");
468468
error.Source.ShouldNotBeNull();
469469
error.Source.Parameter.Should().Be("page[number]");
@@ -485,7 +485,7 @@ public async Task Cannot_paginate_in_unknown_nested_scope()
485485

486486
ErrorObject error = responseDocument.Errors[0];
487487
error.StatusCode.Should().Be(HttpStatusCode.BadRequest);
488-
error.Title.Should().Be("The specified paging is invalid.");
488+
error.Title.Should().Be("The specified pagination is invalid.");
489489
error.Detail.Should().Be($"Relationship '{Unknown.Relationship}' in 'posts.{Unknown.Relationship}' does not exist on resource type 'blogPosts'.");
490490
error.Source.ShouldNotBeNull();
491491
error.Source.Parameter.Should().Be("page[size]");
@@ -528,7 +528,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
528528
}
529529

530530
[Fact]
531-
public async Task Returns_all_resources_when_paging_is_disabled()
531+
public async Task Returns_all_resources_when_pagination_is_disabled()
532532
{
533533
// Arrange
534534
var options = (JsonApiOptions)_testContext.Factory.Services.GetRequiredService<IJsonApiOptions>();

test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/RangeValidationTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public async Task Cannot_use_negative_page_number()
4242

4343
ErrorObject error = responseDocument.Errors[0];
4444
error.StatusCode.Should().Be(HttpStatusCode.BadRequest);
45-
error.Title.Should().Be("The specified paging is invalid.");
45+
error.Title.Should().Be("The specified pagination is invalid.");
4646
error.Detail.Should().Be("Page number cannot be negative or zero.");
4747
error.Source.ShouldNotBeNull();
4848
error.Source.Parameter.Should().Be("page[number]");
@@ -64,7 +64,7 @@ public async Task Cannot_use_zero_page_number()
6464

6565
ErrorObject error = responseDocument.Errors[0];
6666
error.StatusCode.Should().Be(HttpStatusCode.BadRequest);
67-
error.Title.Should().Be("The specified paging is invalid.");
67+
error.Title.Should().Be("The specified pagination is invalid.");
6868
error.Detail.Should().Be("Page number cannot be negative or zero.");
6969
error.Source.ShouldNotBeNull();
7070
error.Source.Parameter.Should().Be("page[number]");
@@ -123,7 +123,7 @@ public async Task Cannot_use_negative_page_size()
123123

124124
ErrorObject error = responseDocument.Errors[0];
125125
error.StatusCode.Should().Be(HttpStatusCode.BadRequest);
126-
error.Title.Should().Be("The specified paging is invalid.");
126+
error.Title.Should().Be("The specified pagination is invalid.");
127127
error.Detail.Should().Be("Page size cannot be negative.");
128128
error.Source.ShouldNotBeNull();
129129
error.Source.Parameter.Should().Be("page[size]");

test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Pagination/RangeValidationWithMaximumTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public async Task Cannot_use_page_number_over_maximum()
7171

7272
ErrorObject error = responseDocument.Errors[0];
7373
error.StatusCode.Should().Be(HttpStatusCode.BadRequest);
74-
error.Title.Should().Be("The specified paging is invalid.");
74+
error.Title.Should().Be("The specified pagination is invalid.");
7575
error.Detail.Should().Be($"Page number cannot be higher than {MaximumPageNumber}.");
7676
error.Source.ShouldNotBeNull();
7777
error.Source.Parameter.Should().Be("page[number]");
@@ -93,7 +93,7 @@ public async Task Cannot_use_zero_page_size()
9393

9494
ErrorObject error = responseDocument.Errors[0];
9595
error.StatusCode.Should().Be(HttpStatusCode.BadRequest);
96-
error.Title.Should().Be("The specified paging is invalid.");
96+
error.Title.Should().Be("The specified pagination is invalid.");
9797
error.Detail.Should().Be("Page size cannot be unconstrained.");
9898
error.Source.ShouldNotBeNull();
9999
error.Source.Parameter.Should().Be("page[size]");
@@ -144,7 +144,7 @@ public async Task Cannot_use_page_size_over_maximum()
144144

145145
ErrorObject error = responseDocument.Errors[0];
146146
error.StatusCode.Should().Be(HttpStatusCode.BadRequest);
147-
error.Title.Should().Be("The specified paging is invalid.");
147+
error.Title.Should().Be("The specified pagination is invalid.");
148148
error.Detail.Should().Be($"Page size cannot be higher than {MaximumPageSize}.");
149149
error.Source.ShouldNotBeNull();
150150
error.Source.Parameter.Should().Be("page[size]");

test/JsonApiDotNetCoreTests/UnitTests/Links/LinkInclusionTests.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,37 @@ public sealed class LinkInclusionTests
2121
[InlineData(LinkTypes.NotConfigured, LinkTypes.None, LinkTypes.None)]
2222
[InlineData(LinkTypes.NotConfigured, LinkTypes.Self, LinkTypes.Self)]
2323
[InlineData(LinkTypes.NotConfigured, LinkTypes.Related, LinkTypes.Related)]
24-
[InlineData(LinkTypes.NotConfigured, LinkTypes.Paging, LinkTypes.Paging)]
24+
[InlineData(LinkTypes.NotConfigured, LinkTypes.Pagination, LinkTypes.Pagination)]
2525
[InlineData(LinkTypes.NotConfigured, LinkTypes.All, LinkTypes.All)]
2626
[InlineData(LinkTypes.None, LinkTypes.NotConfigured, LinkTypes.None)]
2727
[InlineData(LinkTypes.None, LinkTypes.None, LinkTypes.None)]
2828
[InlineData(LinkTypes.None, LinkTypes.Self, LinkTypes.None)]
2929
[InlineData(LinkTypes.None, LinkTypes.Related, LinkTypes.None)]
30-
[InlineData(LinkTypes.None, LinkTypes.Paging, LinkTypes.None)]
30+
[InlineData(LinkTypes.None, LinkTypes.Pagination, LinkTypes.None)]
3131
[InlineData(LinkTypes.None, LinkTypes.All, LinkTypes.None)]
3232
[InlineData(LinkTypes.Self, LinkTypes.NotConfigured, LinkTypes.Self)]
3333
[InlineData(LinkTypes.Self, LinkTypes.None, LinkTypes.Self)]
3434
[InlineData(LinkTypes.Self, LinkTypes.Self, LinkTypes.Self)]
3535
[InlineData(LinkTypes.Self, LinkTypes.Related, LinkTypes.Self)]
36-
[InlineData(LinkTypes.Self, LinkTypes.Paging, LinkTypes.Self)]
36+
[InlineData(LinkTypes.Self, LinkTypes.Pagination, LinkTypes.Self)]
3737
[InlineData(LinkTypes.Self, LinkTypes.All, LinkTypes.Self)]
3838
[InlineData(LinkTypes.Related, LinkTypes.NotConfigured, LinkTypes.Related)]
3939
[InlineData(LinkTypes.Related, LinkTypes.None, LinkTypes.Related)]
4040
[InlineData(LinkTypes.Related, LinkTypes.Self, LinkTypes.Related)]
4141
[InlineData(LinkTypes.Related, LinkTypes.Related, LinkTypes.Related)]
42-
[InlineData(LinkTypes.Related, LinkTypes.Paging, LinkTypes.Related)]
42+
[InlineData(LinkTypes.Related, LinkTypes.Pagination, LinkTypes.Related)]
4343
[InlineData(LinkTypes.Related, LinkTypes.All, LinkTypes.Related)]
44-
[InlineData(LinkTypes.Paging, LinkTypes.NotConfigured, LinkTypes.Paging)]
45-
[InlineData(LinkTypes.Paging, LinkTypes.None, LinkTypes.Paging)]
46-
[InlineData(LinkTypes.Paging, LinkTypes.Self, LinkTypes.Paging)]
47-
[InlineData(LinkTypes.Paging, LinkTypes.Related, LinkTypes.Paging)]
48-
[InlineData(LinkTypes.Paging, LinkTypes.Paging, LinkTypes.Paging)]
49-
[InlineData(LinkTypes.Paging, LinkTypes.All, LinkTypes.Paging)]
44+
[InlineData(LinkTypes.Pagination, LinkTypes.NotConfigured, LinkTypes.Pagination)]
45+
[InlineData(LinkTypes.Pagination, LinkTypes.None, LinkTypes.Pagination)]
46+
[InlineData(LinkTypes.Pagination, LinkTypes.Self, LinkTypes.Pagination)]
47+
[InlineData(LinkTypes.Pagination, LinkTypes.Related, LinkTypes.Pagination)]
48+
[InlineData(LinkTypes.Pagination, LinkTypes.Pagination, LinkTypes.Pagination)]
49+
[InlineData(LinkTypes.Pagination, LinkTypes.All, LinkTypes.Pagination)]
5050
[InlineData(LinkTypes.All, LinkTypes.NotConfigured, LinkTypes.All)]
5151
[InlineData(LinkTypes.All, LinkTypes.None, LinkTypes.All)]
5252
[InlineData(LinkTypes.All, LinkTypes.Self, LinkTypes.All)]
5353
[InlineData(LinkTypes.All, LinkTypes.Related, LinkTypes.All)]
54-
[InlineData(LinkTypes.All, LinkTypes.Paging, LinkTypes.All)]
54+
[InlineData(LinkTypes.All, LinkTypes.Pagination, LinkTypes.All)]
5555
[InlineData(LinkTypes.All, LinkTypes.All, LinkTypes.All)]
5656
public void Applies_cascading_settings_for_top_level_links(LinkTypes linksInResourceType, LinkTypes linksInOptions, LinkTypes expected)
5757
{
@@ -117,7 +117,7 @@ public void Applies_cascading_settings_for_top_level_links(LinkTypes linksInReso
117117
topLevelLinks.Related.Should().BeNull();
118118
}
119119

120-
if (expected.HasFlag(LinkTypes.Paging))
120+
if (expected.HasFlag(LinkTypes.Pagination))
121121
{
122122
topLevelLinks.First.ShouldNotBeNull();
123123
topLevelLinks.Last.ShouldNotBeNull();

test/JsonApiDotNetCoreTests/UnitTests/QueryStringParameters/PaginationParseTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public void Reader_Read_Page_Number_Fails(string parameterValue, string errorMes
8282

8383
ErrorObject error = exception.Errors[0];
8484
error.StatusCode.Should().Be(HttpStatusCode.BadRequest);
85-
error.Title.Should().Be("The specified paging is invalid.");
85+
error.Title.Should().Be("The specified pagination is invalid.");
8686
error.Detail.Should().Be(errorMessage);
8787
error.Source.ShouldNotBeNull();
8888
error.Source.Parameter.Should().Be("page[number]");
@@ -118,7 +118,7 @@ public void Reader_Read_Page_Size_Fails(string parameterValue, string errorMessa
118118

119119
ErrorObject error = exception.Errors[0];
120120
error.StatusCode.Should().Be(HttpStatusCode.BadRequest);
121-
error.Title.Should().Be("The specified paging is invalid.");
121+
error.Title.Should().Be("The specified pagination is invalid.");
122122
error.Detail.Should().Be(errorMessage);
123123
error.Source.ShouldNotBeNull();
124124
error.Source.Parameter.Should().Be("page[size]");

0 commit comments

Comments
 (0)