From 59f319f3c29c64e55f3aa5dc310ef57200f41d46 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Fri, 29 Apr 2022 22:30:45 +0200 Subject: [PATCH 1/7] Package updates --- Directory.Build.props | 4 ++-- .../Configuration/ServiceCollectionExtensions.cs | 2 -- .../Queries/Expressions/QueryableHandlerExpression.cs | 2 -- .../Repositories/EntityFrameworkCoreRepository.cs | 4 ---- test/TestBuildingBlocks/TestBuildingBlocks.csproj | 2 +- 5 files changed, 3 insertions(+), 11 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 403d433302..55df28cab3 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -16,8 +16,8 @@ - - + + diff --git a/src/JsonApiDotNetCore/Configuration/ServiceCollectionExtensions.cs b/src/JsonApiDotNetCore/Configuration/ServiceCollectionExtensions.cs index 8e5d15a7c4..8b5356fdef 100644 --- a/src/JsonApiDotNetCore/Configuration/ServiceCollectionExtensions.cs +++ b/src/JsonApiDotNetCore/Configuration/ServiceCollectionExtensions.cs @@ -6,8 +6,6 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -#pragma warning disable AV1130 // Return type in method signature should be an interface to an unchangeable collection - namespace JsonApiDotNetCore.Configuration; [PublicAPI] diff --git a/src/JsonApiDotNetCore/Queries/Expressions/QueryableHandlerExpression.cs b/src/JsonApiDotNetCore/Queries/Expressions/QueryableHandlerExpression.cs index 4cd035ba2d..1d9c910955 100644 --- a/src/JsonApiDotNetCore/Queries/Expressions/QueryableHandlerExpression.cs +++ b/src/JsonApiDotNetCore/Queries/Expressions/QueryableHandlerExpression.cs @@ -21,10 +21,8 @@ public QueryableHandlerExpression(object queryableHandler, StringValues paramete _parameterValue = parameterValue; } -#pragma warning disable AV1130 // Return type in method signature should be an interface to an unchangeable collection public IQueryable Apply(IQueryable query) where TResource : class, IIdentifiable -#pragma warning restore AV1130 // Return type in method signature should be an interface to an unchangeable collection { var handler = (Func, StringValues, IQueryable>)_queryableHandler; return handler(query, _parameterValue); diff --git a/src/JsonApiDotNetCore/Repositories/EntityFrameworkCoreRepository.cs b/src/JsonApiDotNetCore/Repositories/EntityFrameworkCoreRepository.cs index 7384cec693..358f63a2cd 100644 --- a/src/JsonApiDotNetCore/Repositories/EntityFrameworkCoreRepository.cs +++ b/src/JsonApiDotNetCore/Repositories/EntityFrameworkCoreRepository.cs @@ -105,9 +105,7 @@ public virtual async Task CountAsync(FilterExpression? filter, Cancellation } } -#pragma warning disable AV1130 // Return type in method signature should be an interface to an unchangeable collection protected virtual IQueryable ApplyQueryLayer(QueryLayer queryLayer) -#pragma warning restore AV1130 // Return type in method signature should be an interface to an unchangeable collection { _traceWriter.LogMethodStart(new { @@ -151,9 +149,7 @@ protected virtual IQueryable ApplyQueryLayer(QueryLayer queryLayer) } } -#pragma warning disable AV1130 // Return type in method signature should be an interface to an unchangeable collection protected virtual IQueryable GetAll() -#pragma warning restore AV1130 // Return type in method signature should be an interface to an unchangeable collection { return _dbContext.Set(); } diff --git a/test/TestBuildingBlocks/TestBuildingBlocks.csproj b/test/TestBuildingBlocks/TestBuildingBlocks.csproj index 3a8655508c..68db5c994c 100644 --- a/test/TestBuildingBlocks/TestBuildingBlocks.csproj +++ b/test/TestBuildingBlocks/TestBuildingBlocks.csproj @@ -10,7 +10,7 @@ - + From bba90e55feaa197e8b51c603b56e5b75a5876a15 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Wed, 11 May 2022 21:16:06 +0200 Subject: [PATCH 2/7] Fixed broken link --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 3e23a87e27..1a1c618dd7 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -4,6 +4,6 @@ Closes #{ISSUE_NUMBER} #### QUALITY CHECKLIST - [ ] Changes implemented in code -- [ ] Complies with our [contributing guidelines](./.github/CONTRIBUTING.md) +- [ ] Complies with our [contributing guidelines](https://github.com/json-api-dotnet/JsonApiDotNetCore/blob/master/.github/CONTRIBUTING.md) - [ ] Adapted tests - [ ] Documentation updated From 9e0fed89f5878c9e6629b7ebb5a8d4f2a53738f1 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Sat, 21 May 2022 15:24:18 +0200 Subject: [PATCH 3/7] Removed workaround for debugging source generators (#1155) * Removed workaround for https://github.com/dotnet/roslyn/issues/55802. The bug has been fixed in VS 2022 v17.2. * Package updates (in non-breaking fashion) --- Directory.Build.props | 6 +- JsonApiDotNetCore.sln | 15 ----- .../Annotations/ResourceAttribute.cs | 3 - .../ControllerSourceGenerator.cs | 6 ++ .../JsonApiDotNetCore.SourceGenerators.csproj | 2 +- .../Properties/launchSettings.json | 2 +- .../Controllers/ArticlesController.cs | 16 ----- .../Controllers/CustomersController.cs | 18 ------ .../JsonApiDotNetCore/ArgumentGuard.cs | 19 ------ .../JsonApiDotNetCore/AttrAttribute.cs | 15 ----- .../BaseJsonApiController.cs | 41 ------------- .../IAddToRelationshipService.cs | 18 ------ .../JsonApiDotNetCore/ICreateService.cs | 18 ------ .../JsonApiDotNetCore/IDeleteService.cs | 18 ------ .../JsonApiDotNetCore/IGetAllService.cs | 18 ------ .../JsonApiDotNetCore/IGetByIdService.cs | 18 ------ .../IGetRelationshipService.cs | 18 ------ .../JsonApiDotNetCore/IGetSecondaryService.cs | 18 ------ .../JsonApiDotNetCore/IIdentifiable.cs | 23 -------- .../JsonApiDotNetCore/IJsonApiOptions.cs | 15 ----- .../IRemoveFromRelationshipService.cs | 18 ------ .../IResourceCommandService.cs | 19 ------ .../JsonApiDotNetCore/IResourceGraph.cs | 15 ----- .../IResourceQueryService.cs | 18 ------ .../ISetRelationshipService.cs | 18 ------ .../JsonApiDotNetCore/IUpdateService.cs | 18 ------ .../JsonApiDotNetCore/Identifiable.cs | 19 ------ .../JsonApiCommandController.cs | 25 -------- .../JsonApiDotNetCore/JsonApiController.cs | 36 ------------ .../JsonApiDotNetCore/JsonApiOptions.cs | 16 ----- .../JsonApiQueryController.cs | 25 -------- .../JsonApiResourceService.cs | 17 ------ .../JsonApiDotNetCore/ResourceGraph.cs | 15 ----- .../ResourceServiceInterfaces.cs | 17 ------ .../SourceGeneratorDebugger/Models/Account.cs | 14 ----- .../SourceGeneratorDebugger/Models/Article.cs | 14 ----- .../Models/Customer.cs | 12 ---- test/SourceGeneratorDebugger/Models/Global.cs | 14 ----- test/SourceGeneratorDebugger/Models/Login.cs | 28 --------- test/SourceGeneratorDebugger/Models/Order.cs | 14 ----- .../Models/SimpleNamespace.cs | 15 ----- test/SourceGeneratorDebugger/Program.cs | 58 ------------------- .../SourceGeneratorDebugger.csproj | 28 --------- .../TestBuildingBlocks.csproj | 4 +- 44 files changed, 13 insertions(+), 771 deletions(-) delete mode 100644 test/SourceGeneratorDebugger/Controllers/ArticlesController.cs delete mode 100644 test/SourceGeneratorDebugger/Controllers/CustomersController.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/ArgumentGuard.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/AttrAttribute.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/BaseJsonApiController.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/IAddToRelationshipService.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/ICreateService.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/IDeleteService.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/IGetAllService.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/IGetByIdService.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/IGetRelationshipService.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/IGetSecondaryService.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/IIdentifiable.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/IJsonApiOptions.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/IRemoveFromRelationshipService.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/IResourceCommandService.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/IResourceGraph.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/IResourceQueryService.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/ISetRelationshipService.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/IUpdateService.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/Identifiable.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/JsonApiCommandController.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/JsonApiController.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/JsonApiOptions.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/JsonApiQueryController.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/JsonApiResourceService.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/ResourceGraph.cs delete mode 100644 test/SourceGeneratorDebugger/JsonApiDotNetCore/ResourceServiceInterfaces.cs delete mode 100644 test/SourceGeneratorDebugger/Models/Account.cs delete mode 100644 test/SourceGeneratorDebugger/Models/Article.cs delete mode 100644 test/SourceGeneratorDebugger/Models/Customer.cs delete mode 100644 test/SourceGeneratorDebugger/Models/Global.cs delete mode 100644 test/SourceGeneratorDebugger/Models/Login.cs delete mode 100644 test/SourceGeneratorDebugger/Models/Order.cs delete mode 100644 test/SourceGeneratorDebugger/Models/SimpleNamespace.cs delete mode 100644 test/SourceGeneratorDebugger/Program.cs delete mode 100644 test/SourceGeneratorDebugger/SourceGeneratorDebugger.csproj diff --git a/Directory.Build.props b/Directory.Build.props index 55df28cab3..26ff3e7175 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,7 +4,7 @@ 6.0.* 6.0.* 6.0.* - 4.1.* + 4.2.* 2.14.1 5.0.2 $(MSBuildThisFileDirectory)CodingGuidelines.ruleset @@ -34,7 +34,7 @@ 3.1.2 - 4.17.2 - 17.1.0 + 4.18.1 + 17.2.0 diff --git a/JsonApiDotNetCore.sln b/JsonApiDotNetCore.sln index 0a8ed12d2a..21b1cca7ce 100644 --- a/JsonApiDotNetCore.sln +++ b/JsonApiDotNetCore.sln @@ -46,8 +46,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestBuildingBlocks", "test\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JsonApiDotNetCore.SourceGenerators", "src\JsonApiDotNetCore.SourceGenerators\JsonApiDotNetCore.SourceGenerators.csproj", "{952C0FDE-AFC8-455C-986F-6CC882ED8953}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SourceGeneratorDebugger", "test\SourceGeneratorDebugger\SourceGeneratorDebugger.csproj", "{87D066F9-3540-4AC7-A748-134900969EE5}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SourceGeneratorTests", "test\SourceGeneratorTests\SourceGeneratorTests.csproj", "{0E0B5C51-F7E2-4F40-A4E4-DED0E9731DC9}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JsonApiDotNetCore.Annotations", "src\JsonApiDotNetCore.Annotations\JsonApiDotNetCore.Annotations.csproj", "{83FF097C-C8C6-477B-9FAB-DF99B84978B5}" @@ -232,18 +230,6 @@ Global {952C0FDE-AFC8-455C-986F-6CC882ED8953}.Release|x64.Build.0 = Release|Any CPU {952C0FDE-AFC8-455C-986F-6CC882ED8953}.Release|x86.ActiveCfg = Release|Any CPU {952C0FDE-AFC8-455C-986F-6CC882ED8953}.Release|x86.Build.0 = Release|Any CPU - {87D066F9-3540-4AC7-A748-134900969EE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {87D066F9-3540-4AC7-A748-134900969EE5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {87D066F9-3540-4AC7-A748-134900969EE5}.Debug|x64.ActiveCfg = Debug|Any CPU - {87D066F9-3540-4AC7-A748-134900969EE5}.Debug|x64.Build.0 = Debug|Any CPU - {87D066F9-3540-4AC7-A748-134900969EE5}.Debug|x86.ActiveCfg = Debug|Any CPU - {87D066F9-3540-4AC7-A748-134900969EE5}.Debug|x86.Build.0 = Debug|Any CPU - {87D066F9-3540-4AC7-A748-134900969EE5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {87D066F9-3540-4AC7-A748-134900969EE5}.Release|Any CPU.Build.0 = Release|Any CPU - {87D066F9-3540-4AC7-A748-134900969EE5}.Release|x64.ActiveCfg = Release|Any CPU - {87D066F9-3540-4AC7-A748-134900969EE5}.Release|x64.Build.0 = Release|Any CPU - {87D066F9-3540-4AC7-A748-134900969EE5}.Release|x86.ActiveCfg = Release|Any CPU - {87D066F9-3540-4AC7-A748-134900969EE5}.Release|x86.Build.0 = Release|Any CPU {0E0B5C51-F7E2-4F40-A4E4-DED0E9731DC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0E0B5C51-F7E2-4F40-A4E4-DED0E9731DC9}.Debug|Any CPU.Build.0 = Debug|Any CPU {0E0B5C51-F7E2-4F40-A4E4-DED0E9731DC9}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -299,7 +285,6 @@ Global {EC3202C6-1D4C-4B14-A599-B9D3F27FE3BA} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F} {210FD61E-FF5D-4CEE-8E0D-C739ECCCBA21} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F} {952C0FDE-AFC8-455C-986F-6CC882ED8953} = {7A2B7ADD-ECB5-4D00-AA6A-D45BD11C97CF} - {87D066F9-3540-4AC7-A748-134900969EE5} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F} {0E0B5C51-F7E2-4F40-A4E4-DED0E9731DC9} = {24B15015-62E5-42E1-9BA0-ECE6BE7AA15F} {83FF097C-C8C6-477B-9FAB-DF99B84978B5} = {7A2B7ADD-ECB5-4D00-AA6A-D45BD11C97CF} {60334658-BE51-43B3-9C4D-F2BBF56C89CE} = {026FBC6C-AF76-4568-9B87-EC73457899FD} diff --git a/src/JsonApiDotNetCore.Annotations/Resources/Annotations/ResourceAttribute.cs b/src/JsonApiDotNetCore.Annotations/Resources/Annotations/ResourceAttribute.cs index ca517e3e99..72669de585 100644 --- a/src/JsonApiDotNetCore.Annotations/Resources/Annotations/ResourceAttribute.cs +++ b/src/JsonApiDotNetCore.Annotations/Resources/Annotations/ResourceAttribute.cs @@ -1,9 +1,6 @@ using JetBrains.Annotations; using JsonApiDotNetCore.Controllers; -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - namespace JsonApiDotNetCore.Resources.Annotations; /// diff --git a/src/JsonApiDotNetCore.SourceGenerators/ControllerSourceGenerator.cs b/src/JsonApiDotNetCore.SourceGenerators/ControllerSourceGenerator.cs index 6728fd537c..65800bba82 100644 --- a/src/JsonApiDotNetCore.SourceGenerators/ControllerSourceGenerator.cs +++ b/src/JsonApiDotNetCore.SourceGenerators/ControllerSourceGenerator.cs @@ -13,6 +13,12 @@ namespace JsonApiDotNetCore.SourceGenerators { + // To debug in Visual Studio (requires v17.2 or higher): + // - Set JsonApiDotNetCore.SourceGenerators as startup project + // - Add a breakpoint at the start of the Initialize or Execute method + // - Optional: change targetProject in Properties\launchSettings.json + // - Press F5 + [Generator(LanguageNames.CSharp)] public sealed class ControllerSourceGenerator : ISourceGenerator { diff --git a/src/JsonApiDotNetCore.SourceGenerators/JsonApiDotNetCore.SourceGenerators.csproj b/src/JsonApiDotNetCore.SourceGenerators/JsonApiDotNetCore.SourceGenerators.csproj index 9f7c0b85dd..bcd8c06b0a 100644 --- a/src/JsonApiDotNetCore.SourceGenerators/JsonApiDotNetCore.SourceGenerators.csproj +++ b/src/JsonApiDotNetCore.SourceGenerators/JsonApiDotNetCore.SourceGenerators.csproj @@ -48,6 +48,6 @@ - + diff --git a/src/JsonApiDotNetCore.SourceGenerators/Properties/launchSettings.json b/src/JsonApiDotNetCore.SourceGenerators/Properties/launchSettings.json index 2679b059a9..03635841ec 100644 --- a/src/JsonApiDotNetCore.SourceGenerators/Properties/launchSettings.json +++ b/src/JsonApiDotNetCore.SourceGenerators/Properties/launchSettings.json @@ -2,7 +2,7 @@ "profiles": { "JsonApiDotNetCore.SourceGenerators": { "commandName": "DebugRoslynComponent", - "targetProject": "..\\..\\test\\SourceGeneratorDebugger\\SourceGeneratorDebugger.csproj" + "targetProject": "..\\Examples\\JsonApiDotNetCoreExample\\JsonApiDotNetCoreExample.csproj" } } } diff --git a/test/SourceGeneratorDebugger/Controllers/ArticlesController.cs b/test/SourceGeneratorDebugger/Controllers/ArticlesController.cs deleted file mode 100644 index 1ceafa5d02..0000000000 --- a/test/SourceGeneratorDebugger/Controllers/ArticlesController.cs +++ /dev/null @@ -1,16 +0,0 @@ -using JetBrains.Annotations; - -namespace SourceGeneratorDebugger.Controllers; - -// Workaround for https://youtrack.jetbrains.com/issue/RSRP-487028 -public partial class ArticlesController -{ -} - -[PublicAPI] -partial class ArticlesController -{ - public void ExtraMethod() - { - } -} diff --git a/test/SourceGeneratorDebugger/Controllers/CustomersController.cs b/test/SourceGeneratorDebugger/Controllers/CustomersController.cs deleted file mode 100644 index a10de41483..0000000000 --- a/test/SourceGeneratorDebugger/Controllers/CustomersController.cs +++ /dev/null @@ -1,18 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Configuration; -using JsonApiDotNetCore.Controllers; -using JsonApiDotNetCore.Services; -using Microsoft.Extensions.Logging; -using SourceGeneratorDebugger.Models; - -namespace SourceGeneratorDebugger.Controllers; - -[PublicAPI] -public sealed class CustomersController : JsonApiController -{ - public CustomersController(IJsonApiOptions options, IResourceGraph resourceGraph, ILoggerFactory loggerFactory, - IResourceService resourceService) - : base(options, resourceGraph, loggerFactory, resourceService) - { - } -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/ArgumentGuard.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/ArgumentGuard.cs deleted file mode 100644 index e806a3caa1..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/ArgumentGuard.cs +++ /dev/null @@ -1,19 +0,0 @@ -using JetBrains.Annotations; - -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name -#pragma warning disable AV1008 // Class should not be static - -namespace JsonApiDotNetCore; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -internal static class ArgumentGuard -{ - public static void NotNullNorEmpty(string? value, string name) - { - } -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/AttrAttribute.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/AttrAttribute.cs deleted file mode 100644 index d8201a0a59..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/AttrAttribute.cs +++ /dev/null @@ -1,15 +0,0 @@ -using JetBrains.Annotations; - -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Resources.Annotations; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public sealed class AttrAttribute : Attribute -{ -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/BaseJsonApiController.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/BaseJsonApiController.cs deleted file mode 100644 index 2cd3fd0cd6..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/BaseJsonApiController.cs +++ /dev/null @@ -1,41 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Configuration; -using JsonApiDotNetCore.Resources; -using JsonApiDotNetCore.Services; -using Microsoft.Extensions.Logging; - -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Controllers; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public abstract class BaseJsonApiController - where TResource : class, IIdentifiable -{ - protected BaseJsonApiController(IJsonApiOptions options, IResourceGraph resourceGraph, ILoggerFactory loggerFactory, - IResourceService resourceService) - : this(options, resourceGraph, loggerFactory, resourceService, resourceService) - { - } - - protected BaseJsonApiController(IJsonApiOptions options, IResourceGraph resourceGraph, ILoggerFactory loggerFactory, - IResourceQueryService? queryService = null, IResourceCommandService? commandService = null) - : this(options, resourceGraph, loggerFactory, queryService, queryService, queryService, queryService, commandService, commandService, commandService, - commandService, commandService, commandService) - { - } - - protected BaseJsonApiController(IJsonApiOptions options, IResourceGraph resourceGraph, ILoggerFactory loggerFactory, - IGetAllService? getAll = null, IGetByIdService? getById = null, - IGetSecondaryService? getSecondary = null, IGetRelationshipService? getRelationship = null, - ICreateService? create = null, IAddToRelationshipService? addToRelationship = null, - IUpdateService? update = null, ISetRelationshipService? setRelationship = null, - IDeleteService? delete = null, IRemoveFromRelationshipService? removeFromRelationship = null) - { - } -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IAddToRelationshipService.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/IAddToRelationshipService.cs deleted file mode 100644 index 4bdfbe99ab..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IAddToRelationshipService.cs +++ /dev/null @@ -1,18 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Resources; - -// ReSharper disable UnusedTypeParameter -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Services; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public interface IAddToRelationshipService - where TResource : class, IIdentifiable -{ -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/ICreateService.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/ICreateService.cs deleted file mode 100644 index 3e1d7525a3..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/ICreateService.cs +++ /dev/null @@ -1,18 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Resources; - -// ReSharper disable UnusedTypeParameter -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Services; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public interface ICreateService - where TResource : class, IIdentifiable -{ -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IDeleteService.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/IDeleteService.cs deleted file mode 100644 index 10a1092bd9..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IDeleteService.cs +++ /dev/null @@ -1,18 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Resources; - -// ReSharper disable UnusedTypeParameter -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Services; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public interface IDeleteService - where TResource : class, IIdentifiable -{ -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IGetAllService.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/IGetAllService.cs deleted file mode 100644 index 9a6644e428..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IGetAllService.cs +++ /dev/null @@ -1,18 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Resources; - -// ReSharper disable UnusedTypeParameter -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Services; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public interface IGetAllService - where TResource : class, IIdentifiable -{ -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IGetByIdService.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/IGetByIdService.cs deleted file mode 100644 index f59885af15..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IGetByIdService.cs +++ /dev/null @@ -1,18 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Resources; - -// ReSharper disable UnusedTypeParameter -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Services; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public interface IGetByIdService - where TResource : class, IIdentifiable -{ -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IGetRelationshipService.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/IGetRelationshipService.cs deleted file mode 100644 index 7e28fe1cb1..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IGetRelationshipService.cs +++ /dev/null @@ -1,18 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Resources; - -// ReSharper disable UnusedTypeParameter -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Services; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public interface IGetRelationshipService - where TResource : class, IIdentifiable -{ -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IGetSecondaryService.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/IGetSecondaryService.cs deleted file mode 100644 index 3d2d0fd381..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IGetSecondaryService.cs +++ /dev/null @@ -1,18 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Resources; - -// ReSharper disable UnusedTypeParameter -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Services; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public interface IGetSecondaryService - where TResource : class, IIdentifiable -{ -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IIdentifiable.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/IIdentifiable.cs deleted file mode 100644 index a5a857cf3e..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IIdentifiable.cs +++ /dev/null @@ -1,23 +0,0 @@ -using JetBrains.Annotations; - -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Resources; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public interface IIdentifiable -{ - string? StringId { get; set; } - string? LocalId { get; set; } -} - -[PublicAPI] -public interface IIdentifiable : IIdentifiable -{ - TId Id { get; set; } -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IJsonApiOptions.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/IJsonApiOptions.cs deleted file mode 100644 index 5d076dd4ca..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IJsonApiOptions.cs +++ /dev/null @@ -1,15 +0,0 @@ -using JetBrains.Annotations; - -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Configuration; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public interface IJsonApiOptions -{ -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IRemoveFromRelationshipService.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/IRemoveFromRelationshipService.cs deleted file mode 100644 index dd071fdc6e..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IRemoveFromRelationshipService.cs +++ /dev/null @@ -1,18 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Resources; - -// ReSharper disable UnusedTypeParameter -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Services; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public interface IRemoveFromRelationshipService - where TResource : class, IIdentifiable -{ -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IResourceCommandService.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/IResourceCommandService.cs deleted file mode 100644 index e7fcebc608..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IResourceCommandService.cs +++ /dev/null @@ -1,19 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Resources; - -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Services; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public interface IResourceCommandService - : ICreateService, IAddToRelationshipService, IUpdateService, ISetRelationshipService, - IDeleteService, IRemoveFromRelationshipService - where TResource : class, IIdentifiable -{ -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IResourceGraph.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/IResourceGraph.cs deleted file mode 100644 index 7d1f1562ba..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IResourceGraph.cs +++ /dev/null @@ -1,15 +0,0 @@ -using JetBrains.Annotations; - -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Configuration; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public interface IResourceGraph -{ -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IResourceQueryService.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/IResourceQueryService.cs deleted file mode 100644 index b734963ad3..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IResourceQueryService.cs +++ /dev/null @@ -1,18 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Resources; - -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Services; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public interface IResourceQueryService - : IGetAllService, IGetByIdService, IGetRelationshipService, IGetSecondaryService - where TResource : class, IIdentifiable -{ -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/ISetRelationshipService.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/ISetRelationshipService.cs deleted file mode 100644 index 2cd43448bd..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/ISetRelationshipService.cs +++ /dev/null @@ -1,18 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Resources; - -// ReSharper disable UnusedTypeParameter -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Services; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public interface ISetRelationshipService - where TResource : class, IIdentifiable -{ -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IUpdateService.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/IUpdateService.cs deleted file mode 100644 index 974335097c..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/IUpdateService.cs +++ /dev/null @@ -1,18 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Resources; - -// ReSharper disable UnusedTypeParameter -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Services; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public interface IUpdateService - where TResource : class, IIdentifiable -{ -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/Identifiable.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/Identifiable.cs deleted file mode 100644 index 6e78d67867..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/Identifiable.cs +++ /dev/null @@ -1,19 +0,0 @@ -using JetBrains.Annotations; - -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Resources; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public abstract class Identifiable : IIdentifiable -{ - public virtual TId Id { get; set; } = default!; - - public string? StringId { get; set; } - public string? LocalId { get; set; } -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/JsonApiCommandController.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/JsonApiCommandController.cs deleted file mode 100644 index 31736e8088..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/JsonApiCommandController.cs +++ /dev/null @@ -1,25 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Configuration; -using JsonApiDotNetCore.Resources; -using JsonApiDotNetCore.Services; -using Microsoft.Extensions.Logging; - -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Controllers; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public abstract class JsonApiCommandController : BaseJsonApiController - where TResource : class, IIdentifiable -{ - protected JsonApiCommandController(IJsonApiOptions options, IResourceGraph resourceGraph, ILoggerFactory loggerFactory, - IResourceCommandService commandService) - : base(options, resourceGraph, loggerFactory, null, commandService) - { - } -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/JsonApiController.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/JsonApiController.cs deleted file mode 100644 index 9d7d1d6e9c..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/JsonApiController.cs +++ /dev/null @@ -1,36 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Configuration; -using JsonApiDotNetCore.Resources; -using JsonApiDotNetCore.Services; -using Microsoft.Extensions.Logging; - -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Controllers; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public abstract class JsonApiController : BaseJsonApiController - where TResource : class, IIdentifiable -{ - protected JsonApiController(IJsonApiOptions options, IResourceGraph resourceGraph, ILoggerFactory loggerFactory, - IResourceService resourceService) - : base(options, resourceGraph, loggerFactory, resourceService) - { - } - - protected JsonApiController(IJsonApiOptions options, IResourceGraph resourceGraph, ILoggerFactory loggerFactory, - IGetAllService? getAll = null, IGetByIdService? getById = null, - IGetSecondaryService? getSecondary = null, IGetRelationshipService? getRelationship = null, - ICreateService? create = null, IAddToRelationshipService? addToRelationship = null, - IUpdateService? update = null, ISetRelationshipService? setRelationship = null, - IDeleteService? delete = null, IRemoveFromRelationshipService? removeFromRelationship = null) - : base(options, resourceGraph, loggerFactory, getAll, getById, getSecondary, getRelationship, create, addToRelationship, update, setRelationship, - delete, removeFromRelationship) - { - } -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/JsonApiOptions.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/JsonApiOptions.cs deleted file mode 100644 index bad4ca2a28..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/JsonApiOptions.cs +++ /dev/null @@ -1,16 +0,0 @@ -// ReSharper disable CheckNamespace - -using JetBrains.Annotations; - -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Configuration; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public sealed class JsonApiOptions : IJsonApiOptions -{ -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/JsonApiQueryController.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/JsonApiQueryController.cs deleted file mode 100644 index cebb57e7bc..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/JsonApiQueryController.cs +++ /dev/null @@ -1,25 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Configuration; -using JsonApiDotNetCore.Resources; -using JsonApiDotNetCore.Services; -using Microsoft.Extensions.Logging; - -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Controllers; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public abstract class JsonApiQueryController : BaseJsonApiController - where TResource : class, IIdentifiable -{ - protected JsonApiQueryController(IJsonApiOptions options, IResourceGraph resourceGraph, ILoggerFactory loggerFactory, - IResourceQueryService queryService) - : base(options, resourceGraph, loggerFactory, queryService) - { - } -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/JsonApiResourceService.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/JsonApiResourceService.cs deleted file mode 100644 index 118f5d315d..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/JsonApiResourceService.cs +++ /dev/null @@ -1,17 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Resources; - -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Services; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public sealed class JsonApiResourceService : IResourceService - where TResource : class, IIdentifiable -{ -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/ResourceGraph.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/ResourceGraph.cs deleted file mode 100644 index 5be951c9f4..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/ResourceGraph.cs +++ /dev/null @@ -1,15 +0,0 @@ -using JetBrains.Annotations; - -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Configuration; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public sealed class ResourceGraph : IResourceGraph -{ -} diff --git a/test/SourceGeneratorDebugger/JsonApiDotNetCore/ResourceServiceInterfaces.cs b/test/SourceGeneratorDebugger/JsonApiDotNetCore/ResourceServiceInterfaces.cs deleted file mode 100644 index 72cd018d77..0000000000 --- a/test/SourceGeneratorDebugger/JsonApiDotNetCore/ResourceServiceInterfaces.cs +++ /dev/null @@ -1,17 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Resources; - -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace JsonApiDotNetCore.Services; - -/// -/// Represents a stripped-down copy of this type in the JsonApiDotNetCore project. It exists solely to fulfill the dependency needs for successfully -/// compiling the source-generated controllers in this project. -/// -[PublicAPI] -public interface IResourceService : IResourceCommandService, IResourceQueryService - where TResource : class, IIdentifiable -{ -} diff --git a/test/SourceGeneratorDebugger/Models/Account.cs b/test/SourceGeneratorDebugger/Models/Account.cs deleted file mode 100644 index 360f6f837f..0000000000 --- a/test/SourceGeneratorDebugger/Models/Account.cs +++ /dev/null @@ -1,14 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Controllers; -using JsonApiDotNetCore.Resources; -using JsonApiDotNetCore.Resources.Annotations; - -namespace SourceGeneratorDebugger.Models; - -[UsedImplicitly(ImplicitUseTargetFlags.Members)] -[Resource(GenerateControllerEndpoints = JsonApiEndpoints.Query, ControllerNamespace = "Some.Namespace.To.Place.Controllers")] -public sealed class Account : Identifiable -{ - [Attr] - public string? DisplayName { get; set; } -} diff --git a/test/SourceGeneratorDebugger/Models/Article.cs b/test/SourceGeneratorDebugger/Models/Article.cs deleted file mode 100644 index fd28b80494..0000000000 --- a/test/SourceGeneratorDebugger/Models/Article.cs +++ /dev/null @@ -1,14 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Controllers; -using JsonApiDotNetCore.Resources; -using JsonApiDotNetCore.Resources.Annotations; - -namespace SourceGeneratorDebugger.Models; - -[UsedImplicitly(ImplicitUseTargetFlags.Members)] -[Resource(GenerateControllerEndpoints = JsonApiEndpoints.GetCollection | JsonApiEndpoints.GetSingle | JsonApiEndpoints.GetSecondary)] -public sealed class Article : Identifiable -{ - [Attr] - public string? DisplayName { get; set; } -} diff --git a/test/SourceGeneratorDebugger/Models/Customer.cs b/test/SourceGeneratorDebugger/Models/Customer.cs deleted file mode 100644 index 26d869c550..0000000000 --- a/test/SourceGeneratorDebugger/Models/Customer.cs +++ /dev/null @@ -1,12 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Resources; -using JsonApiDotNetCore.Resources.Annotations; - -namespace SourceGeneratorDebugger.Models; - -[UsedImplicitly(ImplicitUseTargetFlags.Members)] -public sealed class Customer : Identifiable -{ - [Attr] - public string Name { get; set; } = null!; -} diff --git a/test/SourceGeneratorDebugger/Models/Global.cs b/test/SourceGeneratorDebugger/Models/Global.cs deleted file mode 100644 index ef62b974ca..0000000000 --- a/test/SourceGeneratorDebugger/Models/Global.cs +++ /dev/null @@ -1,14 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Resources; -using JsonApiDotNetCore.Resources.Annotations; - -// ReSharper disable CheckNamespace -#pragma warning disable AV1505 // Namespace should match with assembly name - -[UsedImplicitly(ImplicitUseTargetFlags.Members)] -[Resource] -public sealed class Global : Identifiable -{ - [Attr] - public string? Value { get; set; } -} diff --git a/test/SourceGeneratorDebugger/Models/Login.cs b/test/SourceGeneratorDebugger/Models/Login.cs deleted file mode 100644 index 334a395a21..0000000000 --- a/test/SourceGeneratorDebugger/Models/Login.cs +++ /dev/null @@ -1,28 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Controllers; -using JsonApiDotNetCore.Resources; -using JsonApiDotNetCore.Resources.Annotations; - -#pragma warning disable AV1505 // Namespace should match with assembly name - -namespace SourceGeneratorDebugger.Models -{ - [UsedImplicitly(ImplicitUseTargetFlags.Members)] - [Resource(GenerateControllerEndpoints = JsonApiEndpoints.Command)] - public sealed class Login : Identifiable - { - [Attr] - public DateTimeOffset Time { get; set; } - } -} - -namespace Some.Other.Path -{ - [UsedImplicitly(ImplicitUseTargetFlags.Members)] - [Resource(GenerateControllerEndpoints = JsonApiEndpoints.Command)] - public sealed class Login : Identifiable - { - [Attr] - public DateTimeOffset Time { get; set; } - } -} diff --git a/test/SourceGeneratorDebugger/Models/Order.cs b/test/SourceGeneratorDebugger/Models/Order.cs deleted file mode 100644 index 40d5582ff1..0000000000 --- a/test/SourceGeneratorDebugger/Models/Order.cs +++ /dev/null @@ -1,14 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Controllers; -using JsonApiDotNetCore.Resources; -using JsonApiDotNetCore.Resources.Annotations; - -namespace SourceGeneratorDebugger.Models; - -[UsedImplicitly(ImplicitUseTargetFlags.Members)] -[Resource(GenerateControllerEndpoints = JsonApiEndpoints.All)] -public sealed class Order : Identifiable -{ - [Attr] - public decimal TotalAmount { get; set; } -} diff --git a/test/SourceGeneratorDebugger/Models/SimpleNamespace.cs b/test/SourceGeneratorDebugger/Models/SimpleNamespace.cs deleted file mode 100644 index ea02d20413..0000000000 --- a/test/SourceGeneratorDebugger/Models/SimpleNamespace.cs +++ /dev/null @@ -1,15 +0,0 @@ -using JetBrains.Annotations; -using JsonApiDotNetCore.Resources; -using JsonApiDotNetCore.Resources.Annotations; - -// ReSharper disable CheckNamespace - -namespace SourceGeneratorDebugger; - -[UsedImplicitly(ImplicitUseTargetFlags.Members)] -[Resource] -public sealed class SimpleNamespace : Identifiable -{ - [Attr] - public string? Value { get; set; } -} diff --git a/test/SourceGeneratorDebugger/Program.cs b/test/SourceGeneratorDebugger/Program.cs deleted file mode 100644 index b237a86f68..0000000000 --- a/test/SourceGeneratorDebugger/Program.cs +++ /dev/null @@ -1,58 +0,0 @@ -using JsonApiDotNetCore.Configuration; -using JsonApiDotNetCore.Services; -using Microsoft.Extensions.Logging.Abstractions; -using SourceGeneratorDebugger.Controllers; -using SourceGeneratorDebugger.Models; - -namespace SourceGeneratorDebugger; - -// Until https://github.com/dotnet/roslyn/issues/55802 is fixed, this project enables us to debug the ASP.NET Controller source generator. -// In Visual Studio, set JsonApiDotNetCore.SourceGenerators as startup project, add a breakpoint at the start of ControllerSourceGenerator and press F5. -internal static class Program -{ - public static void Main() - { - JsonApiOptions options = new(); - ResourceGraph resourceGraph = new(); - - // Built-in - IResourceService customerResourceService = new JsonApiResourceService(); - CustomersController customersController = new(options, resourceGraph, NullLoggerFactory.Instance, customerResourceService); - GC.KeepAlive(customersController); - - // Generated - IResourceService orderResourceService = new JsonApiResourceService(); - OrdersController ordersController = new(options, resourceGraph, NullLoggerFactory.Instance, orderResourceService); - GC.KeepAlive(ordersController); - - // Generated Query - IResourceQueryService accountQueryService = new JsonApiResourceService(); - AccountsController accountsController = new(options, resourceGraph, NullLoggerFactory.Instance, accountQueryService); - GC.KeepAlive(accountsController); - - // Generated Command - IResourceCommandService loginCommandService = new JsonApiResourceService(); - LoginsController loginsController = new(options, resourceGraph, NullLoggerFactory.Instance, loginCommandService); - GC.KeepAlive(loginsController); - - // Generated mix - IGetAllService articleGetAllResourceService = new JsonApiResourceService(); - IGetByIdService articleGetByIdResourceService = new JsonApiResourceService(); - IGetSecondaryService articleGetSecondaryResourceService = new JsonApiResourceService(); - - ArticlesController articlesController = new(options, resourceGraph, NullLoggerFactory.Instance, articleGetAllResourceService, - articleGetByIdResourceService, articleGetSecondaryResourceService); - - articlesController.ExtraMethod(); - - // Generated in global namespace - IResourceService globalResourceService = new JsonApiResourceService(); - GlobalsController globalsController = new(options, resourceGraph, NullLoggerFactory.Instance, globalResourceService); - GC.KeepAlive(globalsController); - - // Generated in non-nested namespace - IResourceService singleNamespaceResourceService = new JsonApiResourceService(); - SimpleNamespacesController singleNamespacesController = new(options, resourceGraph, NullLoggerFactory.Instance, singleNamespaceResourceService); - GC.KeepAlive(singleNamespacesController); - } -} diff --git a/test/SourceGeneratorDebugger/SourceGeneratorDebugger.csproj b/test/SourceGeneratorDebugger/SourceGeneratorDebugger.csproj deleted file mode 100644 index 2909905e2b..0000000000 --- a/test/SourceGeneratorDebugger/SourceGeneratorDebugger.csproj +++ /dev/null @@ -1,28 +0,0 @@ - - - $(TargetFrameworkName) - Exe - true - $(BaseIntermediateOutputPath)\GeneratedFiles - - - - - - - - - - - - - - - - - - - - - diff --git a/test/TestBuildingBlocks/TestBuildingBlocks.csproj b/test/TestBuildingBlocks/TestBuildingBlocks.csproj index 68db5c994c..2f383d72e9 100644 --- a/test/TestBuildingBlocks/TestBuildingBlocks.csproj +++ b/test/TestBuildingBlocks/TestBuildingBlocks.csproj @@ -10,13 +10,13 @@ - + - + From 7246d1344c59f6f4c17bd856532979b560ee3d4b Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Thu, 26 May 2022 23:17:06 +0200 Subject: [PATCH 4/7] Updated issue templates --- .github/CONTRIBUTING.md | 4 +-- .github/ISSUE_TEMPLATE/bug_report.md | 13 ++++---- .github/ISSUE_TEMPLATE/feature_request.md | 12 +++---- .github/ISSUE_TEMPLATE/question.md | 38 +++++++++++++++++++++++ 4 files changed, 52 insertions(+), 15 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/question.md diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 150c8b45df..5e87f135f0 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,8 +1,6 @@ # I don't want to read this whole thing I just have a question!!! -> Note: Please don't file an issue to ask a question. - -You'll get faster results by using our official [Gitter channel](https://gitter.im/json-api-dotnet-core/Lobby) or [StackOverflow](https://stackoverflow.com/search?q=jsonapidotnetcore) where the community chimes in with helpful advice if you have questions. +> You can file an issue to ask a question, but you'll get faster results by using our official [Gitter channel](https://gitter.im/json-api-dotnet-core/Lobby) or [StackOverflow](https://stackoverflow.com/search?q=jsonapidotnetcore) where the community chimes in with helpful advice if you have questions. # How can I contribute? diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index e0c2388a38..c59acf46d6 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -2,18 +2,18 @@ name: Bug report about: Create a report to help us improve title: '' -labels: '' +labels: 'bug' assignees: '' --- -_Please read our [Contributing Guides](https://github.com/json-api-dotnet/JsonApiDotNetCore/blob/master/.github/CONTRIBUTING.md) before submitting a bug._ + #### DESCRIPTION -_A clear and concise description of what the bug is._ + #### STEPS TO REPRODUCE -_Consider to include your code here, such as models, DbContext, controllers, resource services, repositories, resource definitions etc. Please also include the request URL with body (if applicable) and the full exception stack trace (set `options.IncludeExceptionStackTraceInErrors` to `true`) in case of errors._ It may also be helpful to include the produced SQL, which can be made visible in logs by adding this to appsettings.json: + 1. 2. 3. #### EXPECTED BEHAVIOR -_A clear and concise description of what you expected to happen._ + #### ACTUAL BEHAVIOR -_A clear and concise description of what happens instead._ + #### VERSIONS USED - JsonApiDotNetCore version: diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index f7b806fe50..f629ca472d 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -2,21 +2,21 @@ name: Feature request about: Suggest an idea for this project title: '' -labels: '' +labels: 'enhancement' assignees: '' --- -_Please read our [Contributing Guides](https://github.com/json-api-dotnet/JsonApiDotNetCore/blob/master/.github/CONTRIBUTING.md) before suggesting an idea._ + **Is your feature request related to a problem? Please describe.** -_A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]_ + **Describe the solution you'd like** -_A clear and concise description of what you want to happen._ + **Describe alternatives you've considered** -_A clear and concise description of any alternative solutions or features you've considered._ + **Additional context** -_Add any other context or screenshots about the feature request here._ + diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md new file mode 100644 index 0000000000..689f2daa01 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,38 @@ +--- +name: Question +about: Ask a question +title: '' +labels: 'question' +assignees: '' + +--- + +#### SUMMARY + + +#### DETAILS + + +#### STEPS TO REPRODUCE + + +1. +2. +3. + +#### VERSIONS USED +- JsonApiDotNetCore version: +- ASP.NET Core version: +- Entity Framework Core version: +- Database provider: From 9af5eda9f6c01190414d07b5ca50ed9adbccd966 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Sat, 18 Jun 2022 10:29:20 +0200 Subject: [PATCH 5/7] Fixed spelling error --- src/JsonApiDotNetCore/Diagnostics/CascadingCodeTimer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/JsonApiDotNetCore/Diagnostics/CascadingCodeTimer.cs b/src/JsonApiDotNetCore/Diagnostics/CascadingCodeTimer.cs index 44cc2955d9..a2aa7a379b 100644 --- a/src/JsonApiDotNetCore/Diagnostics/CascadingCodeTimer.cs +++ b/src/JsonApiDotNetCore/Diagnostics/CascadingCodeTimer.cs @@ -18,7 +18,7 @@ static CascadingCodeTimer() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { - // Be default, measurements using Stopwatch can differ 25%-30% on the same function on the same computer. + // By default, measurements using Stopwatch can differ 25%-30% on the same function on the same computer. // The steps below ensure to get an accuracy of 0.1%-0.2%. With this accuracy, algorithms can be tested and compared. // https://www.codeproject.com/Articles/61964/Performance-Tests-Precise-Run-Time-Measurements-wi From 174a599a169c343f9c1ec9ba8ced088cd5a6a5ea Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Thu, 23 Jun 2022 00:25:10 +0200 Subject: [PATCH 6/7] Fixed crash when a generic resource definition references an interface field from its OnApplySort lambda. Where we used to special-case for Identifiable.Id, we now always use the expression type for resource graph lookups. This is safe because its not possible in C# to remove base members. The value of memberExpression.Expression is null on static member access, which is unlikely to occur in sort lambdas. --- .../Resources/SortExpressionLambdaConverter.cs | 7 ++----- .../CreateSortExpressionFromLambdaTests.cs | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/JsonApiDotNetCore/Resources/SortExpressionLambdaConverter.cs b/src/JsonApiDotNetCore/Resources/SortExpressionLambdaConverter.cs index a2371419b6..36a6d97aec 100644 --- a/src/JsonApiDotNetCore/Resources/SortExpressionLambdaConverter.cs +++ b/src/JsonApiDotNetCore/Resources/SortExpressionLambdaConverter.cs @@ -114,12 +114,9 @@ private static (Expression? innerExpression, bool isCount) TryReadCount(Expressi private Expression? ReadAttribute(Expression expression) { - if (expression is MemberExpression memberExpression) + if (expression is MemberExpression { Expression: { } } memberExpression) { - ResourceType resourceType = memberExpression.Member.Name == nameof(Identifiable.Id) && memberExpression.Expression != null - ? _resourceGraph.GetResourceType(memberExpression.Expression.Type) - : _resourceGraph.GetResourceType(memberExpression.Member.DeclaringType!); - + ResourceType resourceType = _resourceGraph.GetResourceType(memberExpression.Expression.Type); AttrAttribute? attribute = resourceType.FindAttributeByPropertyName(memberExpression.Member.Name); if (attribute != null) diff --git a/test/JsonApiDotNetCoreTests/UnitTests/ResourceDefinitions/CreateSortExpressionFromLambdaTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/ResourceDefinitions/CreateSortExpressionFromLambdaTests.cs index aff961eeeb..9efa95a19e 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/ResourceDefinitions/CreateSortExpressionFromLambdaTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/ResourceDefinitions/CreateSortExpressionFromLambdaTests.cs @@ -37,7 +37,7 @@ public void Can_convert_chain_of_ToOne_relationships_ending_in_attribute() string[] expected = { "-fileEntries:content", - "fileSystemEntries:name", + "fileEntries:name", "fileEntries:length", "fileSystemEntries:parent.fileSystemEntries:name", "fileSystemEntries:parent.fileSystemEntries:parent.fileSystemEntries:name" @@ -103,7 +103,7 @@ public void Can_convert_chain_with_conversion_to_derived_types() "fileSystemEntries:parent.fileEntries:content", "count(directoryEntries:subdirectories)", "count(fileSystemEntries:parent.directoryEntries:files)", - "-fileSystemEntries:name" + "-directoryEntries:name" }; expression.ToFullString().Should().Be(string.Join(',', expected)); From 1ff2456004135d1312823ce9d2ec620fd69a4bee Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Fri, 24 Jun 2022 02:12:45 +0200 Subject: [PATCH 7/7] Increment version number (used for pre-release builds from ci) --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 26ff3e7175..515d7de1ba 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -6,7 +6,7 @@ 6.0.* 4.2.* 2.14.1 - 5.0.2 + 5.0.3 $(MSBuildThisFileDirectory)CodingGuidelines.ruleset 9999 enable