From 10e8c62d32af967114441d666a4cfc6a221227aa Mon Sep 17 00:00:00 2001
From: Bart Koelman <10324372+bkoelman@users.noreply.github.com>
Date: Thu, 21 Sep 2023 12:02:34 +0200
Subject: [PATCH 01/19] Create FUNDING.yml
---
.github/FUNDING.yml | 1 +
1 file changed, 1 insertion(+)
create mode 100644 .github/FUNDING.yml
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000000..b065d30682
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1 @@
+github: json-api-dotnet
From c6d7ba3d6dc891be26fd825a97c19190144d1adb Mon Sep 17 00:00:00 2001
From: Bart Koelman <10324372+bkoelman@users.noreply.github.com>
Date: Thu, 21 Sep 2023 12:12:58 +0200
Subject: [PATCH 02/19] Update docs
---
docs/getting-started/faq.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/getting-started/faq.md b/docs/getting-started/faq.md
index e1caa85797..574ebaf92c 100644
--- a/docs/getting-started/faq.md
+++ b/docs/getting-started/faq.md
@@ -158,8 +158,8 @@ We use a similar approach for accessing [MongoDB](https://github.com/json-api-do
#### I love JsonApiDotNetCore! How can I support the team?
The best way to express your gratitude is by starring our repository.
This increases our leverage when asking for bug fixes in dependent projects, such as the .NET runtime and Entity Framework Core.
+You can also [sponsor](https://github.com/sponsors/json-api-dotnet) our project.
Of course, a simple thank-you message in our [Gitter channel](https://gitter.im/json-api-dotnet-core/Lobby) is appreciated too!
-We don't take monetary contributions at the moment.
If you'd like to do more: try things out, ask questions, create GitHub bug reports or feature requests, or upvote existing issues that are important to you.
We welcome PRs, but keep in mind: The worst thing in the world is opening a PR that gets rejected after you've put a lot of effort into it.
From 8738b7245398d6f3a56e59c8092e04b9d017cba2 Mon Sep 17 00:00:00 2001
From: Bart Koelman <10324372+bkoelman@users.noreply.github.com>
Date: Fri, 22 Sep 2023 23:17:44 +0200
Subject: [PATCH 03/19] GitHub Actions: Install latest PowerShell version on
Windows
---
.github/workflows/build.yml | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index a3e5307053..10368bfa7c 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -52,12 +52,27 @@ jobs:
if: matrix.os == 'ubuntu-latest'
run: |
dotnet tool install --global PowerShell
+ - name: Find latest PowerShell version (Windows)
+ if: matrix.os == 'windows-latest'
+ shell: pwsh
+ run: |
+ $packageName = "powershell"
+ $outputText = dotnet tool search $packageName --take 1
+ $outputLine = ("" + $outputText)
+ $indexOfVersionLine = $outputLine.IndexOf($packageName)
+ $latestVersion = $outputLine.substring($indexOfVersionLine + $packageName.length).trim().split(" ")[0].trim()
+
+ Write-Output "Found PowerShell version: $latestVersion"
+ Write-Output "POWERSHELL_LATEST_VERSION=$latestVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Setup PowerShell (Windows)
if: matrix.os == 'windows-latest'
shell: cmd
run: |
- curl --location --output "%RUNNER_TEMP%\PowerShell-7.3.6-win-x64.msi" https://github.com/PowerShell/PowerShell/releases/download/v7.3.6/PowerShell-7.3.6-win-x64.msi
- msiexec.exe /package "%RUNNER_TEMP%\PowerShell-7.3.6-win-x64.msi" /quiet USE_MU=1 ENABLE_MU=1 ADD_PATH=1 DISABLE_TELEMETRY=1
+ set DOWNLOAD_LINK=https://github.com/PowerShell/PowerShell/releases/download/v%POWERSHELL_LATEST_VERSION%/PowerShell-%POWERSHELL_LATEST_VERSION%-win-x64.msi
+ set OUTPUT_PATH=%RUNNER_TEMP%\PowerShell-%POWERSHELL_LATEST_VERSION%-win-x64.msi
+ echo Downloading from: %DOWNLOAD_LINK% to: %OUTPUT_PATH%
+ curl --location --output %OUTPUT_PATH% %DOWNLOAD_LINK%
+ msiexec.exe /package %OUTPUT_PATH% /quiet USE_MU=1 ENABLE_MU=1 ADD_PATH=1 DISABLE_TELEMETRY=1
- name: Setup PowerShell (macOS)
if: matrix.os == 'macos-latest'
run: |
From cb8f63002c037750b01bd913888f1c46423f15af Mon Sep 17 00:00:00 2001
From: Bart Koelman <10324372+bkoelman@users.noreply.github.com>
Date: Fri, 22 Sep 2023 23:49:10 +0200
Subject: [PATCH 04/19] Swap order of steps
---
.github/workflows/build.yml | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 10368bfa7c..aad9c0a311 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -175,12 +175,12 @@ jobs:
permissions:
contents: read
steps:
- - name: Git checkout
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
+ - name: Git checkout
+ uses: actions/checkout@v4
- name: Restore tools
run: |
dotnet tool restore
@@ -226,14 +226,14 @@ jobs:
permissions:
contents: read
steps:
- - name: Git checkout
- uses: actions/checkout@v4
- with:
- fetch-depth: 2
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
+ - name: Git checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 2
- name: Restore tools
run: |
dotnet tool restore
From b79215b93dd935594594f9a4d0d2dd8e665c9691 Mon Sep 17 00:00:00 2001
From: Bart Koelman <10324372+bkoelman@users.noreply.github.com>
Date: Sat, 23 Sep 2023 00:15:56 +0200
Subject: [PATCH 05/19] GitHub Actions: Setup CodeQL
---
.github/workflows/codeql.yml | 81 ++++++++++++++++++++++++++++++++++++
1 file changed, 81 insertions(+)
create mode 100644 .github/workflows/codeql.yml
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
new file mode 100644
index 0000000000..40a67bbd19
--- /dev/null
+++ b/.github/workflows/codeql.yml
@@ -0,0 +1,81 @@
+# For most projects, this workflow file will not need changing; you simply need
+# to commit it to your repository.
+#
+# You may wish to alter this file to override the set of languages analyzed,
+# or to provide custom queries or build logic.
+#
+# ******** NOTE ********
+# We have attempted to detect the languages in your repository. Please check
+# the `language` matrix defined below to confirm you have the correct set of
+# supported CodeQL languages.
+#
+name: "CodeQL"
+
+on:
+ push:
+ branches: [ "master", "openapi" ]
+ pull_request:
+ # The branches below must be a subset of the branches above
+ branches: [ "master" ]
+ schedule:
+ - cron: '31 0 * * 6'
+
+jobs:
+ analyze:
+ name: Analyze
+ # Runner size impacts CodeQL analysis time. To learn more, please see:
+ # - https://gh.io/recommended-hardware-resources-for-running-codeql
+ # - https://gh.io/supported-runners-and-hardware-resources
+ # - https://gh.io/using-larger-runners
+ # Consider using larger runners for possible analysis time improvements.
+ runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
+ timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
+ permissions:
+ actions: read
+ contents: read
+ security-events: write
+
+ strategy:
+ fail-fast: false
+ matrix:
+ language: [ 'csharp' ]
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
+ # Use only 'java' to analyze code written in Java, Kotlin or both
+ # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
+ # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ # Initializes the CodeQL tools for scanning.
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v2
+ with:
+ languages: ${{ matrix.language }}
+ # If you wish to specify custom queries, you can do so here or in a config file.
+ # By default, queries listed here will override any specified in a config file.
+ # Prefix the list here with "+" to use these queries and those in the config file.
+
+ # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
+ # queries: security-extended,security-and-quality
+
+ # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
+ # If this step fails, then you should remove it and run the build manually (see below)
+ - name: Autobuild
+ uses: github/codeql-action/autobuild@v2
+
+ # âšī¸ Command-line programs to run using the OS shell.
+ # đ See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
+
+ # If the Autobuild fails above, remove it and uncomment the following three lines.
+ # modify them (or add more) to build your code in your project, please refer to the EXAMPLE below for guidance.
+
+ # - run: |
+ # echo "Run, Build Application using script"
+ # ./location_of_script_within_repo/buildscript.sh
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v2
+ with:
+ category: "/language:${{matrix.language}}"
From 945d709a177a8cfbececfbaa5e5d21a44ef08f96 Mon Sep 17 00:00:00 2001
From: Bart Koelman <10324372+bkoelman@users.noreply.github.com>
Date: Sat, 23 Sep 2023 00:36:11 +0200
Subject: [PATCH 06/19] Revert "GitHub Actions: Setup CodeQL"
This reverts commit b79215b93dd935594594f9a4d0d2dd8e665c9691.
---
.github/workflows/codeql.yml | 81 ------------------------------------
1 file changed, 81 deletions(-)
delete mode 100644 .github/workflows/codeql.yml
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
deleted file mode 100644
index 40a67bbd19..0000000000
--- a/.github/workflows/codeql.yml
+++ /dev/null
@@ -1,81 +0,0 @@
-# For most projects, this workflow file will not need changing; you simply need
-# to commit it to your repository.
-#
-# You may wish to alter this file to override the set of languages analyzed,
-# or to provide custom queries or build logic.
-#
-# ******** NOTE ********
-# We have attempted to detect the languages in your repository. Please check
-# the `language` matrix defined below to confirm you have the correct set of
-# supported CodeQL languages.
-#
-name: "CodeQL"
-
-on:
- push:
- branches: [ "master", "openapi" ]
- pull_request:
- # The branches below must be a subset of the branches above
- branches: [ "master" ]
- schedule:
- - cron: '31 0 * * 6'
-
-jobs:
- analyze:
- name: Analyze
- # Runner size impacts CodeQL analysis time. To learn more, please see:
- # - https://gh.io/recommended-hardware-resources-for-running-codeql
- # - https://gh.io/supported-runners-and-hardware-resources
- # - https://gh.io/using-larger-runners
- # Consider using larger runners for possible analysis time improvements.
- runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
- timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
- permissions:
- actions: read
- contents: read
- security-events: write
-
- strategy:
- fail-fast: false
- matrix:
- language: [ 'csharp' ]
- # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
- # Use only 'java' to analyze code written in Java, Kotlin or both
- # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
- # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
-
- steps:
- - name: Checkout repository
- uses: actions/checkout@v4
-
- # Initializes the CodeQL tools for scanning.
- - name: Initialize CodeQL
- uses: github/codeql-action/init@v2
- with:
- languages: ${{ matrix.language }}
- # If you wish to specify custom queries, you can do so here or in a config file.
- # By default, queries listed here will override any specified in a config file.
- # Prefix the list here with "+" to use these queries and those in the config file.
-
- # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
- # queries: security-extended,security-and-quality
-
- # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
- # If this step fails, then you should remove it and run the build manually (see below)
- - name: Autobuild
- uses: github/codeql-action/autobuild@v2
-
- # âšī¸ Command-line programs to run using the OS shell.
- # đ See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
-
- # If the Autobuild fails above, remove it and uncomment the following three lines.
- # modify them (or add more) to build your code in your project, please refer to the EXAMPLE below for guidance.
-
- # - run: |
- # echo "Run, Build Application using script"
- # ./location_of_script_within_repo/buildscript.sh
-
- - name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v2
- with:
- category: "/language:${{matrix.language}}"
From acac395e61fd7413a29c7ab4931813cf48bd4786 Mon Sep 17 00:00:00 2001
From: Bart Koelman <10324372+bkoelman@users.noreply.github.com>
Date: Sat, 23 Sep 2023 00:41:49 +0200
Subject: [PATCH 07/19] GitHub Actions: Setup CodeQL (Advanced)
---
.github/workflows/codeql.yml | 81 ++++++++++++++++++++++++++++++++++++
1 file changed, 81 insertions(+)
create mode 100644 .github/workflows/codeql.yml
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
new file mode 100644
index 0000000000..0a058b18f4
--- /dev/null
+++ b/.github/workflows/codeql.yml
@@ -0,0 +1,81 @@
+# For most projects, this workflow file will not need changing; you simply need
+# to commit it to your repository.
+#
+# You may wish to alter this file to override the set of languages analyzed,
+# or to provide custom queries or build logic.
+#
+# ******** NOTE ********
+# We have attempted to detect the languages in your repository. Please check
+# the `language` matrix defined below to confirm you have the correct set of
+# supported CodeQL languages.
+#
+name: "CodeQL"
+
+on:
+ push:
+ branches: [ "master", "openapi" ]
+ pull_request:
+ # The branches below must be a subset of the branches above
+ branches: [ "master" ]
+ schedule:
+ - cron: '0 1 * * 0'
+
+jobs:
+ analyze:
+ name: Analyze
+ # Runner size impacts CodeQL analysis time. To learn more, please see:
+ # - https://gh.io/recommended-hardware-resources-for-running-codeql
+ # - https://gh.io/supported-runners-and-hardware-resources
+ # - https://gh.io/using-larger-runners
+ # Consider using larger runners for possible analysis time improvements.
+ runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
+ timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
+ permissions:
+ actions: read
+ contents: read
+ security-events: write
+
+ strategy:
+ fail-fast: false
+ matrix:
+ language: [ 'csharp' ]
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
+ # Use only 'java' to analyze code written in Java, Kotlin or both
+ # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
+ # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ # Initializes the CodeQL tools for scanning.
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v2
+ with:
+ languages: ${{ matrix.language }}
+ # If you wish to specify custom queries, you can do so here or in a config file.
+ # By default, queries listed here will override any specified in a config file.
+ # Prefix the list here with "+" to use these queries and those in the config file.
+
+ # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
+ # queries: security-extended,security-and-quality
+
+ # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
+ # If this step fails, then you should remove it and run the build manually (see below)
+ - name: Autobuild
+ uses: github/codeql-action/autobuild@v2
+
+ # âšī¸ Command-line programs to run using the OS shell.
+ # đ See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
+
+ # If the Autobuild fails above, remove it and uncomment the following three lines.
+ # modify them (or add more) to build your code in your project, please refer to the EXAMPLE below for guidance.
+
+ # - run: |
+ # echo "Run, Build Application using script"
+ # ./location_of_script_within_repo/buildscript.sh
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v2
+ with:
+ category: "/language:${{matrix.language}}"
From c0aee33f24b52ed65ab1466d741c3040887fc228 Mon Sep 17 00:00:00 2001
From: Bart Koelman <10324372+bkoelman@users.noreply.github.com>
Date: Sat, 23 Sep 2023 00:43:04 +0200
Subject: [PATCH 08/19] Revert "GitHub Actions: Setup CodeQL (Advanced)"
This reverts commit acac395e61fd7413a29c7ab4931813cf48bd4786.
---
.github/workflows/codeql.yml | 81 ------------------------------------
1 file changed, 81 deletions(-)
delete mode 100644 .github/workflows/codeql.yml
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
deleted file mode 100644
index 0a058b18f4..0000000000
--- a/.github/workflows/codeql.yml
+++ /dev/null
@@ -1,81 +0,0 @@
-# For most projects, this workflow file will not need changing; you simply need
-# to commit it to your repository.
-#
-# You may wish to alter this file to override the set of languages analyzed,
-# or to provide custom queries or build logic.
-#
-# ******** NOTE ********
-# We have attempted to detect the languages in your repository. Please check
-# the `language` matrix defined below to confirm you have the correct set of
-# supported CodeQL languages.
-#
-name: "CodeQL"
-
-on:
- push:
- branches: [ "master", "openapi" ]
- pull_request:
- # The branches below must be a subset of the branches above
- branches: [ "master" ]
- schedule:
- - cron: '0 1 * * 0'
-
-jobs:
- analyze:
- name: Analyze
- # Runner size impacts CodeQL analysis time. To learn more, please see:
- # - https://gh.io/recommended-hardware-resources-for-running-codeql
- # - https://gh.io/supported-runners-and-hardware-resources
- # - https://gh.io/using-larger-runners
- # Consider using larger runners for possible analysis time improvements.
- runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
- timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
- permissions:
- actions: read
- contents: read
- security-events: write
-
- strategy:
- fail-fast: false
- matrix:
- language: [ 'csharp' ]
- # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
- # Use only 'java' to analyze code written in Java, Kotlin or both
- # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
- # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
-
- steps:
- - name: Checkout repository
- uses: actions/checkout@v3
-
- # Initializes the CodeQL tools for scanning.
- - name: Initialize CodeQL
- uses: github/codeql-action/init@v2
- with:
- languages: ${{ matrix.language }}
- # If you wish to specify custom queries, you can do so here or in a config file.
- # By default, queries listed here will override any specified in a config file.
- # Prefix the list here with "+" to use these queries and those in the config file.
-
- # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
- # queries: security-extended,security-and-quality
-
- # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
- # If this step fails, then you should remove it and run the build manually (see below)
- - name: Autobuild
- uses: github/codeql-action/autobuild@v2
-
- # âšī¸ Command-line programs to run using the OS shell.
- # đ See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
-
- # If the Autobuild fails above, remove it and uncomment the following three lines.
- # modify them (or add more) to build your code in your project, please refer to the EXAMPLE below for guidance.
-
- # - run: |
- # echo "Run, Build Application using script"
- # ./location_of_script_within_repo/buildscript.sh
-
- - name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v2
- with:
- category: "/language:${{matrix.language}}"
From bca7bf369df78db9e80a3e3d5bcfb34964fc83a0 Mon Sep 17 00:00:00 2001
From: Bart Koelman <10324372+bkoelman@users.noreply.github.com>
Date: Sat, 23 Sep 2023 01:31:49 +0200
Subject: [PATCH 09/19] Fix code scanning alerts (log forgery)
---
src/JsonApiDotNetCore/Middleware/JsonApiMiddleware.cs | 3 ++-
.../Serialization/Request/JsonApiReader.cs | 3 ++-
.../Serialization/Response/JsonApiWriter.cs | 7 ++++++-
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/JsonApiDotNetCore/Middleware/JsonApiMiddleware.cs b/src/JsonApiDotNetCore/Middleware/JsonApiMiddleware.cs
index 29774c6eab..40a784d25c 100644
--- a/src/JsonApiDotNetCore/Middleware/JsonApiMiddleware.cs
+++ b/src/JsonApiDotNetCore/Middleware/JsonApiMiddleware.cs
@@ -92,7 +92,8 @@ public async Task InvokeAsync(HttpContext httpContext, IControllerResourceMappin
{
string timingResults = CodeTimingSessionManager.Current.GetResults();
string url = httpContext.Request.GetDisplayUrl();
- logger.LogInformation($"Measurement results for {httpContext.Request.Method} {url}:{Environment.NewLine}{timingResults}");
+ string method = httpContext.Request.Method.Replace(Environment.NewLine, "");
+ logger.LogInformation($"Measurement results for {method} {url}:{Environment.NewLine}{timingResults}");
}
}
diff --git a/src/JsonApiDotNetCore/Serialization/Request/JsonApiReader.cs b/src/JsonApiDotNetCore/Serialization/Request/JsonApiReader.cs
index 8a8de4d5cc..4bd3741b7e 100644
--- a/src/JsonApiDotNetCore/Serialization/Request/JsonApiReader.cs
+++ b/src/JsonApiDotNetCore/Serialization/Request/JsonApiReader.cs
@@ -40,8 +40,9 @@ public JsonApiReader(IJsonApiOptions options, IDocumentAdapter documentAdapter,
ArgumentGuard.NotNull(httpRequest);
string requestBody = await ReceiveRequestBodyAsync(httpRequest);
+ string method = httpRequest.Method.Replace(Environment.NewLine, "");
- _traceWriter.LogMessage(() => $"Received {httpRequest.Method} request at '{httpRequest.GetEncodedUrl()}' with body: <<{requestBody}>>");
+ _traceWriter.LogMessage(() => $"Received {method} request at '{httpRequest.GetEncodedUrl()}' with body: <<{requestBody}>>");
return GetModel(requestBody);
}
diff --git a/src/JsonApiDotNetCore/Serialization/Response/JsonApiWriter.cs b/src/JsonApiDotNetCore/Serialization/Response/JsonApiWriter.cs
index 2a54c1ba8e..22de5284a2 100644
--- a/src/JsonApiDotNetCore/Serialization/Response/JsonApiWriter.cs
+++ b/src/JsonApiDotNetCore/Serialization/Response/JsonApiWriter.cs
@@ -63,7 +63,12 @@ public async Task WriteAsync(object? model, HttpContext httpContext)
}
_traceWriter.LogMessage(() =>
- $"Sending {httpContext.Response.StatusCode} response for {httpContext.Request.Method} request at '{httpContext.Request.GetEncodedUrl()}' with body: <<{responseBody}>>");
+ {
+ string method = httpContext.Request.Method.Replace(Environment.NewLine, "");
+ string url = httpContext.Request.GetEncodedUrl();
+
+ return $"Sending {httpContext.Response.StatusCode} response for {method} request at '{url}' with body: <<{responseBody}>>";
+ });
await SendResponseBodyAsync(httpContext.Response, responseBody);
}
From 780dfd92a16ec3a1475f73d142e2d79649ff2b5c Mon Sep 17 00:00:00 2001
From: Bart Koelman <10324372+bkoelman@users.noreply.github.com>
Date: Sat, 23 Sep 2023 02:02:50 +0200
Subject: [PATCH 10/19] Update build status badge to filter on master branch
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 2aa2490106..90bb47b405 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@
# JsonApiDotNetCore
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/).
-[](https://github.com/json-api-dotnet/JsonApiDotNetCore/actions/workflows/build.yml)
+[](https://github.com/json-api-dotnet/JsonApiDotNetCore/actions/workflows/build.yml?query=branch%3Amaster)
[](https://codecov.io/gh/json-api-dotnet/JsonApiDotNetCore)
[](https://www.nuget.org/packages/JsonApiDotNetCore/)
[](https://gitter.im/json-api-dotnet-core/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
From c40ac2d1b8efa9ee6c2a8f5ac8131bdd0f4ed4c6 Mon Sep 17 00:00:00 2001
From: Bart Koelman <10324372+bkoelman@users.noreply.github.com>
Date: Sat, 23 Sep 2023 11:11:06 +0200
Subject: [PATCH 11/19] Update version to 5.4.0
---
Directory.Build.props | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Directory.Build.props b/Directory.Build.props
index d6f4df58b2..1c96340f4f 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -6,7 +6,7 @@
7.0.*
4.7.*
2.14.1
- 5.3.1
+ 5.4.0
$(MSBuildThisFileDirectory)CodingGuidelines.ruleset
9999
enable
From 543b011676cc10020158a012c8240f2b9578a491 Mon Sep 17 00:00:00 2001
From: Bart Koelman <10324372+bkoelman@users.noreply.github.com>
Date: Sat, 23 Sep 2023 12:15:22 +0200
Subject: [PATCH 12/19] GitHub Actions: run workflow on release
---
.github/workflows/build.yml | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index aad9c0a311..21bafd1722 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -13,8 +13,8 @@ on:
branches: [ 'master', 'release/**' ]
pull_request:
branches: [ 'master', 'release/**' ]
- tags:
- - 'v*'
+ release:
+ types: [published]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -107,7 +107,7 @@ jobs:
Write-Error "Version prefix from git release tag '$versionPrefix' does not match version prefix '$configuredVersionPrefix' stored in Directory.Build.props."
# To recover from this:
# - Delete the GitHub release
- # - Run: git push --delete the-invalid-tag-name
+ # - Run: git push --delete origin the-invalid-tag-name
# - Adjust JsonApiDotNetCoreVersionPrefix in Directory.Build.props, commit and push
# - Recreate the GitHub release
}
@@ -252,7 +252,7 @@ jobs:
Write-Output "Running code cleanup on commit range $baseCommitHash..$headCommitHash in pull request."
dotnet regitlint -s JsonApiDotNetCore.sln --print-command --skip-tool-check --max-runs=5 --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --verbosity=WARN -f commits -a $headCommitHash -b $baseCommitHash --fail-on-diff --print-diff
- name: CleanupCode (on branch)
- if: github.event_name == 'push'
+ if: github.event_name == 'push' || github.event_name == 'release'
shell: pwsh
run: |
Write-Output "Running code cleanup on all files."
@@ -270,7 +270,7 @@ jobs:
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Publish to GitHub Packages
- if: github.event_name == 'push'
+ if: github.event_name == 'push' || github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: pwsh
@@ -286,7 +286,7 @@ jobs:
publish_dir: ./documentation
commit_message: 'Auto-generated documentation from'
- name: Publish to NuGet
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
+ if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v')
env:
NUGET_ORG_API_KEY: ${{ secrets.NUGET_ORG_API_KEY }}
shell: pwsh
From 7902e3d66be4a5a69cff3471e6120f2ae61b72cf Mon Sep 17 00:00:00 2001
From: Bart Koelman <10324372+bkoelman@users.noreply.github.com>
Date: Sat, 23 Sep 2023 12:47:30 +0200
Subject: [PATCH 13/19] Fix version suffix calculation on release
---
.github/workflows/build.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 21bafd1722..1f2a9e88af 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -99,7 +99,7 @@ jobs:
# Get the version prefix/suffix from the git tag. For example: 'v1.0.0-preview1-final' => '1.0.0' and 'preview1-final'
$segments = $env:GITHUB_REF_NAME -split "-"
$versionPrefix = $segments[0].TrimStart('v')
- $versionSuffix = $segments[1..-1] -join "-"
+ $versionSuffix = $segments.Count -eq 1 ? '' : $segments[1..$($segments.Length-1)] -join '-'
[xml]$xml = Get-Content Directory.Build.props
$configuredVersionPrefix = $xml.Project.PropertyGroup[0].JsonApiDotNetCoreVersionPrefix
From 05a71e10840b55f5ddb4152fbedf4556cbf0c1ee Mon Sep 17 00:00:00 2001
From: Bart Koelman <10324372+bkoelman@users.noreply.github.com>
Date: Sat, 23 Sep 2023 12:55:00 +0200
Subject: [PATCH 14/19] Fix build on missing version suffix
---
.github/workflows/build.yml | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 1f2a9e88af..a796be61f0 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -124,7 +124,12 @@ jobs:
- name: Build
shell: pwsh
run: |
- dotnet build --no-restore --configuration Release --version-suffix=$env:PACKAGE_VERSION_SUFFIX
+ if ($env:PACKAGE_VERSION_SUFFIX) {
+ dotnet build --no-restore --configuration Release --version-suffix=$env:PACKAGE_VERSION_SUFFIX
+ }
+ else {
+ dotnet build --no-restore --configuration Release
+ }
- name: Test
run: |
dotnet test --no-build --configuration Release --collect:"XPlat Code Coverage" --logger "GitHubActions;summary.includeSkippedTests=true" -- RunConfiguration.CollectSourceInformation=true DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.DeterministicReport=true
@@ -134,7 +139,12 @@ jobs:
- name: Generate packages
shell: pwsh
run: |
- dotnet pack --no-build --configuration Release --output $env:GITHUB_WORKSPACE/artifacts/packages --version-suffix=$env:PACKAGE_VERSION_SUFFIX
+ if ($env:PACKAGE_VERSION_SUFFIX) {
+ dotnet pack --no-build --configuration Release --output $env:GITHUB_WORKSPACE/artifacts/packages --version-suffix=$env:PACKAGE_VERSION_SUFFIX
+ }
+ else {
+ dotnet pack --no-build --configuration Release --output $env:GITHUB_WORKSPACE/artifacts/packages
+ }
- name: Upload packages to artifacts
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v3
From bb9f3c3a8d72d6e24da7edad211b442f1ce9e997 Mon Sep 17 00:00:00 2001
From: Bart Koelman <10324372+bkoelman@users.noreply.github.com>
Date: Sat, 23 Sep 2023 13:46:07 +0200
Subject: [PATCH 15/19] Count/Length consistency
---
.github/workflows/build.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index a796be61f0..c56a9dafbb 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -99,7 +99,7 @@ jobs:
# Get the version prefix/suffix from the git tag. For example: 'v1.0.0-preview1-final' => '1.0.0' and 'preview1-final'
$segments = $env:GITHUB_REF_NAME -split "-"
$versionPrefix = $segments[0].TrimStart('v')
- $versionSuffix = $segments.Count -eq 1 ? '' : $segments[1..$($segments.Length-1)] -join '-'
+ $versionSuffix = $segments.Length -eq 1 ? '' : $segments[1..$($segments.Length - 1)] -join '-'
[xml]$xml = Get-Content Directory.Build.props
$configuredVersionPrefix = $xml.Project.PropertyGroup[0].JsonApiDotNetCoreVersionPrefix
From 88d7814ae84e02d549c5b7bd2bb1b479ce0ac269 Mon Sep 17 00:00:00 2001
From: Bart Koelman <10324372+bkoelman@users.noreply.github.com>
Date: Sat, 23 Sep 2023 13:46:31 +0200
Subject: [PATCH 16/19] Increment version to 5.4.1 (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 1c96340f4f..15fb0782a1 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -6,7 +6,7 @@
7.0.*
4.7.*
2.14.1
- 5.4.0
+ 5.4.1
$(MSBuildThisFileDirectory)CodingGuidelines.ruleset
9999
enable
From 091fa288a95706d4a042b2bff06b89731e6795a2 Mon Sep 17 00:00:00 2001
From: Bart Koelman <10324372+bkoelman@users.noreply.github.com>
Date: Sun, 24 Sep 2023 22:51:18 +0200
Subject: [PATCH 17/19] GitHub Actions: Clear version suffix when set in
project files
Using MSBuild property because the `-version-suffix` switch does not accept null or an empty string
---
.github/workflows/build.yml | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index c56a9dafbb..4de5a74b39 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -124,12 +124,7 @@ jobs:
- name: Build
shell: pwsh
run: |
- if ($env:PACKAGE_VERSION_SUFFIX) {
- dotnet build --no-restore --configuration Release --version-suffix=$env:PACKAGE_VERSION_SUFFIX
- }
- else {
- dotnet build --no-restore --configuration Release
- }
+ dotnet build --no-restore --configuration Release /p:VersionSuffix=$env:PACKAGE_VERSION_SUFFIX
- name: Test
run: |
dotnet test --no-build --configuration Release --collect:"XPlat Code Coverage" --logger "GitHubActions;summary.includeSkippedTests=true" -- RunConfiguration.CollectSourceInformation=true DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.DeterministicReport=true
@@ -139,12 +134,7 @@ jobs:
- name: Generate packages
shell: pwsh
run: |
- if ($env:PACKAGE_VERSION_SUFFIX) {
- dotnet pack --no-build --configuration Release --output $env:GITHUB_WORKSPACE/artifacts/packages --version-suffix=$env:PACKAGE_VERSION_SUFFIX
- }
- else {
- dotnet pack --no-build --configuration Release --output $env:GITHUB_WORKSPACE/artifacts/packages
- }
+ dotnet pack --no-build --configuration Release --output $env:GITHUB_WORKSPACE/artifacts/packages /p:VersionSuffix=$env:PACKAGE_VERSION_SUFFIX
- name: Upload packages to artifacts
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v3
From 883422f334a4dc4e905699173059319974ed1ad3 Mon Sep 17 00:00:00 2001
From: Bart Koelman <10324372+bkoelman@users.noreply.github.com>
Date: Mon, 25 Sep 2023 00:09:28 +0200
Subject: [PATCH 18/19] Use centralized versions in all package references;
split into breaking and non-breaking (floating) version sets
---
Directory.Build.props | 68 +++++++++++--------
benchmarks/Benchmarks.csproj | 4 +-
.../DatabasePerTenantExample.csproj | 4 +-
.../GettingStarted/GettingStarted.csproj | 2 +-
.../JsonApiDotNetCoreExample.csproj | 4 +-
.../MultiDbContextExample.csproj | 2 +-
.../NoEntityFrameworkExample.csproj | 2 +-
.../ReportsExample/ReportsExample.csproj | 4 +-
.../JsonApiDotNetCore.Annotations.csproj | 4 +-
.../JsonApiDotNetCore.SourceGenerators.csproj | 4 +-
.../JsonApiDotNetCore.csproj | 12 ++--
.../JsonApiDotNetCoreTests.csproj | 10 +--
.../MultiDbContextTests.csproj | 2 +-
.../NoEntityFrameworkTests.csproj | 2 +-
.../SourceGeneratorTests.csproj | 2 +-
.../TestBuildingBlocks.csproj | 14 ++--
test/UnitTests/UnitTests.csproj | 2 +-
17 files changed, 78 insertions(+), 64 deletions(-)
diff --git a/Directory.Build.props b/Directory.Build.props
index 15fb0782a1..75d754d5bc 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -1,28 +1,6 @@
-
- net6.0
- 6.0.*
- 7.0.*
- 7.0.*
- 4.7.*
- 2.14.1
- 5.4.1
- $(MSBuildThisFileDirectory)CodingGuidelines.ruleset
- 9999
- enable
- enable
- false
- false
-
-
-
-
-
-
-
-
-
- true
+
+ $(NoWarn);AV2210
@@ -31,14 +9,50 @@
true
-
- $(NoWarn);AV2210
+
+ true
-
+
+ net6.0
+ 4.1.0
+ 0.4.1
+ 6.0.0
+ 2.14.1
+
+
+ 6.0.*
+ 0.13.*
+ 34.0.*
+ 3.8.*
+ 4.7.*
6.0.*
+ 2.1.*
+ 7.0.*
+ 6.12.*
2.3.*
+ 1.3.*
+ 2023.2.*
+ 7.0.*
+ 1.1.*
+ 7.0.*
17.7.*
+ 2.5.*
+
+
+
+
+
+
+
+
+
+ enable
+ enable
+ false
+ false
+ $(MSBuildThisFileDirectory)CodingGuidelines.ruleset
+ 5.4.1
diff --git a/benchmarks/Benchmarks.csproj b/benchmarks/Benchmarks.csproj
index 23a6876af9..1e97dd290f 100644
--- a/benchmarks/Benchmarks.csproj
+++ b/benchmarks/Benchmarks.csproj
@@ -10,8 +10,8 @@
-
-
+
+
diff --git a/src/Examples/DatabasePerTenantExample/DatabasePerTenantExample.csproj b/src/Examples/DatabasePerTenantExample/DatabasePerTenantExample.csproj
index a48f472a70..c219dfd0f5 100644
--- a/src/Examples/DatabasePerTenantExample/DatabasePerTenantExample.csproj
+++ b/src/Examples/DatabasePerTenantExample/DatabasePerTenantExample.csproj
@@ -10,7 +10,7 @@
-
-
+
+
diff --git a/src/Examples/GettingStarted/GettingStarted.csproj b/src/Examples/GettingStarted/GettingStarted.csproj
index ab152b79d5..9e0c80b7f4 100644
--- a/src/Examples/GettingStarted/GettingStarted.csproj
+++ b/src/Examples/GettingStarted/GettingStarted.csproj
@@ -10,6 +10,6 @@
-
+
diff --git a/src/Examples/JsonApiDotNetCoreExample/JsonApiDotNetCoreExample.csproj b/src/Examples/JsonApiDotNetCoreExample/JsonApiDotNetCoreExample.csproj
index a48f472a70..c219dfd0f5 100644
--- a/src/Examples/JsonApiDotNetCoreExample/JsonApiDotNetCoreExample.csproj
+++ b/src/Examples/JsonApiDotNetCoreExample/JsonApiDotNetCoreExample.csproj
@@ -10,7 +10,7 @@
-
-
+
+
diff --git a/src/Examples/MultiDbContextExample/MultiDbContextExample.csproj b/src/Examples/MultiDbContextExample/MultiDbContextExample.csproj
index ab152b79d5..9e0c80b7f4 100644
--- a/src/Examples/MultiDbContextExample/MultiDbContextExample.csproj
+++ b/src/Examples/MultiDbContextExample/MultiDbContextExample.csproj
@@ -10,6 +10,6 @@
-
+
diff --git a/src/Examples/NoEntityFrameworkExample/NoEntityFrameworkExample.csproj b/src/Examples/NoEntityFrameworkExample/NoEntityFrameworkExample.csproj
index 9f0037b058..e272b4fcbf 100644
--- a/src/Examples/NoEntityFrameworkExample/NoEntityFrameworkExample.csproj
+++ b/src/Examples/NoEntityFrameworkExample/NoEntityFrameworkExample.csproj
@@ -10,6 +10,6 @@
-
+
diff --git a/src/Examples/ReportsExample/ReportsExample.csproj b/src/Examples/ReportsExample/ReportsExample.csproj
index a48f472a70..c219dfd0f5 100644
--- a/src/Examples/ReportsExample/ReportsExample.csproj
+++ b/src/Examples/ReportsExample/ReportsExample.csproj
@@ -10,7 +10,7 @@
-
-
+
+
diff --git a/src/JsonApiDotNetCore.Annotations/JsonApiDotNetCore.Annotations.csproj b/src/JsonApiDotNetCore.Annotations/JsonApiDotNetCore.Annotations.csproj
index 119d295b35..48ca676b4a 100644
--- a/src/JsonApiDotNetCore.Annotations/JsonApiDotNetCore.Annotations.csproj
+++ b/src/JsonApiDotNetCore.Annotations/JsonApiDotNetCore.Annotations.csproj
@@ -46,7 +46,7 @@
-
-
+
+
diff --git a/src/JsonApiDotNetCore.SourceGenerators/JsonApiDotNetCore.SourceGenerators.csproj b/src/JsonApiDotNetCore.SourceGenerators/JsonApiDotNetCore.SourceGenerators.csproj
index 6d79d8c893..ca6de1a5b7 100644
--- a/src/JsonApiDotNetCore.SourceGenerators/JsonApiDotNetCore.SourceGenerators.csproj
+++ b/src/JsonApiDotNetCore.SourceGenerators/JsonApiDotNetCore.SourceGenerators.csproj
@@ -45,7 +45,7 @@
-
-
+
+
diff --git a/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj b/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj
index 6a1b8517e6..4407edaf1f 100644
--- a/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj
+++ b/src/JsonApiDotNetCore/JsonApiDotNetCore.csproj
@@ -36,11 +36,11 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/test/JsonApiDotNetCoreTests/JsonApiDotNetCoreTests.csproj b/test/JsonApiDotNetCoreTests/JsonApiDotNetCoreTests.csproj
index e66fbaeacc..7a3fa8ddf8 100644
--- a/test/JsonApiDotNetCoreTests/JsonApiDotNetCoreTests.csproj
+++ b/test/JsonApiDotNetCoreTests/JsonApiDotNetCoreTests.csproj
@@ -11,12 +11,12 @@
-
+
-
-
-
+
+
+
-
+
diff --git a/test/MultiDbContextTests/MultiDbContextTests.csproj b/test/MultiDbContextTests/MultiDbContextTests.csproj
index 0f5f5f2cff..394d72e2d2 100644
--- a/test/MultiDbContextTests/MultiDbContextTests.csproj
+++ b/test/MultiDbContextTests/MultiDbContextTests.csproj
@@ -11,7 +11,7 @@
-
+
diff --git a/test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj b/test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj
index f651f73c0e..84a36dcbb1 100644
--- a/test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj
+++ b/test/NoEntityFrameworkTests/NoEntityFrameworkTests.csproj
@@ -11,7 +11,7 @@
-
+
diff --git a/test/SourceGeneratorTests/SourceGeneratorTests.csproj b/test/SourceGeneratorTests/SourceGeneratorTests.csproj
index 707de9b8c5..d361de38e5 100644
--- a/test/SourceGeneratorTests/SourceGeneratorTests.csproj
+++ b/test/SourceGeneratorTests/SourceGeneratorTests.csproj
@@ -12,7 +12,7 @@
-
+
diff --git a/test/TestBuildingBlocks/TestBuildingBlocks.csproj b/test/TestBuildingBlocks/TestBuildingBlocks.csproj
index 386e4e846e..ba9a2f5da3 100644
--- a/test/TestBuildingBlocks/TestBuildingBlocks.csproj
+++ b/test/TestBuildingBlocks/TestBuildingBlocks.csproj
@@ -8,15 +8,15 @@
-
+
-
-
-
+
+
+
-
-
-
+
+
+
diff --git a/test/UnitTests/UnitTests.csproj b/test/UnitTests/UnitTests.csproj
index 85bcc57484..f8dcbce984 100644
--- a/test/UnitTests/UnitTests.csproj
+++ b/test/UnitTests/UnitTests.csproj
@@ -10,7 +10,7 @@
-
+
From 2f93f4337e544a4ec12cc689e81fd662f924127f Mon Sep 17 00:00:00 2001
From: Bart Koelman <10324372+bkoelman@users.noreply.github.com>
Date: Mon, 25 Sep 2023 00:30:51 +0200
Subject: [PATCH 19/19] Fix build failure on empty version suffix
---
Build.ps1 | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/Build.ps1 b/Build.ps1
index 4f0912079d..4854651d67 100644
--- a/Build.ps1
+++ b/Build.ps1
@@ -1,3 +1,5 @@
+$versionSuffix="pre"
+
function VerifySuccessExitCode {
if ($LastExitCode -ne 0) {
throw "Command failed with exit code $LastExitCode."
@@ -6,11 +8,12 @@ function VerifySuccessExitCode {
Write-Host "$(pwsh --version)"
Write-Host "Active .NET SDK: $(dotnet --version)"
+Write-Host "Using version suffix: $versionSuffix"
dotnet tool restore
VerifySuccessExitCode
-dotnet build --configuration Release --version-suffix="pre"
+dotnet build --configuration Release /p:VersionSuffix=$versionSuffix
VerifySuccessExitCode
dotnet test --no-build --configuration Release --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.DeterministicReport=true
@@ -19,5 +22,5 @@ VerifySuccessExitCode
dotnet reportgenerator -reports:**\coverage.cobertura.xml -targetdir:artifacts\coverage -filefilters:-*.g.cs
VerifySuccessExitCode
-dotnet pack --no-build --configuration Release --output artifacts/packages --version-suffix="pre"
+dotnet pack --no-build --configuration Release --output artifacts/packages /p:VersionSuffix=$versionSuffix
VerifySuccessExitCode