Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>.Attributes`
- `JsonApiRelationship<T>.Data`
- `JsonApiCollectionRelationship<T>.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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Crews.Web.JsonApiClient/Crews.Web.JsonApiClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<PropertyGroup>
<PackageId>Crews.Web.JsonApiClient</PackageId>
<PackageVersion>5.2.0</PackageVersion>
<PackageVersion>5.2.1</PackageVersion>
<Authors>Tommy Crews</Authors>
<Description>
A library containing serialization models and methods for the JSON:API specification.
Expand Down
2 changes: 2 additions & 0 deletions Crews.Web.JsonApiClient/JsonApiRelationship.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public record JsonApiRelationship<T> : JsonApiRelationship where T : JsonApiReso
/// <summary>
/// Gets or sets the data payload associated with the response or request.
/// </summary>
[JsonPropertyName("data")]
public new T? Data { get; init; }
}

Expand All @@ -59,5 +60,6 @@ public record JsonApiCollectionRelationship<T> : JsonApiRelationship where T : I
/// <summary>
/// Gets or sets the data payload associated with the response or request.
/// </summary>
[JsonPropertyName("data")]
public new T? Data { get; init; }
}
1 change: 1 addition & 0 deletions Crews.Web.JsonApiClient/JsonApiResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public record JsonApiResource<T> : JsonApiResource
/// <summary>
/// Gets or sets the collection of custom attributes associated with this object.
/// </summary>
[JsonPropertyName("attributes")]
public new T? Attributes { get; init; }
}

Expand Down