Skip to content

Commit 5f42cf3

Browse files
author
Bart Koelman
committed
Breaking: Renamed "total-resources" meta key to "total" because thats what Ember.js expects it to be named (see https://guides.emberjs.com/release/models/handling-metadata/)
1 parent 7178f26 commit 5f42cf3

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

src/JsonApiDotNetCore/Configuration/IJsonApiOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public interface IJsonApiOptions
7979
LinkTypes RelationshipLinks { get; }
8080

8181
/// <summary>
82-
/// Whether or not the total resource count should be included in all document-level meta objects. False by default.
82+
/// Whether or not the total resource count should be included in top-level meta objects. This requires an additional database query. False by default.
8383
/// </summary>
8484
bool IncludeTotalResourceCount { get; }
8585

src/JsonApiDotNetCore/Serialization/Building/MetaBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public IDictionary<string, object> Build()
4040
{
4141
if (_paginationContext.TotalResourceCount != null)
4242
{
43-
const string keyName = "TotalResources";
43+
const string keyName = "Total";
4444

4545
string key = _options.SerializerOptions.DictionaryKeyPolicy == null
4646
? keyName

test/JsonApiDotNetCoreTests/IntegrationTests/Meta/TopLevelCountTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
5454
httpResponse.Should().HaveStatusCode(HttpStatusCode.OK);
5555

5656
responseDocument.Meta.Should().NotBeNull();
57-
responseDocument.Meta["totalResources"].Should().Be(1);
57+
responseDocument.Meta["total"].Should().Be(1);
5858
}
5959

6060
[Fact]
@@ -75,7 +75,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
7575
httpResponse.Should().HaveStatusCode(HttpStatusCode.OK);
7676

7777
responseDocument.Meta.Should().NotBeNull();
78-
responseDocument.Meta["totalResources"].Should().Be(0);
78+
responseDocument.Meta["total"].Should().Be(0);
7979
}
8080

8181
[Fact]

test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/KebabCasingTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
5757
responseDocument.Included[0].Relationships.Should().BeNull();
5858
responseDocument.Included[0].Links.Self.Should().Be($"/public-api/diving-boards/{pools[1].DivingBoards[0].StringId}");
5959

60-
responseDocument.Meta["total-resources"].Should().Be(2);
60+
responseDocument.Meta["total"].Should().Be(2);
6161
}
6262

6363
[Fact]

test/JsonApiDotNetCoreTests/IntegrationTests/NamingConventions/PascalCasingTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
5757
responseDocument.Included[0].Relationships.Should().BeNull();
5858
responseDocument.Included[0].Links.Self.Should().Be($"/PublicApi/DivingBoards/{pools[1].DivingBoards[0].StringId}");
5959

60-
responseDocument.Meta["TotalResources"].Should().Be(2);
60+
responseDocument.Meta["Total"].Should().Be(2);
6161
}
6262

6363
[Fact]

test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/ResourceDefinitionReadTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
159159
responseDocument.ManyData[0].Id.Should().Be(planets[1].StringId);
160160
responseDocument.ManyData[1].Id.Should().Be(planets[3].StringId);
161161

162-
responseDocument.Meta["totalResources"].Should().Be(2);
162+
responseDocument.Meta["total"].Should().Be(2);
163163

164164
hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[]
165165
{
@@ -208,7 +208,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
208208
responseDocument.ManyData.Should().HaveCount(1);
209209
responseDocument.ManyData[0].Id.Should().Be(planets[3].StringId);
210210

211-
responseDocument.Meta["totalResources"].Should().Be(1);
211+
responseDocument.Meta["total"].Should().Be(1);
212212

213213
hitCounter.HitExtensibilityPoints.Should().BeEquivalentTo(new[]
214214
{

0 commit comments

Comments
 (0)