Skip to content

Releases: json-api-dotnet/JsonApiDotNetCore

v5.1.0

08 Nov 21:01
Compare
Choose a tag to compare

New features and enhancements

The final version of JSON:API v1.1 was released recently, eight years after its initial draft. We've always tried to keep up-to-date with specification changes, and this release follows that tradition. We've slightly adapted JsonApiDotNetCore in corner cases (#1195 and #1196) where the specification used to be ambiguous.

New in this release: capabilities for relationships. Similar to [Attr(Capabilities = ...)], you can now declare what's permitted in requests where relationships are involved: [HasOne(HasOneCapabilities = ...)] and set the default in options. Despite this was already possible by writing custom code in resource definitions (which can still be useful when depending on externally changing conditions), relationship capabilities are just a shorthand for simpler cases. See its documentation and feature design for details.

Based on our own research and experiments, we've updated the guidance on mapping Entity Framework Core one-to-one relationships at https://www.jsonapi.net/usage/resources/relationships.html#one-to-one-relationships-in-entity-framework-core to make JsonApiDotNetCore work properly. In summary, there are two pitfalls to watch out for, where you need to override the default mappings: identifying foreign keys and using DeleteBehavior.SetNull instead of the misleading default DeleteBehavior.ClientSetNull.

You can now share your models (that is, your Entity Framework Core entity classes that are decorated with JsonApiDotNetCore attributes) with .NET Framework code. To accomplish this, move them into a separate, shared project that references only the JsonApiDotNetCore.Annotations package. Aside from targeting .NET Standard 1.0 instead of .NET 6, we've fixed #1198 and #1199.

Breaking changes

Related to the above, we've obsoleted CanInclude on relationships. The equivalent functionality is now covered by relationship capabilities.

Merged PRs

  • Multi-target Annotations against .NET Standard 1.0 by @bkoelman in #1192
  • Improve error message when duplicate controllers found by @bkoelman in #1193
  • Relationship capabilities and bugfixes by @bkoelman in #1197
  • Update EF Core docs for one-to-one relationships by @bkoelman in #1207
  • Updated example to match with current implementation by @bkoelman in #1208

Full Changelog: v5.0.3...v5.1.0

v5.0.3

07 Sep 08:42
98c90ad
Compare
Choose a tag to compare

This patch removes a limitation that blocked future use of EF Core 7, as well as minor tweaks and optimizations.

Merged PRs

  • Minor serialization tweaks by @bkoelman in #1170
  • Remove dependency on EF Core "Issue26779" AppContext switch by @bkoelman in #1176
  • Add // <auto-generated /> comment to source-generated controllers by @bkoelman in #1178

Full Changelog: v5.0.2...v5.0.3

v5.0.2

24 Jun 00:11
84106ac
Compare
Choose a tag to compare

This patch fixes an error when sorting by a base/interface property from a lambda expression in a resource definition.

Merged PRs

  • Fixed crash in sort lambda from generic resource definition by @bkoelman in #1162

Full Changelog: v5.0.1...v5.0.2

v5.0.1

06 Apr 17:11
4dc8115
Compare
Choose a tag to compare

This patch fixes an error when sorting by ID from a lambda expression in a resource definition.

Merged PRs

  • Fixed: Sorting by ID from a lambda expression fails with error by @bkoelman in #1151

Full Changelog: v5.0.0...v5.0.1

v5.0.0

06 Apr 10:05
5831f25
Compare
Choose a tag to compare

New features and enhancements

In addition to what's listed at v5.0.0-pre1, this release adds full support for resource inheritance. In short, this means you can define (abstract) base resource classes and perform various operations against their endpoints. Sparse fieldsets, includes, sorting and filtering were adapted to understand them, among which is the new isType() filter function. When using post/patch/delete in a type hierarchy, extra database queries are executed to provide the best possible experience for writing custom business logic in resource definitions. For details, see documentation at https://www.jsonapi.net/usage/resources/inheritance.html and the PR description. Additionally, this release improves serialization performance and makes resource graph lookups faster.

Note: See our updated documentation, as well as updated examples in our codebase.
Upgrading from v4 instead? Be sure to check out our migration guide.

Breaking changes

Aside from the breaking changes listed at v5.0.0-pre1, we had to slightly adapt some signatures in resource service/repository/definition interfaces to support resource inheritance. And we fixed the bug where we forgot to call into IResourceDefinition.OnPrepareWrite from a delete to-many relationship request.

Merged PRs

Full Changelog: v4.2.0...v5.0.0

v5.0.0-pre1

10 Dec 08:28
b442519
Compare
Choose a tag to compare
v5.0.0-pre1 Pre-release
Pre-release

New features and enhancements

First of all, this release is a refresher to embrace the latest technologies. We've updated to ASP.NET 6 with EF Core 6 and adopted nullable reference types. We've switched to System.Text.Json. And we're now leveraging EF Core's built-in many-to-many relationships. Lastly, ASP.NET controllers can be auto-generated using source generators. Aside from these changes, pagination links at secondary endpoints got better. We've added various performance optimizations. And improved error responses on invalid input. And quite some bug fixes too!

Note: See our updated documentation, as well as updated examples in our codebase.
Upgrading from v4 instead? Be sure to check out our migration guide.

Breaking changes

  • When using [Resource], this now automatically generates a controller class. Replace with [Resource(GenerateControllerEndpoints = JsonApiEndpoints.None)] to turn that off.
  • The experimental Resource Hooks feature has finally been removed.
  • The switch to System.Text.Json introduced breaks as well, see here and here.
  • Short-hand interfaces were removed too.
  • Remaining breaks are listed here, here and here.

Merged PRs

New Contributors

Full Changelog: v4.2.0...v5.0.0-pre1

v4.2.0

23 Jun 13:46
Compare
Choose a tag to compare

New features

See the notes for v4.2.0-beta. The most prominent one: new extensibility points for business logic, documented here and here.
This replaces the experimental Resource Hooks, which we intend to remove in the next major version.

Breaking changes

We had to take a few binary-breaking changes in obscure places. Just recompiling your project should be sufficient in nearly all cases. See our versioning policy.

Closed issues

  • Consecutive exception hides original error (#1017)
  • Bugs around empty included[] in response (#991)
  • Adding extra includes from IResourceDefinition.OnApplyIncludes() does not work (#989)
  • Sending an empty fields parameter results in error (#996)
  • Makes the hashing algorithm used for ETags pluggable (#1007)

v4.2.0-beta

28 May 12:36
Compare
Choose a tag to compare
v4.2.0-beta Pre-release
Pre-release

We're releasing a beta because we want to verify we've done the new business rules extensibility points on IResourceDefinition right (see here and here). Please give it a try and let us know by creating an issue, so we can adapt. Once released, we cannot take breaking changes anymore.

New features

  • Rewrite of LinkBuilder to use ASP.NET Core routing to render links (#987)
  • New business logic extensibility points on IResourceDefinition (#977)
  • New option to emit JSON:API version in response documents (#992)
  • ETag support to save network bandwidth (#933)
  • Allow condition on has() filter function (#985)

Breaking changes

We had to take a few binary breaking changes in obscure places. Just recompiling your project should be sufficient in nearly all cases.

Closed issues

  • Cannot sort resource having a relationship with EagerLoadAttribute (#988)
  • Discovery does not discover injectables not co-located with resources (#995)
  • Assembly scanning does not work with custom open generic registrations (#981)

v4.1.1

18 Mar 16:41
Compare
Choose a tag to compare

New features

Breaking changes

We had to take a few binary breaking changes in obscure places. Just recompiling your project should be sufficient in nearly all cases.

Closed issues

  • Comma-delimited Accept header is not correctly parsed (#970)
  • Use controller type instead of name when mapping endpoints to resources (#966)

v4.1.0

18 Mar 16:22
Compare
Choose a tag to compare

NuGet issues prevented us from publishing this version, so we created v4.1.1 instead.