json-api-dotnet / JsonApiDotNetCore

A framework for building JSON:API compliant REST APIs using ASP.NET and Entity Framework Core.
https://www.jsonapi.net
MIT License
662 stars 160 forks source link

Fixed: return empty object instead of data:null in operation results #1564

Closed bkoelman closed 3 weeks ago

bkoelman commented 3 weeks ago

According to the spec at https://jsonapi.org/ext/atomic/:

An empty result object ({}) is acceptable for operations that are not required to return data.

This PR changes the response to align with the spec by returning an empty object instead of { "data": null }.

QUALITY CHECKLIST

codecov[bot] commented 3 weeks ago

Codecov Report

Attention: Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.

Project coverage is 90.81%. Comparing base (0941d7c) to head (81b82ad).

Files Patch % Lines
...ation/JsonConverters/WriteOnlyDocumentConverter.cs 72.72% 2 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1564 +/- ## ========================================== - Coverage 90.83% 90.81% -0.02% ========================================== Files 348 348 Lines 11158 11168 +10 Branches 1828 1831 +3 ========================================== + Hits 10135 10142 +7 - Misses 673 675 +2 - Partials 350 351 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.