From 6929f7112b993424a8cca57300643fe05302cfba Mon Sep 17 00:00:00 2001
From: Bart Koelman <10324372+bkoelman@users.noreply.github.com>
Date: Wed, 22 Oct 2025 06:53:47 +0200
Subject: [PATCH] Update to JADNC v5.9.0
---
.config/dotnet-tools.json | 2 +-
.github/workflows/build.yml | 6 +--
Directory.Build.props | 2 +-
package-versions.props | 6 +--
.../GettingStarted/GettingStarted.http | 53 +++++++++++++++++++
test/TestBuildingBlocks/FluentExtensions.cs | 3 +-
.../IntegrationTestContext.cs | 4 +-
7 files changed, 65 insertions(+), 11 deletions(-)
create mode 100644 src/Examples/GettingStarted/GettingStarted.http
diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
index 42edacf..ebb5aeb 100644
--- a/.config/dotnet-tools.json
+++ b/.config/dotnet-tools.json
@@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"jetbrains.resharper.globaltools": {
- "version": "2025.2.0",
+ "version": "2025.2.3",
"commands": [
"jb"
],
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 70f142a..f37f6d1 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -79,8 +79,8 @@ jobs:
# Get the version suffix from the auto-incrementing build number. For example: '123' => 'master-00123'
$revision = "{0:D5}" -f [convert]::ToInt32($env:GITHUB_RUN_NUMBER, 10)
$branchName = ![string]::IsNullOrEmpty($env:GITHUB_HEAD_REF) ? $env:GITHUB_HEAD_REF : $env:GITHUB_REF_NAME
- $safeName = $branchName.Replace('/', '-').Replace('_', '-')
- $versionSuffix = "$safeName-$revision"
+ $safeBranchName = $($branchName -Replace '[^a-zA-Z0-9-]', '-')[0..40] -Join ""
+ $versionSuffix = "$safeBranchName-$revision"
}
Write-Output "Using version suffix: $versionSuffix"
Write-Output "PACKAGE_VERSION_SUFFIX=$versionSuffix" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
@@ -197,7 +197,7 @@ jobs:
Write-Output "Running code cleanup on commit range $baseCommitHash..$headCommitHash in pull request."
dotnet regitlint -s JsonApiDotNetCore.MongoDb.sln --print-command --skip-tool-check --max-runs=5 --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --properties:RunAnalyzers=false --jb --verbosity=WARN -f commits -a $headCommitHash -b $baseCommitHash --fail-on-diff --print-diff
- name: CleanupCode (on branch)
- if: ${{ github.event_name == 'push' || github.event_name == 'release' }}
+ if: ${{ github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'workflow_dispatch' }}
shell: pwsh
run: |
Write-Output 'Running code cleanup on all files.'
diff --git a/Directory.Build.props b/Directory.Build.props
index 44c26a2..01c226a 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -9,7 +9,7 @@
Recommended
$(MSBuildThisFileDirectory)CodingGuidelines.ruleset
$(MSBuildThisFileDirectory)tests.runsettings
- 5.7.2
+ 5.9.0
pre
direct
diff --git a/package-versions.props b/package-versions.props
index fe28cc4..3bedcbc 100644
--- a/package-versions.props
+++ b/package-versions.props
@@ -1,7 +1,7 @@
- 5.7.1
+ 5.9.0
3.3.0
@@ -11,8 +11,8 @@
7.2.*
2.4.*
2.0.*
- 3.3.*
- 17.14.*
+ 3.5.*
+ 18.0.*
2.9.*
3.1.*
diff --git a/src/Examples/GettingStarted/GettingStarted.http b/src/Examples/GettingStarted/GettingStarted.http
new file mode 100644
index 0000000..587d3ef
--- /dev/null
+++ b/src/Examples/GettingStarted/GettingStarted.http
@@ -0,0 +1,53 @@
+@hostAddress = http://localhost:24141
+
+### Get all books.
+
+GET {{hostAddress}}/api/books
+
+### Get the first two books.
+
+GET {{hostAddress}}/api/books?page[size]=2
+
+### Filter books whose title contains whitespace, sort descending by publication year.
+
+GET {{hostAddress}}/api/books?filter=contains(title,'%20')&sort=-publishYear
+
+### Get only the titles of all books.
+
+GET {{hostAddress}}/api/books?fields[books]=title
+
+### Create a new book.
+
+POST {{hostAddress}}/api/books
+Content-Type: application/vnd.api+json
+
+{
+ "data": {
+ "type": "books",
+ "attributes": {
+ "title": "Getting started with JSON:API",
+ "author": "John Doe",
+ "publishYear": 2000
+ }
+ }
+}
+
+### Change the publication year and author of the book with ID 68f86594c8555269227c26d2.
+
+PATCH {{hostAddress}}/api/books/68f86594c8555269227c26d2
+Content-Type: application/vnd.api+json
+
+{
+ "data": {
+ "type": "books",
+ "id": "68f86594c8555269227c26d2",
+ "attributes": {
+ "publishYear": 1820,
+ "author": "Jane Doe"
+ }
+ }
+}
+
+### Delete the book with ID 68f86594c8555269227c26d2.
+
+DELETE {{hostAddress}}/api/books/68f86594c8555269227c26d2
diff --git a/test/TestBuildingBlocks/FluentExtensions.cs b/test/TestBuildingBlocks/FluentExtensions.cs
index 1ceebc0..45c621b 100644
--- a/test/TestBuildingBlocks/FluentExtensions.cs
+++ b/test/TestBuildingBlocks/FluentExtensions.cs
@@ -32,9 +32,10 @@ public static StrongReferenceTypeAssertions RefShould([SysNotNull] this T?
return new StrongReferenceTypeAssertions(actualValue);
}
- public static void With(this T subject, [InstantHandle] Action continuation)
+ public static T With(this T subject, [InstantHandle] Action continuation)
{
continuation(subject);
+ return subject;
}
public sealed class StrongReferenceTypeAssertions(TReference subject)
diff --git a/test/TestBuildingBlocks/IntegrationTestContext.cs b/test/TestBuildingBlocks/IntegrationTestContext.cs
index b16cd2f..76a092d 100644
--- a/test/TestBuildingBlocks/IntegrationTestContext.cs
+++ b/test/TestBuildingBlocks/IntegrationTestContext.cs
@@ -56,7 +56,7 @@ public IntegrationTestContext()
_lazyFactory = new Lazy>(CreateFactory);
}
- private IMongoRunner StartMongoDb()
+ private static IMongoRunner StartMongoDb()
{
return MongoRunnerProvider.Instance.Get();
}
@@ -118,7 +118,7 @@ private WebApplicationFactory CreateFactory()
return factory;
}
- private void ConfigureJsonApiOptions(JsonApiOptions options)
+ private static void ConfigureJsonApiOptions(JsonApiOptions options)
{
options.IncludeExceptionStackTraceInErrors = true;
options.IncludeRequestBodyInErrors = true;