From f104e06024c20333f2f45739ae0cc869bbe59d21 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Wed, 6 Apr 2022 12:19:09 +0200 Subject: [PATCH 1/3] Increment version number (used for pre-release builds from ci) --- Directory.Build.props | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 3f53c3cd41..5b311343c7 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -6,7 +6,7 @@ 6.0.* 4.1.* 2.14.1 - 5.0.0 + 5.0.1 $(MSBuildThisFileDirectory)CodingGuidelines.ruleset 9999 enable diff --git a/README.md b/README.md index b640fbc5c0..e2291f080e 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ See also our [versioning policy](./VERSIONING_POLICY.md). | | | Core 3.1 | 5 | | | | 5 | 5 | | | | 6 | 5 | -| v5.x | Pre-release | 6 | 6 | +| v5.x | Stable | 6 | 6 | ## Contributing From 0e42ebf3d54f572ab8f4324afc38db1a55a800e4 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Wed, 6 Apr 2022 12:27:16 +0200 Subject: [PATCH 2/3] Update ROADMAP.md --- ROADMAP.md | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index c3baab5443..270ae294e6 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -4,37 +4,12 @@ This document provides an overview of the direction this project is heading and > Disclaimer: This is an open source project. The available time of our contributors varies and therefore we do not plan release dates. This document expresses our current intent, which may change over time. -## v4.x +We have interest in the following topics. It's too soon yet to decide whether they'll make it into v5.x or in a later major version. -We've completed active development on v4.x, but we'll still fix important bugs or add small enhancements on request that don't require breaking changes nor lots of testing. - -## v5.x - -The need for breaking changes has blocked several efforts in the v4.x release, so now that we're starting work on v5, we're going to catch up. - -- [x] Remove Resource Hooks [#1025](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1025) -- [x] Update to .NET 5 with EF Core 5 [#1026](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1026) -- [x] Native many-to-many [#935](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/935) -- [x] Refactorings [#1027](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1027) [#944](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/944) -- [x] Tweak trace logging [#1033](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1033) -- [x] Instrumentation [#1032](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1032) -- [x] Optimized delete to-many [#1030](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1030) -- [x] Support System.Text.Json [#664](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/664) [#999](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/999) [1077](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1077) [1078](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1078) -- [x] Optimize IIdentifiable to ResourceObject conversion [#1028](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1028) [#1024](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1024) [#233](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/233) -- [x] Nullable reference types [#1029](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1029) -- [x] Improved paging links [#1010](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1010) -- [x] Configuration validation [#170](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/170) -- [x] Auto-generated controllers [#732](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/732) [#365](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/365) -- [x] Support .NET 6 with EF Core 6 [#1109](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1109) -- [x] Extract annotations into separate package [#730](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/730) -- [x] Resource inheritance [#844](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/844) - -Aside from the list above, we have interest in the following topics. It's too soon yet to decide whether they'll make it into v5.x or in a later major version. - -- Optimistic concurrency [#1004](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1004) +- Optimistic concurrency [#1119](https://github.com/json-api-dotnet/JsonApiDotNetCore/pull/1119) - OpenAPI (Swagger) [#1046](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/1046) - Fluent API [#776](https://github.com/json-api-dotnet/JsonApiDotNetCore/issues/776) -- Idempotency +- Idempotency [#1132](https://github.com/json-api-dotnet/JsonApiDotNetCore/pull/1132) ## Feedback From 4dc8115a4d668b0c91a2e8d39242052e1e26a1c7 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Wed, 6 Apr 2022 19:10:23 +0200 Subject: [PATCH 3/3] Fixed: Sorting by ID from a lambda expression in a resource definition fails with error: Type 'JsonApiDotNetCore.Resources.Identifiable`1[System.Int64]' does not exist in the resource graph. (#1151) The reason for failure is that in an expression like `book => book.Id`, the `Id` property is declared on `Identifiable<>`. The fix is to look at the type of the containing expression (which is `Book` in this case) when the `Id` property is used. --- .../Resources/SortExpressionLambdaConverter.cs | 5 ++++- .../ResourceInheritance/WheelSortDefinition.cs | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/JsonApiDotNetCore/Resources/SortExpressionLambdaConverter.cs b/src/JsonApiDotNetCore/Resources/SortExpressionLambdaConverter.cs index 3736fff6d9..a2371419b6 100644 --- a/src/JsonApiDotNetCore/Resources/SortExpressionLambdaConverter.cs +++ b/src/JsonApiDotNetCore/Resources/SortExpressionLambdaConverter.cs @@ -116,7 +116,10 @@ private static (Expression? innerExpression, bool isCount) TryReadCount(Expressi { if (expression is MemberExpression memberExpression) { - ResourceType resourceType = _resourceGraph.GetResourceType(memberExpression.Member.DeclaringType!); + ResourceType resourceType = memberExpression.Member.Name == nameof(Identifiable.Id) && memberExpression.Expression != null + ? _resourceGraph.GetResourceType(memberExpression.Expression.Type) + : _resourceGraph.GetResourceType(memberExpression.Member.DeclaringType!); + AttrAttribute? attribute = resourceType.FindAttributeByPropertyName(memberExpression.Member.Name); if (attribute != null) diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/WheelSortDefinition.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/WheelSortDefinition.cs index f727c011df..e5ae558489 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/WheelSortDefinition.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/WheelSortDefinition.cs @@ -43,6 +43,7 @@ private SortExpression CreateSortFromExpressionSyntax() { AttrAttribute paintColorAttribute = ResourceGraph.GetResourceType().GetAttributeByPropertyName(nameof(ChromeWheel.PaintColor)); AttrAttribute hasTubeAttribute = ResourceGraph.GetResourceType().GetAttributeByPropertyName(nameof(CarbonWheel.HasTube)); + AttrAttribute idAttribute = ResourceGraph.GetResourceType().GetAttributeByPropertyName(nameof(Wheel.Id)); var cylinderCountChain = new ResourceFieldChainExpression(ImmutableArray.Create( ResourceGraph.GetResourceType().GetRelationshipByPropertyName(nameof(Wheel.Vehicle)), @@ -53,7 +54,8 @@ private SortExpression CreateSortFromExpressionSyntax() { new SortElementExpression(new ResourceFieldChainExpression(paintColorAttribute), true), new SortElementExpression(new ResourceFieldChainExpression(hasTubeAttribute), false), - new SortElementExpression(new CountExpression(cylinderCountChain), true) + new SortElementExpression(new CountExpression(cylinderCountChain), true), + new SortElementExpression(new ResourceFieldChainExpression(idAttribute), true) }.ToImmutableArray()); } @@ -63,7 +65,8 @@ private SortExpression CreateSortFromLambdaSyntax() { (wheel => (wheel as ChromeWheel)!.PaintColor, ListSortDirection.Ascending), (wheel => ((CarbonWheel)wheel).HasTube, ListSortDirection.Descending), - (wheel => ((GasolineEngine)((Car)wheel.Vehicle!).Engine).Cylinders.Count, ListSortDirection.Ascending) + (wheel => ((GasolineEngine)((Car)wheel.Vehicle!).Engine).Cylinders.Count, ListSortDirection.Ascending), + (wheel => wheel.Id, ListSortDirection.Ascending) }); } }