Skip to content

Releases

v5.12.0

Choose a tag to compare

@bkoelman bkoelman released this 09 Oct 23:42
5b578fc

New features and enhancements

This release brings the following minor convenience changes:

  • Errors in multiple query string parameters are now aggregated (instead of returning only the first error).
  • A new method is provided to suppress the "does not implement 'IIdentifiable'" warning for DbContext entities that can't be annotated with [NoResource] because they are defined in a third-party assembly (typically the entities from ASP.NET Core Identity).
    Example usage:
    builder.Services.AddJsonApi<AppDbContext>(resources: resourceGraphBuilder =>
        resourceGraphBuilder.SuppressWarningNotIdentifiable<IdentityRole>());
  • Deleting a resource from an optional one-to-one relationship is now fully working on SQL Server, even in complex database models with multiple foreign keys, cyclic dependencies, etc. This fixes errors like: update or delete on table "(table_name)" violates foreign key (fk_name). JsonApiDotNetCore now scans the foreign key dependency tree in the DbContext model and loads all the needed related entities in the change tracker upfront, so that EF Core can issue update statements (setting remote foreign keys to null) before deletion.
  • Transient failures in atomic:operations transactions are now retryable. This is opt-in for regular API projects, while enabled by default in Aspire projects.
  • DapperExample was updated to support Microting.EntityFrameworkCore.MySql to create the database, aside from the abandoned Pomelo NuGet package.

Breaking changes

  • As announced in #2059, we discontinued OpenAPI support and deprecated its experimental packages.
  • The entity mappings in your DbContext for publicly exposed resource types are now validated for common pitfalls: ClientSetNull (except for SQL Server) and Identifying FKs. You can downgrade the new startup error to logged warnings by setting ThrowForProblematicEntityMappings to false in AddJsonApi() options.
  • To support retryable transactions, the public IOperationsTransactionFactory interface has changed.
  • The dependency on Ben.Demystifier has been removed because built-in exception stack traces have improved over the years, and this package is no longer maintained.

Bugfixes

  • When a transaction commit failed in an atomic:operations request, the source pointer in the error response was incorrect.

Merged PRs

New Contributors

Full Changelog: v5.11.0...v5.12.0

v5.11.0

Choose a tag to compare

@bkoelman bkoelman released this 22 May 23:36
4f39936

New features and enhancements

This release adds more ways to use functions in filter query strings (see #1881). Additionally, the request pipeline is optimized to eliminate COUNT(*) SQL queries when pagination is disabled, while the new JsonApiResourceService.CanIncludeTotalResourceCount virtual method enables skipping these SQL queries based on additional user-defined logic.

OpenAPI preview 8 comes with support for [DisableQueryString] and [HasMany(DisablePagination = true)].

Breaking changes

  • As a result of request pipeline optimization, the order in which resource definition callbacks execute has changed slightly (see #1915).
  • The incorrect [DisallowNull] on the id parameter of IResourceWriteRepository.GetForCreateAsync has been removed.
  • The relaxed variants of JSON:API media types have been deprecated, now that both NSwag and Kiota can properly handle JSON:API extensions. While they are still accepted, they are no longer emitted when generating OpenAPI documents. Our extension spec has been updated.

Bugfixes

  • Fixed an incorrect HTTP 415 response in content negotiation with JSON:API extensions.
  • When the AllowView capability on HasOne is turned off, HTTP GET requests to secondary/relationship endpoints are now blocked.
  • OpenAPI: Links for filter/page/sort are no longer generated for endpoints that return a single resource/identifier.
  • OpenAPI: Not all relationship capabilities were properly reflected in the generated OpenAPI document.

Merged PRs

New Contributors

Full Changelog: v5.10.0...v5.11.0

v5.10.0

Choose a tag to compare

@bkoelman bkoelman released this 27 Nov 00:37
22bb659

New features and enhancements

This release adds support for .NET 10 and Entity Framework Core 10.

OpenAPI preview 7 can now produce OpenAPI 3.1 documents:

builder.Services.Configure<SwaggerOptions>(options =>
    options.OpenApiVersion = OpenApiSpecVersion.OpenApi3_1);

Merged PRs

  • Add OpenAPI tests for using various attribute data types by @bkoelman in #1832
  • Added support for EF Core 10 on .NET 10 by @bkoelman in #1853

Full Changelog: v5.9.1...v5.10.0

v5.9.1

Choose a tag to compare

@bkoelman bkoelman released this 25 Oct 09:49
e5680ad

This patch lowers the minimally required version of Microsoft.CodeAnalysis from 4.13.0 to 4.8.0, to enable building projects with older .NET 8 SDK versions on Ubuntu. The assembly is used to generate controller classes at compile time.

There's no need to update, unless you get build warnings similar to the following:

CSC : warning CS9057: The analyzer assembly '/path/to/JsonApiDotNetCore.SourceGenerators.dll' references version '4.13.0.0' of the compiler, which is newer than the currently running version '4.12.0.0'.

Merged PRs

Full Changelog: v5.9.0...v5.9.1

v5.9.0

Choose a tag to compare

@bkoelman bkoelman released this 22 Oct 03:29
14b4b65

New features and enhancements

This release enables the use of derived relationships in query strings for all query string parameters; what used to work only for include, now also works for filter[], sort[], and page.

The sample for using obfuscated IDs has been updated to include atomic operations, and it uses the new [HideResourceIdTypeInOpenApi] to show IDs as string in OpenAPI.

The controller source generator has been updated to use the newer incremental API, improving IDE responsiveness in large solutions.

OpenAPI preview 5 includes the following fixes and enhancements:

  • Custom action methods in JSON:API controllers now show up in OpenAPI.
  • Fixed a crash that could occur with specific relationship naming patterns.
  • An exception is thrown at startup if you forgot to update our OpenAPI NuGet package.

Breaking changes

  • The new source generator requires a recent version of the .NET SDK to build your project.

Merged PRs

  • Allow derived inclusion chains in filter/sort/page query strings by @bkoelman in #1756
  • Improved ID obfuscation by @bkoelman in #1775
  • Fixed crash where the OpenAPI atomic:operations discriminator key isn't unique per schema ID by @bkoelman in #1776
  • Fixes and optimizations in ToString() calls by @bkoelman in #1780
  • Add OpenAPI support for custom JSON:API action methods by @bkoelman in #1787
  • Switch to incremental source generator API by @bkoelman in #1814
  • Throw at startup when different OpenAPI version is loaded by @bkoelman in #1819

Full Changelog: v5.8.1...v5.9.0

v5.8.1

Choose a tag to compare

@bkoelman bkoelman released this 08 Aug 00:31
4748bcc

This patch fixes the following crash at startup:

System.IO.FileNotFoundException: 'Could not load file or assembly 'JetBrains.Annotations, Version=4242.42.42.42, Culture=neutral, PublicKeyToken=1010a0d8d6380325'. The system cannot find the file specified.'

Merged PRs

  • Fix roundtrip of Parse/ToString for include query string parameters by @bkoelman in #1754
  • Revert package update of JetBrains.Annotations by @bkoelman in #1755

Full Changelog: v5.8.0...v5.8.1

v5.8.0

Choose a tag to compare

@bkoelman bkoelman released this 06 Aug 13:17
143e6b1

Since we fixed the bug in v5.7.0 where pagination was not applied on included derived types, we received reports of slow query performance for complex queries on type hierarchies. This release provides various optimizations to address the problem:

  • When pagination is turned off, implicit sort by ID is no longer added to the query.
  • Redundant selectors are eliminated from the final query.
  • Pagination can be turned off per relationship using [HasMany(DisablePagination = true)], which overrules global settings.

OpenAPI preview 3 includes the following fixes and enhancements:

  • Non-JSON:API endpoints (both Controllers and Minimal APIs) are now included in the OpenAPI document.
  • Calling AddOpenApiForJsonApi() no longer changes the expected content type for regular JSON:API requests.
  • Improved error when AddJsonApi()/AddOpenApiForJsonApi() aren't called in the expected order.
  • Refactored an internal workaround to support dotnet swagger, such that the workaround is no longer needed.
  • Fixed error when concurrent requests download the OpenAPI document.

Merged PRs

Full Changelog: v5.7.1...v5.8.0

v5.7.1

Choose a tag to compare

@bkoelman bkoelman released this 26 Apr 23:29
b45b3ff

This patch:

  • Fixes a build error when using Kiota without any OpenAPI references.
  • Fixes compatibility with MongoDB.
  • Removes the Experimental attribute from the AddOpenApiForJsonApi extension method.
  • Reverts an unintentional binary breaking change in QueryTokenizer.

Merged PRs

  • Publish packages to feedz.io by @bkoelman in #1719
  • Improve detection of collection element type by @bkoelman in #1720
  • Fixed: build error after adding reference to JADNC.Kiota package by @bkoelman in #1721
  • Remove Experimental attribute from AddOpenApiForJsonApi by @bkoelman in #1724

Full Changelog: v5.7.0...v5.7.1

v5.7.0

Choose a tag to compare

@bkoelman bkoelman released this 21 Apr 14:15
a7b8a3e

New features and enhancements

After years of work, we're finally ready to ship the first preview release of OpenAPI support for JSON:API!

Now you can generate a documentation website from your models. And generate typed client libraries using NSwag and Microsoft Kiota. See the documentation to get started. In this preview, all JsonApiDotNetCore features work with OpenAPI, except for the following:

  • Custom controllers and custom action methods are ignored.
  • Controllers that use ID obfuscation don't work.
  • The usage of [DisableQueryString] on controllers is ignored.

As part of the OpenAPI work, basic support for third-party JSON:API extensions was added. We also introduced our own extension to enhance the OpenAPI experience.

Next to the existing IAtomicOperationFilter, IJsonApiEndpointFilter was added, which enables to remove controller action methods at runtime.

Breaking changes

  • This version requires .NET 8 or higher, because official support for .NET 6 has ended.
  • Properties on HeaderConstants have been obsoleted; see their message for the replacement.
  • The relaxed form "atomic-operations" for the Atomic Operations JSON:API extension was renamed to "atomic" for consistency.

Bugfixes

  • A proper error is now returned when the ID in a request body is an empty string or whitespace.
  • Resource inheritance: Atomic operations enabled on a base type are implicitly enabled on all derived types.
  • Resource inheritance: Pagination on included derived types wasn't being applied.
  • Resource inheritance: A post-resource request with ?include used to fail.
  • The calculation of the total resource count on a secondary/relationship endpoint could crash when resource definitions are involved.

Merged PRs

  • Fixed: Produce error on invalid ID in request body by @bkoelman in #1593
  • Basic support for third-party JSON:API extensions by @bkoelman in #1623
  • Fix resource inheritance with atomic operations by @bkoelman in #1628
  • Refactorings for JSON:API extensions to unblock OpenAPI support by @bkoelman in #1629
  • Resource inheritance fixes by @bkoelman in #1641
  • Content negotiation: Enable override of chosen media type when Accept header is missing by @bkoelman in #1644
  • IJsonApiEndpointFilter: remove controller action methods at runtime by @bkoelman in #1646
  • Drop support for .NET 6, test against .NET 9 by @bkoelman in #1656
  • Breaking: rename relaxed form of Atomic Operations extension by @bkoelman in #1664
  • Add note about shared models by @bkoelman in #1679
  • Refactor internal-only JSON:API extensions support by @bkoelman in #1687
  • Marshall JsonApiException thrown from JsonConverter by @bkoelman in #1690
  • Fix invalid expression for total count on inverse relationship filter from resource definition by @bkoelman in #1711
  • Merge experimental OpenAPI support into master by @bkoelman in #1716

Full Changelog: v5.6.0...v5.7.0

v5.6.0

Choose a tag to compare

@bkoelman bkoelman released this 30 Jun 19:17
ee41f12

New features and enhancements

Aside from a new logo (which was needed to enable dark mode on the documentation website), most of the changes involve unblocking our ongoing development of OpenAPI support for JSON:API. Please read the docs and give it a try (see the instructions for NSwag and Kiota), we'd love to hear your feedback.

  • The describedby top-level link has been added, whose visibility can be configured at various levels. Its value can be set by implementing IDocumentDescriptionLinkProvider.
  • Controller action methods have been enriched with [Required], pipeline methods with [DisallowNull] for id parameters.
  • A relaxed variant of the atomic operations media type can be used, to workaround deficiencies in OpenAPI client generators.

Breaking changes

  • When your project contains an atomic operations controller, earlier versions would always expose all operations for all resource types, despite the use of [Resource(GenerateControllerEndpoints = ...)] to constrain endpoints. The new behavior is to block operations whose endpoints are blocked using GenerateControllerEndpoints. If you're using custom controllers (or just want to override this default), implement IAtomicOperationFilter. To revert to the old behavior, use IAtomicOperationFilter.AlwaysEnabled.

Bugfixes

  • Fix crash on empty query string parameter name. For example: http://localhost:5065/people?=.
  • Fix percent-encoding of whitespace in response links. For example: equals(city,%27New York%27) equals(city,%27New%20York%27).
  • Return empty object ({}) instead of { "data": null } in atomic operation results.
  • Do not allow lid in atomic operations request when a client-generated ID is required.
  • Take options.UseRelativeLinks into account when rendering HTTP Location header.

Merged PRs

  • Replace CreateTupleAccessExpressionForConstant with simpler implementation by @bkoelman in #1469
  • Don't crash on empty query string parameter name by @verdie-g in #1484
  • Drop dependency on EF Core internals by @bkoelman in #1492
  • Enable setting the "describedby" top-level link by @bkoelman in #1495
  • Controller attribute changes by @bkoelman in #1503
  • Move back [FromBody] and [Required] to derived controllers by @bkoelman in #1506
  • Move [FromBody] back on base controllers, to prevent a breaking change by @bkoelman in #1508
  • Revert "Resharper: Replace async method with Task return" by @bkoelman in #1513
  • Add support for configuring the visibility of the "describedby" link by @bkoelman in #1516
  • Fix whitespace in query string parameters within pagination links by @bkoelman in #1526
  • New logo, dark mode on landing page by @bkoelman in #1549
  • Allow relaxed Content-Type for atomic operations by @bkoelman in #1553
  • Filter operations based on GenerateControllerEndpoints usage by @bkoelman in #1561
  • Return Forbidden when operation is inaccessible, to match resource endpoint status code by @bkoelman in #1562
  • Fixed: return empty object instead of data:null in operation results by @bkoelman in #1564
  • Fixed: Do not allow the use of 'lid' when client-generated IDs are required by @bkoelman in #1581
  • Fixed: send absolute/relative URL in location header, depending on options.UseRelativeLinks by @bkoelman in #1582
  • Add [DisallowNull] on TId in pipeline parameters by @bkoelman in #1583

Full Changelog: v5.5.1...v5.6.0