Skip to content

Commit c3d29f6

Browse files
authored
Merge pull request #8 from twcrews/dev
5.2.1
2 parents ca90f90 + 6a54101 commit c3d29f6

4 files changed

Lines changed: 22 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,23 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [5.2.1] - 2026-02-25
9+
10+
### Fixed
11+
12+
Add missing `[JsonPropertyName]` attributes to properties in the following derived classes:
13+
14+
- `JsonApiResource<T>.Attributes`
15+
- `JsonApiRelationship<T>.Data`
16+
- `JsonApiCollectionRelationship<T>.Data`
17+
18+
### Remarks
19+
20+
This change addresses an oversight in previous versions of the library in which some derived generic class properties were missing the `JsonPropertyName` attribute. This introduced errors in the deserialization and serialization processes:
21+
22+
- Deserialized documents would set the property values for the base class, losing the advantage of the generic type property.
23+
- Serialized documents would produce a second property without the overriding `JsonPropertyName`, falling back to the active `JsonSerializerOptions` instance (if any).
24+
825
## [5.2.0] - 2026-02-25
926

1027
### Changed
@@ -118,6 +135,7 @@ Additionally, this version aims to be more idiomatic by renaming class propertie
118135

119136
Initial release.
120137

138+
[5.2.1]: https://github.com/twcrews/jsonapi-client/compare/5.2.0...5.2.1
121139
[5.2.0]: https://github.com/twcrews/jsonapi-client/compare/5.1.0...5.2.0
122140
[5.1.0]: https://github.com/twcrews/jsonapi-client/compare/5.0.0...5.1.0
123141
[5.0.0]: https://github.com/twcrews/jsonapi-client/compare/4.0.0...5.0.0

Crews.Web.JsonApiClient/Crews.Web.JsonApiClient.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<PropertyGroup>
1111
<PackageId>Crews.Web.JsonApiClient</PackageId>
12-
<PackageVersion>5.2.0</PackageVersion>
12+
<PackageVersion>5.2.1</PackageVersion>
1313
<Authors>Tommy Crews</Authors>
1414
<Description>
1515
A library containing serialization models and methods for the JSON:API specification.

Crews.Web.JsonApiClient/JsonApiRelationship.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public record JsonApiRelationship<T> : JsonApiRelationship where T : JsonApiReso
4444
/// <summary>
4545
/// Gets or sets the data payload associated with the response or request.
4646
/// </summary>
47+
[JsonPropertyName("data")]
4748
public new T? Data { get; init; }
4849
}
4950

@@ -59,5 +60,6 @@ public record JsonApiCollectionRelationship<T> : JsonApiRelationship where T : I
5960
/// <summary>
6061
/// Gets or sets the data payload associated with the response or request.
6162
/// </summary>
63+
[JsonPropertyName("data")]
6264
public new T? Data { get; init; }
6365
}

Crews.Web.JsonApiClient/JsonApiResource.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public record JsonApiResource<T> : JsonApiResource
4343
/// <summary>
4444
/// Gets or sets the collection of custom attributes associated with this object.
4545
/// </summary>
46+
[JsonPropertyName("attributes")]
4647
public new T? Attributes { get; init; }
4748
}
4849

0 commit comments

Comments
 (0)