From 540ab67767ef9566f35b0086b7e7f7b13e5bb23b Mon Sep 17 00:00:00 2001 From: Tommy Crews Date: Wed, 25 Feb 2026 14:05:51 -0600 Subject: [PATCH 1/2] Add missing `JsonPropertyName` attributes. --- Crews.Web.JsonApiClient/JsonApiRelationship.cs | 2 ++ Crews.Web.JsonApiClient/JsonApiResource.cs | 1 + 2 files changed, 3 insertions(+) diff --git a/Crews.Web.JsonApiClient/JsonApiRelationship.cs b/Crews.Web.JsonApiClient/JsonApiRelationship.cs index e6463c6..a20379c 100644 --- a/Crews.Web.JsonApiClient/JsonApiRelationship.cs +++ b/Crews.Web.JsonApiClient/JsonApiRelationship.cs @@ -44,6 +44,7 @@ public record JsonApiRelationship : JsonApiRelationship where T : JsonApiReso /// /// Gets or sets the data payload associated with the response or request. /// + [JsonPropertyName("data")] public new T? Data { get; init; } } @@ -59,5 +60,6 @@ public record JsonApiCollectionRelationship : JsonApiRelationship where T : I /// /// Gets or sets the data payload associated with the response or request. /// + [JsonPropertyName("data")] public new T? Data { get; init; } } \ No newline at end of file diff --git a/Crews.Web.JsonApiClient/JsonApiResource.cs b/Crews.Web.JsonApiClient/JsonApiResource.cs index ae0e7b0..f0ba547 100644 --- a/Crews.Web.JsonApiClient/JsonApiResource.cs +++ b/Crews.Web.JsonApiClient/JsonApiResource.cs @@ -43,6 +43,7 @@ public record JsonApiResource : JsonApiResource /// /// Gets or sets the collection of custom attributes associated with this object. /// + [JsonPropertyName("attributes")] public new T? Attributes { get; init; } } From 6a54101af282120282227dce680253c1803b3f03 Mon Sep 17 00:00:00 2001 From: Tommy Crews Date: Wed, 25 Feb 2026 14:13:06 -0600 Subject: [PATCH 2/2] Bump version and update changelog. --- CHANGELOG.md | 18 ++++++++++++++++++ .../Crews.Web.JsonApiClient.csproj | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 136e87b..337b45f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,23 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [5.2.1] - 2026-02-25 + +### Fixed + +Add missing `[JsonPropertyName]` attributes to properties in the following derived classes: + +- `JsonApiResource.Attributes` +- `JsonApiRelationship.Data` +- `JsonApiCollectionRelationship.Data` + +### Remarks + +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: + +- Deserialized documents would set the property values for the base class, losing the advantage of the generic type property. +- Serialized documents would produce a second property without the overriding `JsonPropertyName`, falling back to the active `JsonSerializerOptions` instance (if any). + ## [5.2.0] - 2026-02-25 ### Changed @@ -118,6 +135,7 @@ Additionally, this version aims to be more idiomatic by renaming class propertie Initial release. +[5.2.1]: https://github.com/twcrews/jsonapi-client/compare/5.2.0...5.2.1 [5.2.0]: https://github.com/twcrews/jsonapi-client/compare/5.1.0...5.2.0 [5.1.0]: https://github.com/twcrews/jsonapi-client/compare/5.0.0...5.1.0 [5.0.0]: https://github.com/twcrews/jsonapi-client/compare/4.0.0...5.0.0 diff --git a/Crews.Web.JsonApiClient/Crews.Web.JsonApiClient.csproj b/Crews.Web.JsonApiClient/Crews.Web.JsonApiClient.csproj index 151f1fd..c10e9ec 100644 --- a/Crews.Web.JsonApiClient/Crews.Web.JsonApiClient.csproj +++ b/Crews.Web.JsonApiClient/Crews.Web.JsonApiClient.csproj @@ -9,7 +9,7 @@ Crews.Web.JsonApiClient - 5.2.0 + 5.2.1 Tommy Crews A library containing serialization models and methods for the JSON:API specification.