From 31d6e763dc183b20c6e38bb7cac45f2d97aec29a Mon Sep 17 00:00:00 2001 From: Bart Koelman Date: Thu, 8 Apr 2021 13:39:56 +0200 Subject: [PATCH 01/16] Reduce logging output from tests in cibuild --- src/Examples/GettingStarted/appsettings.json | 2 +- src/Examples/JsonApiDotNetCoreExample/appsettings.json | 5 +++-- src/Examples/MultiDbContextExample/appsettings.json | 6 +++--- src/Examples/NoEntityFrameworkExample/appsettings.json | 4 ++-- src/Examples/ReportsExample/appsettings.json | 3 ++- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Examples/GettingStarted/appsettings.json b/src/Examples/GettingStarted/appsettings.json index c2ba4deaa9..270cabc088 100644 --- a/src/Examples/GettingStarted/appsettings.json +++ b/src/Examples/GettingStarted/appsettings.json @@ -2,7 +2,7 @@ "Logging": { "LogLevel": { "Default": "Warning", - "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information", "Microsoft.EntityFrameworkCore.Database.Command": "Information" } }, diff --git a/src/Examples/JsonApiDotNetCoreExample/appsettings.json b/src/Examples/JsonApiDotNetCoreExample/appsettings.json index b1f0227dcd..5d13a80bef 100644 --- a/src/Examples/JsonApiDotNetCoreExample/appsettings.json +++ b/src/Examples/JsonApiDotNetCoreExample/appsettings.json @@ -5,8 +5,9 @@ "Logging": { "LogLevel": { "Default": "Warning", - "Microsoft": "Warning", - "Microsoft.EntityFrameworkCore.Database.Command": "Warning" + "Microsoft.Hosting.Lifetime": "Warning", + "Microsoft.EntityFrameworkCore.Update": "Critical", + "Microsoft.EntityFrameworkCore.Database.Command": "Critical" } }, "AllowedHosts": "*" diff --git a/src/Examples/MultiDbContextExample/appsettings.json b/src/Examples/MultiDbContextExample/appsettings.json index d9d9a9bff6..d0229a3016 100644 --- a/src/Examples/MultiDbContextExample/appsettings.json +++ b/src/Examples/MultiDbContextExample/appsettings.json @@ -1,9 +1,9 @@ { "Logging": { "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" + "Default": "Warning", + "Microsoft.Hosting.Lifetime": "Warning", + "Microsoft.EntityFrameworkCore.Database.Command": "Critical" } }, "AllowedHosts": "*" diff --git a/src/Examples/NoEntityFrameworkExample/appsettings.json b/src/Examples/NoEntityFrameworkExample/appsettings.json index 7036e98f9d..cea6a7a623 100644 --- a/src/Examples/NoEntityFrameworkExample/appsettings.json +++ b/src/Examples/NoEntityFrameworkExample/appsettings.json @@ -5,8 +5,8 @@ "Logging": { "LogLevel": { "Default": "Warning", - "Microsoft": "Warning", - "Microsoft.EntityFrameworkCore.Database.Command": "Information" + "Microsoft.Hosting.Lifetime": "Warning", + "Microsoft.EntityFrameworkCore.Database.Command": "Critical" } }, "AllowedHosts": "*" diff --git a/src/Examples/ReportsExample/appsettings.json b/src/Examples/ReportsExample/appsettings.json index 357fc4f63c..270cabc088 100644 --- a/src/Examples/ReportsExample/appsettings.json +++ b/src/Examples/ReportsExample/appsettings.json @@ -2,7 +2,8 @@ "Logging": { "LogLevel": { "Default": "Warning", - "Microsoft": "Warning" + "Microsoft.Hosting.Lifetime": "Information", + "Microsoft.EntityFrameworkCore.Database.Command": "Information" } }, "AllowedHosts": "*" From 2549fd15ca042467b1acf2d6c06a9635857c5869 Mon Sep 17 00:00:00 2001 From: Bart Koelman Date: Tue, 6 Apr 2021 15:06:17 +0200 Subject: [PATCH 02/16] Setup code coverage --- .config/dotnet-tools.json | 12 ++++++++++++ Build.ps1 | 15 ++++++++++++++- Directory.Build.props | 5 +++-- README.md | 5 +++-- test/DiscoveryTests/DiscoveryTests.csproj | 1 + .../JsonApiDotNetCoreExampleTests.csproj | 1 + .../MultiDbContextTests.csproj | 1 + .../NoEntityFrameworkTests.csproj | 1 + test/TestBuildingBlocks/AssemblyInfo.cs | 4 ++++ test/TestBuildingBlocks/TestBuildingBlocks.csproj | 12 ++++++------ test/UnitTests/UnitTests.csproj | 1 + 11 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 test/TestBuildingBlocks/AssemblyInfo.cs diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index fb4dc5b46b..fa75ada021 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -13,6 +13,18 @@ "commands": [ "regitlint" ] + }, + "codecov.tool": { + "version": "1.13.0", + "commands": [ + "codecov" + ] + }, + "dotnet-reportgenerator-globaltool": { + "version": "4.8.7", + "commands": [ + "reportgenerator" + ] } } } diff --git a/Build.ps1 b/Build.ps1 index 9798b5ee6e..cf5f8fdcd9 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -63,6 +63,17 @@ function RunCleanupCode { } } +function ReportCodeCoverage { + if ($env:APPVEYOR) { + dotnet codecov -f "**\coverage.cobertura.xml" + } + else { + dotnet reportgenerator -reports:**\coverage.cobertura.xml -targetdir:artifacts\coverage + } + + CheckLastExitCode +} + $revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL]; $revision = "{0:D4}" -f [convert]::ToInt32($revision, 10) @@ -75,9 +86,11 @@ CheckLastExitCode RunInspectCode RunCleanupCode -dotnet test -c Release --no-build +dotnet test -c Release --no-build --collect:"XPlat Code Coverage" CheckLastExitCode +ReportCodeCoverage + Write-Output "APPVEYOR_REPO_TAG: $env:APPVEYOR_REPO_TAG" if ($env:APPVEYOR_REPO_TAG -eq $true) { diff --git a/Directory.Build.props b/Directory.Build.props index 0df194d9d2..ae0468de7d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -21,9 +21,10 @@ - 2.4.1 - 5.10.3 33.0.2 + 3.0.3 + 5.10.3 4.16.1 + 2.4.1 diff --git a/README.md b/README.md index 690f8ae866..f8784d899d 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,11 @@ # JsonApiDotNetCore A framework for building [JSON:API](http://jsonapi.org/) compliant REST APIs using .NET Core and Entity Framework Core. -[![Build status](https://ci.appveyor.com/api/projects/status/5go47hrm0iik0ls3/branch/master?svg=true)](https://ci.appveyor.com/project/jaredcnance/jsonapidotnetcore/branch/master) +[![Build](https://ci.appveyor.com/api/projects/status/t8noo6rjtst51kga/branch/master?svg=true)](https://ci.appveyor.com/project/json-api-dotnet/jsonapidotnetcore/branch/master) [![Travis](https://travis-ci.org/json-api-dotnet/JsonApiDotNetCore.svg?branch=master)](https://travis-ci.org/json-api-dotnet/JsonApiDotNetCore) +[![Coverage](https://codecov.io/gh/json-api-dotnet/JsonApiDotNetCore/branch/master/graph/badge.svg?token=pn036tWV8T)](https://codecov.io/gh/json-api-dotnet/JsonApiDotNetCore) [![NuGet](https://img.shields.io/nuget/v/JsonApiDotNetCore.svg)](https://www.nuget.org/packages/JsonApiDotNetCore/) -[![Join the chat at https://gitter.im/json-api-dotnet-core/Lobby](https://badges.gitter.im/json-api-dotnet-core/Lobby.svg)](https://gitter.im/json-api-dotnet-core/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Chat](https://badges.gitter.im/json-api-dotnet-core/Lobby.svg)](https://gitter.im/json-api-dotnet-core/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![FIRST-TIMERS](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](http://www.firsttimersonly.com/) The ultimate goal of this library is to eliminate as much boilerplate as possible by offering out-of-the-box features such as sorting, filtering and pagination. You just need to focus on defining the resources and implementing your custom business logic. This library has been designed around dependency injection, making extensibility incredibly easy. diff --git a/test/DiscoveryTests/DiscoveryTests.csproj b/test/DiscoveryTests/DiscoveryTests.csproj index 93223b9c41..eeab7c1b6f 100644 --- a/test/DiscoveryTests/DiscoveryTests.csproj +++ b/test/DiscoveryTests/DiscoveryTests.csproj @@ -15,6 +15,7 @@ + diff --git a/test/JsonApiDotNetCoreExampleTests/JsonApiDotNetCoreExampleTests.csproj b/test/JsonApiDotNetCoreExampleTests/JsonApiDotNetCoreExampleTests.csproj index 77e604e150..ca068ac1c7 100644 --- a/test/JsonApiDotNetCoreExampleTests/JsonApiDotNetCoreExampleTests.csproj +++ b/test/JsonApiDotNetCoreExampleTests/JsonApiDotNetCoreExampleTests.csproj @@ -15,6 +15,7 @@ + diff --git a/test/MultiDbContextTests/MultiDbContextTests.csproj b/test/MultiDbContextTests/MultiDbContextTests.csproj index 3e90eb5a54..a20f154918 100644 --- a/test/MultiDbContextTests/MultiDbContextTests.csproj +++ b/test/MultiDbContextTests/MultiDbContextTests.csproj @@ -15,6 +15,7 @@ + diff --git a/test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj b/test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj index 91b2c655e7..0b68188129 100644 --- a/test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj +++ b/test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj @@ -9,6 +9,7 @@ + diff --git a/test/TestBuildingBlocks/AssemblyInfo.cs b/test/TestBuildingBlocks/AssemblyInfo.cs new file mode 100644 index 0000000000..82d12912a4 --- /dev/null +++ b/test/TestBuildingBlocks/AssemblyInfo.cs @@ -0,0 +1,4 @@ +using System.Diagnostics.CodeAnalysis; + +// https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/MSBuildIntegration.md#excluding-from-coverage +[assembly: ExcludeFromCodeCoverage] diff --git a/test/TestBuildingBlocks/TestBuildingBlocks.csproj b/test/TestBuildingBlocks/TestBuildingBlocks.csproj index 5b21e0056e..3aa8cb646a 100644 --- a/test/TestBuildingBlocks/TestBuildingBlocks.csproj +++ b/test/TestBuildingBlocks/TestBuildingBlocks.csproj @@ -1,10 +1,15 @@ - + $(NetCoreAppVersion) + + + + + @@ -12,9 +17,4 @@ - - - - - diff --git a/test/UnitTests/UnitTests.csproj b/test/UnitTests/UnitTests.csproj index f4773c8b2b..8b8cb5daf4 100644 --- a/test/UnitTests/UnitTests.csproj +++ b/test/UnitTests/UnitTests.csproj @@ -15,6 +15,7 @@ + From b4dcebee76aa21b793f3462d24e531d2ef7e19bc Mon Sep 17 00:00:00 2001 From: Bart Koelman Date: Thu, 8 Apr 2021 12:55:47 +0200 Subject: [PATCH 03/16] Remove travis-ci --- .travis.yml | 14 -------------- README.md | 1 - build.sh | 8 -------- 3 files changed, 23 deletions(-) delete mode 100644 .travis.yml delete mode 100755 build.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0d4f12b270..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: csharp -sudo: required -services: - - postgresql -before_script: - - psql -c 'create database JsonApiDotNetCoreExample;' -U postgres -mono: none -dotnet: 3.1 -branches: - only: - - master - - develop -script: - - ./build.sh diff --git a/README.md b/README.md index f8784d899d..f59338894b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ A framework for building [JSON:API](http://jsonapi.org/) compliant REST APIs using .NET Core and Entity Framework Core. [![Build](https://ci.appveyor.com/api/projects/status/t8noo6rjtst51kga/branch/master?svg=true)](https://ci.appveyor.com/project/json-api-dotnet/jsonapidotnetcore/branch/master) -[![Travis](https://travis-ci.org/json-api-dotnet/JsonApiDotNetCore.svg?branch=master)](https://travis-ci.org/json-api-dotnet/JsonApiDotNetCore) [![Coverage](https://codecov.io/gh/json-api-dotnet/JsonApiDotNetCore/branch/master/graph/badge.svg?token=pn036tWV8T)](https://codecov.io/gh/json-api-dotnet/JsonApiDotNetCore) [![NuGet](https://img.shields.io/nuget/v/JsonApiDotNetCore.svg)](https://www.nuget.org/packages/JsonApiDotNetCore/) [![Chat](https://badges.gitter.im/json-api-dotnet-core/Lobby.svg)](https://gitter.im/json-api-dotnet-core/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) diff --git a/build.sh b/build.sh deleted file mode 100755 index 1edc2ea9a4..0000000000 --- a/build.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -#exit if any command fails -set -e - -dotnet restore -dotnet build -c Release -dotnet test -c Release --no-build From 8b69a32d9e84b85596d8eec3c7ee105bd3208e2e Mon Sep 17 00:00:00 2001 From: Bart Koelman Date: Thu, 8 Apr 2021 12:54:42 +0200 Subject: [PATCH 04/16] Use higher postgres version on cibuild --- appveyor.yml | 7 ++----- src/Examples/JsonApiDotNetCoreExample/Startups/Startup.cs | 7 +------ src/Examples/NoEntityFrameworkExample/Startup.cs | 5 +---- test/TestBuildingBlocks/BaseIntegrationTestContext.cs | 3 +-- 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index a3aca5fccc..15aecbba90 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -58,11 +58,8 @@ branches: nuget: disable_publish_on_pr: true -init: - - SET PATH=C:\Program Files\PostgreSQL\9.6\bin\;%PATH% - -services: - - postgresql96 +services: + - postgresql101 build_script: - pwsh: dotnet --version diff --git a/src/Examples/JsonApiDotNetCoreExample/Startups/Startup.cs b/src/Examples/JsonApiDotNetCoreExample/Startups/Startup.cs index 2db12c7434..8a107a1c25 100644 --- a/src/Examples/JsonApiDotNetCoreExample/Startups/Startup.cs +++ b/src/Examples/JsonApiDotNetCoreExample/Startups/Startup.cs @@ -14,7 +14,6 @@ namespace JsonApiDotNetCoreExample.Startups { public sealed class Startup : EmptyStartup { - private static readonly Version PostgresCiBuildVersion = new Version(9, 6); private readonly string _connectionString; public Startup(IConfiguration configuration) @@ -27,11 +26,7 @@ public override void ConfigureServices(IServiceCollection services) { services.AddSingleton(); - services.AddDbContext(options => - { - options.EnableSensitiveDataLogging(); - options.UseNpgsql(_connectionString, postgresOptions => postgresOptions.SetPostgresVersion(PostgresCiBuildVersion)); - }); + services.AddDbContext(options => options.UseNpgsql(_connectionString)); services.AddJsonApi(ConfigureJsonApiOptions, discovery => discovery.AddCurrentAssembly()); } diff --git a/src/Examples/NoEntityFrameworkExample/Startup.cs b/src/Examples/NoEntityFrameworkExample/Startup.cs index 8e0d20afa5..c51985f5f2 100644 --- a/src/Examples/NoEntityFrameworkExample/Startup.cs +++ b/src/Examples/NoEntityFrameworkExample/Startup.cs @@ -29,10 +29,7 @@ public void ConfigureServices(IServiceCollection services) services.AddScoped, WorkItemService>(); - services.AddDbContext(options => - { - options.UseNpgsql(_connectionString, postgresOptions => postgresOptions.SetPostgresVersion(new Version(9, 6))); - }); + services.AddDbContext(options => options.UseNpgsql(_connectionString)); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. diff --git a/test/TestBuildingBlocks/BaseIntegrationTestContext.cs b/test/TestBuildingBlocks/BaseIntegrationTestContext.cs index 9274e4c52a..aba34ea755 100644 --- a/test/TestBuildingBlocks/BaseIntegrationTestContext.cs +++ b/test/TestBuildingBlocks/BaseIntegrationTestContext.cs @@ -71,8 +71,7 @@ private WebApplicationFactory CreateFactory() services.AddDbContext(options => { - options.UseNpgsql(dbConnectionString, postgresOptions => postgresOptions.SetPostgresVersion(new Version(9, 6))); - + options.UseNpgsql(dbConnectionString); options.EnableSensitiveDataLogging(); options.EnableDetailedErrors(); }); From 605889ab2bbdf7287d22d109da8c361d3ca833ef Mon Sep 17 00:00:00 2001 From: Bart Koelman Date: Thu, 8 Apr 2021 13:02:01 +0200 Subject: [PATCH 05/16] cibuild matrix (Windows and Linux) --- Build.ps1 | 71 ++++++++++++-------------- appveyor.yml | 138 +++++++++++++++++++++++++++------------------------ 2 files changed, 104 insertions(+), 105 deletions(-) diff --git a/Build.ps1 b/Build.ps1 index cf5f8fdcd9..7da0003162 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -1,19 +1,8 @@ -# Gets the version suffix from the repo tag -# example: v1.0.0-preview1-final => preview1-final -function Get-Version-Suffix-From-Tag { - $tag=$env:APPVEYOR_REPO_TAG_NAME - $split=$tag -split "-" - $suffix=$split[1..2] - $final=$suffix -join "-" - return $final -} - function CheckLastExitCode { param ([int[]]$SuccessCodes = @(0), [scriptblock]$CleanupScript=$null) if ($SuccessCodes -notcontains $LastExitCode) { - $msg = "EXE RETURNED EXIT CODE $LastExitCode" - throw $msg + throw "Executable returned exit code $LastExitCode" } } @@ -65,7 +54,9 @@ function RunCleanupCode { function ReportCodeCoverage { if ($env:APPVEYOR) { - dotnet codecov -f "**\coverage.cobertura.xml" + if ($IsWindows) { + dotnet codecov -f "**\coverage.cobertura.xml" + } } else { dotnet reportgenerator -reports:**\coverage.cobertura.xml -targetdir:artifacts\coverage @@ -74,8 +65,33 @@ function ReportCodeCoverage { CheckLastExitCode } -$revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL]; -$revision = "{0:D4}" -f [convert]::ToInt32($revision, 10) +function CreateNuGetPackage { + if ($env:APPVEYOR_REPO_TAG -eq $true) { + # Get the version suffix from the repo tag. Example: v1.0.0-preview1-final => preview1-final + $segments = $env:APPVEYOR_REPO_TAG_NAME -split "-" + $suffixSegments = $segments[1..2] + $versionSuffix = $suffixSegments -join "-" + } + else { + # Get the version suffix from the auto-incrementing build number. Example: "123" => "pre-0123". + if ($env:APPVEYOR_BUILD_NUMBER) { + $revision = "{0:D4}" -f [convert]::ToInt32($env:APPVEYOR_BUILD_NUMBER, 10) + $versionSuffix="pre-$revision" + } + else { + $versionSuffix="pre-0001" + } + } + + if ([string]::IsNullOrWhitespace($versionSuffix)) { + dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts + } + else { + dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts --version-suffix=$versionSuffix + } + + CheckLastExitCode +} dotnet tool restore CheckLastExitCode @@ -91,27 +107,4 @@ CheckLastExitCode ReportCodeCoverage -Write-Output "APPVEYOR_REPO_TAG: $env:APPVEYOR_REPO_TAG" - -if ($env:APPVEYOR_REPO_TAG -eq $true) { - $revision = Get-Version-Suffix-From-Tag - Write-Output "VERSION-SUFFIX: $revision" - - if ([string]::IsNullOrWhitespace($revision)) { - Write-Output "RUNNING dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts" - dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts - CheckLastExitCode - } - else { - Write-Output "RUNNING dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts --version-suffix=$revision" - dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts --version-suffix=$revision - CheckLastExitCode - } -} -else { - $packageVersionSuffix="pre-$revision" - Write-Output "VERSION-SUFFIX: $packageVersionSuffix" - Write-Output "RUNNING dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts --version-suffix=$packageVersionSuffix" - dotnet pack .\src\JsonApiDotNetCore -c Release -o .\artifacts --version-suffix=$packageVersionSuffix - CheckLastExitCode -} +CreateNuGetPackage diff --git a/appveyor.yml b/appveyor.yml index 15aecbba90..0e033b102e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,32 +1,59 @@ +image: + - Ubuntu + - Visual Studio 2019 + version: '{build}' -os: Visual Studio 2019 + +stack: postgresql environment: PGUSER: postgres PGPASSWORD: Password12! - ACCESS_TOKEN: + GIT_ACCESS_TOKEN: secure: g1T332Uarmdgtkftchpafa8tDP/7eM4O0BD6iu1wu+zR224IyH5R8pb4sTChr4Ia -# REF: https://github.com/docascode/docfx-seed/blob/master/appveyor.yml -before_build: - - pwsh: | +branches: + only: + - master + - develop + - unstable + - /release\/.+/ + +pull_requests: + do_not_increment_build_number: true + +nuget: + disable_publish_on_pr: true + +matrix: + fast_finish: true + +for: +- + matrix: + only: + - image: Visual Studio 2019 + services: + - postgresql101 + # REF: https://github.com/docascode/docfx-seed/blob/master/appveyor.yml + before_build: + - pwsh: | if (-Not $env:APPVEYOR_PULL_REQUEST_TITLE) { # https://dotnet.github.io/docfx/tutorial/docfx_getting_started.html git checkout $env:APPVEYOR_REPO_BRANCH -q } choco install docfx -y - -after_build: - - pwsh: | + after_build: + - pwsh: | CD ./docs & ./generate-examples.ps1 & docfx docfx.json if ($lastexitcode -ne 0) { - throw [System.Exception] "docfx build failed with exit code $lastexitcode." + throw "docfx build failed with exit code $lastexitcode." } - + git config --global credential.helper store - Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:ACCESS_TOKEN):x-oauth-basic@github.com`n" + Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:GIT_ACCESS_TOKEN):x-oauth-basic@github.com`n" git config --global user.email "jaredcnance@gmail.com" git config --global user.name "Jared Nance" git config --global core.autocrlf false @@ -44,64 +71,43 @@ after_build: git push origin gh-pages -q echo "Documentation updated successfully." } - -pull_requests: - do_not_increment_build_number: true - -branches: - only: - - master - - develop - - unstable - - /release\/.+/ - -nuget: - disable_publish_on_pr: true - -services: - - postgresql101 + artifacts: + - path: .\**\artifacts\**\*.nupkg + name: NuGet + deploy: + - provider: NuGet + server: https://www.myget.org/F/research-institute/api/v2/package + api_key: + secure: 6CeYcZ4Ze+57gxfeuHzqP6ldbUkPtF6pfpVM1Gw/K2jExFrAz763gNAQ++tiacq3 + skip_symbols: false + symbol_server: https://www.myget.org/F/research-institute/symbols/api/v2/package + on: + branch: develop + - provider: NuGet + server: https://www.myget.org/F/jadnc/api/v2/package + api_key: + secure: 6CeYcZ4Ze+57gxfeuHzqP6ldbUkPtF6pfpVM1Gw/K2jExFrAz763gNAQ++tiacq3 + skip_symbols: false + on: + branch: unstable + - provider: NuGet + name: production + skip_symbols: false + api_key: + secure: SirU21S2S6F1OswSl8oiB4lYLLPchyyCIqtd2sWkTgHluelYfTa4PRaAfxlZP4fg + on: + branch: master + appveyor_repo_tag: true + - provider: NuGet + skip_symbols: false + api_key: + secure: SirU21S2S6F1OswSl8oiB4lYLLPchyyCIqtd2sWkTgHluelYfTa4PRaAfxlZP4fg + on: + branch: /release\/.+/ + appveyor_repo_tag: true build_script: - pwsh: dotnet --version - pwsh: .\Build.ps1 test: off - -artifacts: -- path: .\**\artifacts\**\*.nupkg - name: NuGet - -deploy: -- provider: NuGet - server: https://www.myget.org/F/research-institute/api/v2/package - api_key: - secure: 6CeYcZ4Ze+57gxfeuHzqP6ldbUkPtF6pfpVM1Gw/K2jExFrAz763gNAQ++tiacq3 - skip_symbols: false - symbol_server: https://www.myget.org/F/research-institute/symbols/api/v2/package - on: - branch: develop - -- provider: NuGet - server: https://www.myget.org/F/jadnc/api/v2/package - api_key: - secure: 6CeYcZ4Ze+57gxfeuHzqP6ldbUkPtF6pfpVM1Gw/K2jExFrAz763gNAQ++tiacq3 - skip_symbols: false - on: - branch: unstable - -- provider: NuGet - name: production - skip_symbols: false - api_key: - secure: SirU21S2S6F1OswSl8oiB4lYLLPchyyCIqtd2sWkTgHluelYfTa4PRaAfxlZP4fg - on: - branch: master - appveyor_repo_tag: true - -- provider: NuGet - skip_symbols: false - api_key: - secure: SirU21S2S6F1OswSl8oiB4lYLLPchyyCIqtd2sWkTgHluelYfTa4PRaAfxlZP4fg - on: - branch: /release\/.+/ - appveyor_repo_tag: true From 3201d3e01395672970a2f0160f78f203f8b13cc3 Mon Sep 17 00:00:00 2001 From: Bart Koelman Date: Thu, 8 Apr 2021 17:30:59 +0200 Subject: [PATCH 06/16] Switched account for pushing documentation updates --- appveyor.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 0e033b102e..4782214fb5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,7 +10,7 @@ environment: PGUSER: postgres PGPASSWORD: Password12! GIT_ACCESS_TOKEN: - secure: g1T332Uarmdgtkftchpafa8tDP/7eM4O0BD6iu1wu+zR224IyH5R8pb4sTChr4Ia + secure: vw2jhp7V38fTOqphzFgnXtLwHoHRW2zM2K5RJgDAnmkoaIKT6jXLDIfkFdyVz9nJ branches: only: @@ -52,10 +52,11 @@ for: throw "docfx build failed with exit code $lastexitcode." } + # https://www.appveyor.com/docs/how-to/git-push/ git config --global credential.helper store - Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:GIT_ACCESS_TOKEN):x-oauth-basic@github.com`n" - git config --global user.email "jaredcnance@gmail.com" - git config --global user.name "Jared Nance" + Set-Content -Path "$HOME\.git-credentials" -Value "https://$($env:GIT_ACCESS_TOKEN):x-oauth-basic@github.com`n" -NoNewline + git config --global user.email "cibuild@jsonapi.net" + git config --global user.name "json-api-cibuild" git config --global core.autocrlf false git config --global core.safecrlf false git clone https://github.com/json-api-dotnet/JsonApiDotNetCore.git -b gh-pages origin_site -q @@ -66,7 +67,7 @@ for: Copy-Item -Recurse home/assets/* _site/styles/ CD _site git add -A 2>&1 - git commit -m "CI Updates" -q + git commit -m "Automated commit from cibuild" -q if (-Not $env:APPVEYOR_PULL_REQUEST_TITLE) { git push origin gh-pages -q echo "Documentation updated successfully." From adec083dd2197a87dc5156b324ed3fcfb8ff1e9a Mon Sep 17 00:00:00 2001 From: Bart Koelman Date: Thu, 8 Apr 2021 17:54:02 +0200 Subject: [PATCH 07/16] Switched to NuGet organization account --- appveyor.yml | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 4782214fb5..e5b0f781ad 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -77,32 +77,16 @@ for: name: NuGet deploy: - provider: NuGet - server: https://www.myget.org/F/research-institute/api/v2/package - api_key: - secure: 6CeYcZ4Ze+57gxfeuHzqP6ldbUkPtF6pfpVM1Gw/K2jExFrAz763gNAQ++tiacq3 - skip_symbols: false - symbol_server: https://www.myget.org/F/research-institute/symbols/api/v2/package - on: - branch: develop - - provider: NuGet - server: https://www.myget.org/F/jadnc/api/v2/package - api_key: - secure: 6CeYcZ4Ze+57gxfeuHzqP6ldbUkPtF6pfpVM1Gw/K2jExFrAz763gNAQ++tiacq3 - skip_symbols: false - on: - branch: unstable - - provider: NuGet - name: production skip_symbols: false api_key: - secure: SirU21S2S6F1OswSl8oiB4lYLLPchyyCIqtd2sWkTgHluelYfTa4PRaAfxlZP4fg + secure: OBYPCgp3WCuwkDRMuZ9a4QcBdTja/lqlUwZ+Yl5VHqooSJRVTYKP5y15XK0fuHsZ on: branch: master appveyor_repo_tag: true - provider: NuGet skip_symbols: false api_key: - secure: SirU21S2S6F1OswSl8oiB4lYLLPchyyCIqtd2sWkTgHluelYfTa4PRaAfxlZP4fg + secure: OBYPCgp3WCuwkDRMuZ9a4QcBdTja/lqlUwZ+Yl5VHqooSJRVTYKP5y15XK0fuHsZ on: branch: /release\/.+/ appveyor_repo_tag: true From 734d766b3e8f2a2cb81a4e10223516dbe10a51bf Mon Sep 17 00:00:00 2001 From: Bart Koelman Date: Fri, 9 Apr 2021 09:56:51 +0200 Subject: [PATCH 08/16] Update README.md Updated instructions for development Updated compatibility version table Switched order of sections, based on chronological needs --- README.md | 67 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index f59338894b..a13609b8ac 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ These are some steps you can take to help you understand what this project is an ## Examples -See the [examples](https://github.com/json-api-dotnet/JsonApiDotNetCore/tree/master/src/Examples) directory for up-to-date sample applications. There is also a [Todo List App](https://github.com/json-api-dotnet/TodoListExample) that includes a JADNC API and an EmberJs client. +See the [examples](https://github.com/json-api-dotnet/JsonApiDotNetCore/tree/master/src/Examples) directory for up-to-date sample applications. There is also a [Todo List App](https://github.com/json-api-dotnet/TodoListExample) that includes a JsonApiDotNetCore API and an EmberJs client. ## Installation and Usage @@ -82,45 +82,24 @@ public class Startup } ``` -## Development - -Restore all NuGet packages with: - -```bash -dotnet restore -``` +## Compatibility -### Testing +A lot of changes were introduced in v4. The following chart should help you pick the best version, based on your environment. -Running tests locally requires access to a PostgreSQL database. If you have docker installed, this can be propped up via: +| .NET Version | EF Core Version | JsonApiDotNetCore Version | +| ----------------- | --------------- | ------------------------- | +| .NET Core 2.x | 2.x | v3.x | +| .NET Core 3.1 | 3.1, 5 | v4 | +| .NET 5 | 5 | v4 | -```bash -docker run --rm --name jsonapi-dotnet-core-testing -e POSTGRES_DB=JsonApiDotNetCoreExample -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres:12.0 -``` - -And then to run the tests: - -```bash -dotnet test -``` ## Contributing Have a question, found a bug or want to submit code changes? See our [contributing guidelines](./.github/CONTRIBUTING.md). -## Compatibility +## Trying out the latest build -A lot of changes were introduced in v4, the following chart should help you with compatibility issues between .NET Core versions. - -| .NET Core Version | EF Core Version | JADNC Version | -| ----------------- | --------------- | ------------- | -| 2.x | 2.x | v3.x | -| 3.x | 3.x, 5.x | v4.x | -| 5.x | 5.x | v4.x | - -### Trying out the latest build - -After each commit, a new prerelease NuGet package is automatically published to AppVeyor at https://ci.appveyor.com/nuget/jsonapidotnetcore. To try it out, follow the next steps: +After each commit to the master branch, a new prerelease NuGet package is automatically published to AppVeyor at https://ci.appveyor.com/nuget/jsonapidotnetcore. To try it out, follow the next steps: * In Visual Studio: **Tools**, **NuGet Package Manager**, **Package Manager Settings**, **Package Sources** * Click **+** @@ -129,3 +108,29 @@ After each commit, a new prerelease NuGet package is automatically published to * Open the NuGet package manager console (**Tools**, **NuGet Package Manager**, **Package Manager Console**) * Select **AppVeyor JADNC** as package source * Run command: `Install-Package JonApiDotNetCore -pre` + +## Development + +To build the code from this repository locally, run: + +```bash +dotnet build +``` + +Running tests locally requires access to a PostgreSQL database. If you have docker installed, this can be propped up via: + +```bash +run-docker-postgres.ps1 +``` + +And then to run the tests: + +```bash +dotnet test +``` + +Alternatively, to build and validate the code, run all tests, generate code coverage and produce the NuGet package: + +```bash +Build.ps1 +``` From 110fd79182fddb8f01ae6e5833fa8aad318a9159 Mon Sep 17 00:00:00 2001 From: Bart Koelman Date: Fri, 9 Apr 2021 10:07:23 +0200 Subject: [PATCH 09/16] Fix failing builds during force-pushes --- Build.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Build.ps1 b/Build.ps1 index 7da0003162..a2bad43720 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -39,15 +39,15 @@ function RunCleanupCode { # When running in cibuild for a pull request, this reformats only the files changed in the PR and fails if the reformat produces changes. if ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT) { - Write-Output "Running code cleanup in cibuild for pull request" + Write-Output "Running code cleanup on changed files in pull request" - $sourceCommitHash = $env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT + # In the past, we used $env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT for the merge commit hash. That is the pinned hash at the time the build is enqueued. + # When a force-push happens after that, while the build hasn't yet started, this hash becomes invalid during the build, resulting in a lookup error. + # To prevent failing the build for unobvious reasons we use HEAD, which is always the latest version. + $mergeCommitHash = git rev-parse "HEAD" $targetCommitHash = git rev-parse "$env:APPVEYOR_REPO_BRANCH" - Write-Output "Source commit hash = $sourceCommitHash" - Write-Output "Target commit hash = $targetCommitHash" - - dotnet regitlint -s JsonApiDotNetCore.sln --print-command --jb --profile --jb --profile='\"JADNC Full Cleanup\"' --jb --properties:Configuration=Release --jb --verbosity=WARN -f commits -a $sourceCommitHash -b $targetCommitHash --fail-on-diff --print-diff + dotnet regitlint -s JsonApiDotNetCore.sln --print-command --jb --profile --jb --profile='\"JADNC Full Cleanup\"' --jb --properties:Configuration=Release --jb --verbosity=WARN -f commits -a $mergeCommitHash -b $targetCommitHash --fail-on-diff --print-diff CheckLastExitCode } } From c97431249727076af6b4f5023d3ea39ad9b80af2 Mon Sep 17 00:00:00 2001 From: Bart Koelman Date: Fri, 9 Apr 2021 10:19:18 +0200 Subject: [PATCH 10/16] Fixed whitespace --- Build.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Build.ps1 b/Build.ps1 index a2bad43720..0ba8757e19 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -76,10 +76,10 @@ function CreateNuGetPackage { # Get the version suffix from the auto-incrementing build number. Example: "123" => "pre-0123". if ($env:APPVEYOR_BUILD_NUMBER) { $revision = "{0:D4}" -f [convert]::ToInt32($env:APPVEYOR_BUILD_NUMBER, 10) - $versionSuffix="pre-$revision" + $versionSuffix = "pre-$revision" } else { - $versionSuffix="pre-0001" + $versionSuffix = "pre-0001" } } From 5825197dcdf03b8a67029bfaa025a5b9b533db2c Mon Sep 17 00:00:00 2001 From: Bart Koelman Date: Fri, 9 Apr 2021 13:24:07 +0200 Subject: [PATCH 11/16] Corrected ctor parameter order in readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a13609b8ac..c5c02987c6 100644 --- a/README.md +++ b/README.md @@ -55,9 +55,9 @@ public class Article : Identifiable ```c# public class ArticlesController : JsonApiController
{ - public ArticlesController(IJsonApiOptions options, IResourceService
resourceService, - ILoggerFactory loggerFactory) - : base(options, resourceService, loggerFactory) + public ArticlesController(IJsonApiOptions options, ILoggerFactory loggerFactory, + IResourceService
resourceService,) + : base(options, loggerFactory, resourceService) { } } From eb6d45e42ef55410b2a5748723c7dbda7da4d76c Mon Sep 17 00:00:00 2001 From: Bart Koelman Date: Fri, 9 Apr 2021 13:25:05 +0200 Subject: [PATCH 12/16] Rename settings file --- Build.ps1 | 2 +- ...rningSeverities.DotSettings => WarningSeverities.DotSettings | 0 inspectcode.ps1 | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename JsonApiDotNetCore-WarningSeverities.DotSettings => WarningSeverities.DotSettings (100%) diff --git a/Build.ps1 b/Build.ps1 index 0ba8757e19..ee1dd68cfb 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -8,7 +8,7 @@ function CheckLastExitCode { function RunInspectCode { $outputPath = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), 'jetbrains-inspectcode-results.xml') - dotnet jb inspectcode JsonApiDotNetCore.sln --output="$outputPath" --profile=JsonApiDotNetCore-WarningSeverities.DotSettings --properties:Configuration=Release --severity=WARNING --verbosity=WARN -dsl=GlobalAll -dsl=SolutionPersonal -dsl=ProjectPersonal + dotnet jb inspectcode JsonApiDotNetCore.sln --output="$outputPath" --profile=WarningSeverities.DotSettings --properties:Configuration=Release --severity=WARNING --verbosity=WARN -dsl=GlobalAll -dsl=SolutionPersonal -dsl=ProjectPersonal CheckLastExitCode [xml]$xml = Get-Content "$outputPath" diff --git a/JsonApiDotNetCore-WarningSeverities.DotSettings b/WarningSeverities.DotSettings similarity index 100% rename from JsonApiDotNetCore-WarningSeverities.DotSettings rename to WarningSeverities.DotSettings diff --git a/inspectcode.ps1 b/inspectcode.ps1 index 355b8f20dd..ab4b9c95dd 100644 --- a/inspectcode.ps1 +++ b/inspectcode.ps1 @@ -16,7 +16,7 @@ if ($LASTEXITCODE -ne 0) { $outputPath = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), 'jetbrains-inspectcode-results.xml') $resultPath = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), 'jetbrains-inspectcode-results.html') -dotnet jb inspectcode JsonApiDotNetCore.sln --output="$outputPath" --profile=JsonApiDotNetCore-WarningSeverities.DotSettings --properties:Configuration=Release --severity=WARNING --verbosity=WARN -dsl=GlobalAll -dsl=SolutionPersonal -dsl=ProjectPersonal +dotnet jb inspectcode JsonApiDotNetCore.sln --output="$outputPath" --profile=WarningSeverities.DotSettings --properties:Configuration=Release --severity=WARNING --verbosity=WARN -dsl=GlobalAll -dsl=SolutionPersonal -dsl=ProjectPersonal if ($LASTEXITCODE -ne 0) { throw "Code inspection failed with exit code $LASTEXITCODE" From c418724a60f5d1200c587877da8fa8b803078907 Mon Sep 17 00:00:00 2001 From: Bart Koelman Date: Fri, 9 Apr 2021 13:54:24 +0200 Subject: [PATCH 13/16] Added boilerplate comments on Startup classes, updated link to docs --- src/Examples/GettingStarted/README.md | 2 +- src/Examples/JsonApiDotNetCoreExample/Startups/EmptyStartup.cs | 2 ++ src/Examples/JsonApiDotNetCoreExample/Startups/Startup.cs | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Examples/GettingStarted/README.md b/src/Examples/GettingStarted/README.md index d79afbd494..571311caf8 100644 --- a/src/Examples/GettingStarted/README.md +++ b/src/Examples/GettingStarted/README.md @@ -11,4 +11,4 @@ For further documentation and implementation of a JsonApiDotnetCore Application Repository: https://github.com/json-api-dotnet/JsonApiDotNetCore -Documentation: https://json-api-dotnet.github.io/ +Documentation: http://www.jsonapi.net diff --git a/src/Examples/JsonApiDotNetCoreExample/Startups/EmptyStartup.cs b/src/Examples/JsonApiDotNetCoreExample/Startups/EmptyStartup.cs index 19879aef27..4badc0548f 100644 --- a/src/Examples/JsonApiDotNetCoreExample/Startups/EmptyStartup.cs +++ b/src/Examples/JsonApiDotNetCoreExample/Startups/EmptyStartup.cs @@ -10,10 +10,12 @@ namespace JsonApiDotNetCoreExample.Startups /// public abstract class EmptyStartup { + // This method gets called by the runtime. Use this method to add services to the container. public virtual void ConfigureServices(IServiceCollection services) { } + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment environment) { } diff --git a/src/Examples/JsonApiDotNetCoreExample/Startups/Startup.cs b/src/Examples/JsonApiDotNetCoreExample/Startups/Startup.cs index 8a107a1c25..c8bd15bffa 100644 --- a/src/Examples/JsonApiDotNetCoreExample/Startups/Startup.cs +++ b/src/Examples/JsonApiDotNetCoreExample/Startups/Startup.cs @@ -22,6 +22,7 @@ public Startup(IConfiguration configuration) _connectionString = configuration["Data:DefaultConnection"].Replace("###", postgresPassword); } + // This method gets called by the runtime. Use this method to add services to the container. public override void ConfigureServices(IServiceCollection services) { services.AddSingleton(); @@ -42,6 +43,7 @@ private void ConfigureJsonApiOptions(JsonApiOptions options) options.SerializerSettings.Converters.Add(new StringEnumConverter()); } + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public override void Configure(IApplicationBuilder app, IWebHostEnvironment environment) { using (IServiceScope scope = app.ApplicationServices.CreateScope()) From 2e735e5277bc332c2962e9ac1810c8356cc1472d Mon Sep 17 00:00:00 2001 From: Bart Koelman Date: Fri, 9 Apr 2021 15:15:50 +0200 Subject: [PATCH 14/16] Revert comments on EmptyStartup --- src/Examples/JsonApiDotNetCoreExample/Startups/EmptyStartup.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Examples/JsonApiDotNetCoreExample/Startups/EmptyStartup.cs b/src/Examples/JsonApiDotNetCoreExample/Startups/EmptyStartup.cs index 4badc0548f..19879aef27 100644 --- a/src/Examples/JsonApiDotNetCoreExample/Startups/EmptyStartup.cs +++ b/src/Examples/JsonApiDotNetCoreExample/Startups/EmptyStartup.cs @@ -10,12 +10,10 @@ namespace JsonApiDotNetCoreExample.Startups /// public abstract class EmptyStartup { - // This method gets called by the runtime. Use this method to add services to the container. public virtual void ConfigureServices(IServiceCollection services) { } - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment environment) { } From 20d7372d8ad6731196a1c416dedc1e7c8ebe9584 Mon Sep 17 00:00:00 2001 From: Bart Koelman Date: Fri, 9 Apr 2021 15:32:24 +0200 Subject: [PATCH 15/16] Mentioned atomic:operations in documentation This also serves as a test for docs deployment, which only happens when merging into the master branch. --- README.md | 2 +- docs/home/index.html | 4 ++-- src/JsonApiDotNetCore/JsonApiDotNetCore.csproj | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c5c02987c6..13b8ecd6d6 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@

# JsonApiDotNetCore -A framework for building [JSON:API](http://jsonapi.org/) compliant REST APIs using .NET Core and Entity Framework Core. +A framework for building [JSON:API](http://jsonapi.org/) compliant REST APIs using .NET Core and Entity Framework Core. Includes support for [Atomic Operations](https://jsonapi.org/ext/atomic/). [![Build](https://ci.appveyor.com/api/projects/status/t8noo6rjtst51kga/branch/master?svg=true)](https://ci.appveyor.com/project/json-api-dotnet/jsonapidotnetcore/branch/master) [![Coverage](https://codecov.io/gh/json-api-dotnet/JsonApiDotNetCore/branch/master/graph/badge.svg?token=pn036tWV8T)](https://codecov.io/gh/json-api-dotnet/JsonApiDotNetCore) diff --git a/docs/home/index.html b/docs/home/index.html index 5b837cda02..661819f3f6 100644 --- a/docs/home/index.html +++ b/docs/home/index.html @@ -4,7 +4,7 @@ JsonApiDotNetCore documentation - + @@ -22,7 +22,7 @@

JsonApiDotNetCore

-

A framework for building JSON:API compliant REST APIs using .NET Core and Entity Framework Core

+

A framework for building JSON:API compliant REST APIs using .NET Core and Entity Framework Core. Includes support for Atomic Operations.

Read more Getting started Contribute on GitHub diff --git a/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj b/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj index 3ea2657587..c5e378e06b 100644 --- a/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj +++ b/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj @@ -7,7 +7,7 @@ jsonapidotnetcore;jsonapi;json:api;dotnet;asp.net - A framework for building JSON:API compliant web APIs. The ultimate goal of this library is to eliminate as much boilerplate as possible by offering out-of-the-box features such as sorting, filtering and pagination. You just need to focus on defining the resources and implementing your custom business logic. This library has been designed around dependency injection making extensibility incredibly easy. + A framework for building JSON:API compliant REST APIs using .NET Core and Entity Framework Core. Includes support for Atomic Operations. The ultimate goal of this library is to eliminate as much boilerplate as possible by offering out-of-the-box features such as sorting, filtering and pagination. You just need to focus on defining the resources and implementing your custom business logic. This library has been designed around dependency injection making extensibility incredibly easy. https://github.com/json-api-dotnet/JsonApiDotNetCore MIT false From 1c073ddb7f20b42aa2541128110b30f74cac6ad4 Mon Sep 17 00:00:00 2001 From: Bart Koelman Date: Fri, 9 Apr 2021 15:40:36 +0200 Subject: [PATCH 16/16] Make RuntimeTypeConverter pubternal --- .../Internal/QueryableBuilding/WhereClauseBuilder.cs | 1 + src/JsonApiDotNetCore/Resources/Identifiable.cs | 1 + .../{ => Resources/Internal}/RuntimeTypeConverter.cs | 6 ++++-- src/JsonApiDotNetCore/Serialization/BaseDeserializer.cs | 1 + .../Serialization/Building/ResourceObjectBuilder.cs | 1 + src/JsonApiDotNetCore/Serialization/RequestDeserializer.cs | 1 + test/UnitTests/Internal/RuntimeTypeConverterTests.cs | 2 +- 7 files changed, 10 insertions(+), 3 deletions(-) rename src/JsonApiDotNetCore/{ => Resources/Internal}/RuntimeTypeConverter.cs (95%) diff --git a/src/JsonApiDotNetCore/Queries/Internal/QueryableBuilding/WhereClauseBuilder.cs b/src/JsonApiDotNetCore/Queries/Internal/QueryableBuilding/WhereClauseBuilder.cs index 6c03f24d23..823d532639 100644 --- a/src/JsonApiDotNetCore/Queries/Internal/QueryableBuilding/WhereClauseBuilder.cs +++ b/src/JsonApiDotNetCore/Queries/Internal/QueryableBuilding/WhereClauseBuilder.cs @@ -7,6 +7,7 @@ using JsonApiDotNetCore.Errors; using JsonApiDotNetCore.Queries.Expressions; using JsonApiDotNetCore.Resources.Annotations; +using JsonApiDotNetCore.Resources.Internal; namespace JsonApiDotNetCore.Queries.Internal.QueryableBuilding { diff --git a/src/JsonApiDotNetCore/Resources/Identifiable.cs b/src/JsonApiDotNetCore/Resources/Identifiable.cs index 121f7b65d4..aada6b312a 100644 --- a/src/JsonApiDotNetCore/Resources/Identifiable.cs +++ b/src/JsonApiDotNetCore/Resources/Identifiable.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; +using JsonApiDotNetCore.Resources.Internal; namespace JsonApiDotNetCore.Resources { diff --git a/src/JsonApiDotNetCore/RuntimeTypeConverter.cs b/src/JsonApiDotNetCore/Resources/Internal/RuntimeTypeConverter.cs similarity index 95% rename from src/JsonApiDotNetCore/RuntimeTypeConverter.cs rename to src/JsonApiDotNetCore/Resources/Internal/RuntimeTypeConverter.cs index 1b4790cdd9..b05acd5eba 100644 --- a/src/JsonApiDotNetCore/RuntimeTypeConverter.cs +++ b/src/JsonApiDotNetCore/Resources/Internal/RuntimeTypeConverter.cs @@ -1,10 +1,12 @@ using System; +using JetBrains.Annotations; #pragma warning disable AV1008 // Class should not be static -namespace JsonApiDotNetCore +namespace JsonApiDotNetCore.Resources.Internal { - internal static class RuntimeTypeConverter + [PublicAPI] + public static class RuntimeTypeConverter { public static object ConvertType(object value, Type type) { diff --git a/src/JsonApiDotNetCore/Serialization/BaseDeserializer.cs b/src/JsonApiDotNetCore/Serialization/BaseDeserializer.cs index f716b87ac2..6d7bccfe47 100644 --- a/src/JsonApiDotNetCore/Serialization/BaseDeserializer.cs +++ b/src/JsonApiDotNetCore/Serialization/BaseDeserializer.cs @@ -7,6 +7,7 @@ using JsonApiDotNetCore.Configuration; using JsonApiDotNetCore.Resources; using JsonApiDotNetCore.Resources.Annotations; +using JsonApiDotNetCore.Resources.Internal; using JsonApiDotNetCore.Serialization.Client.Internal; using JsonApiDotNetCore.Serialization.Objects; using Newtonsoft.Json; diff --git a/src/JsonApiDotNetCore/Serialization/Building/ResourceObjectBuilder.cs b/src/JsonApiDotNetCore/Serialization/Building/ResourceObjectBuilder.cs index b1ad1d7f72..3f9e0b3a8e 100644 --- a/src/JsonApiDotNetCore/Serialization/Building/ResourceObjectBuilder.cs +++ b/src/JsonApiDotNetCore/Serialization/Building/ResourceObjectBuilder.cs @@ -4,6 +4,7 @@ using JsonApiDotNetCore.Configuration; using JsonApiDotNetCore.Resources; using JsonApiDotNetCore.Resources.Annotations; +using JsonApiDotNetCore.Resources.Internal; using JsonApiDotNetCore.Serialization.Objects; using Newtonsoft.Json; diff --git a/src/JsonApiDotNetCore/Serialization/RequestDeserializer.cs b/src/JsonApiDotNetCore/Serialization/RequestDeserializer.cs index 6324d01a62..52e8db1fb0 100644 --- a/src/JsonApiDotNetCore/Serialization/RequestDeserializer.cs +++ b/src/JsonApiDotNetCore/Serialization/RequestDeserializer.cs @@ -9,6 +9,7 @@ using JsonApiDotNetCore.Middleware; using JsonApiDotNetCore.Resources; using JsonApiDotNetCore.Resources.Annotations; +using JsonApiDotNetCore.Resources.Internal; using JsonApiDotNetCore.Serialization.Objects; using Microsoft.AspNetCore.Http; using Newtonsoft.Json.Linq; diff --git a/test/UnitTests/Internal/RuntimeTypeConverterTests.cs b/test/UnitTests/Internal/RuntimeTypeConverterTests.cs index ab5eac2cc4..b2162841b6 100644 --- a/test/UnitTests/Internal/RuntimeTypeConverterTests.cs +++ b/test/UnitTests/Internal/RuntimeTypeConverterTests.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using JsonApiDotNetCore; +using JsonApiDotNetCore.Resources.Internal; using Xunit; namespace UnitTests.Internal