Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"jetbrains.resharper.globaltools": {
"version": "2025.2.3",
"version": "2025.3.0-eap07",
"commands": [
"jb"
],
Expand All @@ -24,7 +24,7 @@
"rollForward": false
},
"docfx": {
"version": "2.78.2",
"version": "2.78.4",
"commands": [
"docfx"
],
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
workflow_dispatch:
pull_request:
push:
branches: [ 'master', 'release/**' ]
branches: [ 'master', 'release/**', 'net10-preview' ]
release:
types: [published]

Expand Down Expand Up @@ -48,6 +48,11 @@ jobs:
dotnet-version: |
8.0.*
9.0.*
- name: Setup .NET 10 preview
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.*
dotnet-quality: 'preview'
- name: Show installed versions
shell: pwsh
run: |
Expand Down Expand Up @@ -159,6 +164,11 @@ jobs:
dotnet-version: |
8.0.*
9.0.*
- name: Setup .NET 10 preview
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.*
dotnet-quality: 'preview'
- name: Git checkout
uses: actions/checkout@v5
- name: Restore tools
Expand All @@ -168,6 +178,7 @@ jobs:
run: |
$inspectCodeOutputPath = Join-Path $env:RUNNER_TEMP 'jetbrains-inspectcode-results.xml'
Write-Output "INSPECT_CODE_OUTPUT_PATH=$inspectCodeOutputPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
dotnet jb inspectcode --version
dotnet jb inspectcode JsonApiDotNetCore.sln --build --dotnetcoresdk=$(dotnet --version) --output="$inspectCodeOutputPath" --format="xml" --profile=WarningSeverities.DotSettings --properties:Configuration=Release --properties:ContinuousIntegrationBuild=false --properties:RunAnalyzers=false --severity=WARNING --verbosity=WARN -dsl=GlobalAll -dsl=GlobalPerProduct -dsl=SolutionPersonal -dsl=ProjectPersonal
- name: Upload output to artifacts
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -218,6 +229,11 @@ jobs:
dotnet-version: |
8.0.*
9.0.*
- name: Setup .NET 10 preview
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.*
dotnet-quality: 'preview'
- name: Git checkout
uses: actions/checkout@v5
with:
Expand All @@ -236,12 +252,14 @@ jobs:
$baseCommitHash = git rev-parse HEAD~1

Write-Output "Running code cleanup on commit range $baseCommitHash..$headCommitHash in pull request."
dotnet jb cleanupcode --version
dotnet regitlint -s JsonApiDotNetCore.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' || github.event_name == 'workflow_dispatch' }}
shell: pwsh
run: |
Write-Output 'Running code cleanup on all files.'
dotnet jb cleanupcode --version
dotnet regitlint -s JsonApiDotNetCore.sln --print-command --skip-tool-check --jb --dotnetcoresdk=$(dotnet --version) --jb-profile="JADNC Full Cleanup" --jb --properties:Configuration=Release --jb --properties:RunAnalyzers=false --jb --verbosity=WARN --fail-on-diff --print-diff

publish:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ jobs:
dotnet-version: |
8.0.*
9.0.*
- name: Setup .NET 10 preview
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.*
dotnet-quality: 'preview'
- name: Git checkout
uses: actions/checkout@v5
- name: Initialize CodeQL
Expand Down
6 changes: 6 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
<NuGetAuditMode>direct</NuGetAuditMode>
</PropertyGroup>

<PropertyGroup>
<!-- .NET 10 Preview -->
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
<NoWarn>$(NoWarn);CA1873;NU1903;NU5104;NU1608;IDE0340</NoWarn>
</PropertyGroup>

<PropertyGroup>
<!--
Disabled IDE analyzers for "Use collection expression" because they are dangerous in a subtle way.
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/Benchmarks.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ServerGarbageCollection>true</ServerGarbageCollection>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion docs/generate-examples.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function Start-WebServer {
Write-Output "Starting web server"
$startTimeUtc = Get-Date -AsUTC
$job = Start-Job -ScriptBlock {
dotnet run --project ..\src\Examples\GettingStarted\GettingStarted.csproj --framework net8.0 --configuration Debug --property:TreatWarningsAsErrors=True --urls=http://0.0.0.0:14141
dotnet run --project ../src/Examples/GettingStarted/GettingStarted.csproj --framework net8.0 --configuration Debug --property:TreatWarningsAsErrors=True --urls=http://0.0.0.0:14141
}

$webProcessId = $null
Expand Down
16 changes: 16 additions & 0 deletions package-versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,28 @@
<XunitVisualStudioVersion>3.1.*</XunitVisualStudioVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net10.0'">
<!-- Published dependencies (only update on major version change) -->
<EntityFrameworkCoreFrozenVersion>10.0.*-*</EntityFrameworkCoreFrozenVersion>
<SwashbuckleFrozenVersion>10.0.0-pr.3283.*</SwashbuckleFrozenVersion>

<!-- Non-published dependencies (these are safe to update, won't cause a breaking change) -->
<AspNetCoreVersion>10.0.*-*</AspNetCoreVersion>
<SwashbuckleVersion>10.0.0-pr.3283.*</SwashbuckleVersion>
<MicrosoftOpenApiVersion>2.3.*</MicrosoftOpenApiVersion>
<MicrosoftApiServerVersion>10.0.*-*</MicrosoftApiServerVersion>
<EntityFrameworkCoreVersion>10.0.*-*</EntityFrameworkCoreVersion>
<EntityFrameworkCorePomeloVersion>9.0.*</EntityFrameworkCorePomeloVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net9.0'">
<!-- Published dependencies (only update on major version change) -->
<EntityFrameworkCoreFrozenVersion>N/A</EntityFrameworkCoreFrozenVersion>

<!-- Non-published dependencies (these are safe to update, won't cause a breaking change) -->
<AspNetCoreVersion>9.0.*</AspNetCoreVersion>
<EntityFrameworkCoreVersion>9.0.*</EntityFrameworkCoreVersion>
<EntityFrameworkCorePomeloVersion>9.0.*</EntityFrameworkCorePomeloVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
Expand All @@ -51,5 +66,6 @@
<!-- Non-published dependencies (these are safe to update, won't cause a breaking change) -->
<AspNetCoreVersion>8.0.*</AspNetCoreVersion>
<EntityFrameworkCoreVersion>8.0.*</EntityFrameworkCoreVersion>
<EntityFrameworkCorePomeloVersion>8.0.*</EntityFrameworkCorePomeloVersion>
</PropertyGroup>
</Project>
5 changes: 3 additions & 2 deletions src/Examples/DapperExample/DapperExample.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<TargetFrameworks>net10.0;net9.0;net8.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\..\package-versions.props" />
Expand All @@ -14,8 +14,9 @@
<ItemGroup>
<PackageReference Include="Dapper" Version="$(DapperVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="$(EntityFrameworkCoreVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="$(EntityFrameworkCoreVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="$(EntityFrameworkCoreVersion)" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(EntityFrameworkCoreVersion)" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="$(EntityFrameworkCoreVersion)" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="$(EntityFrameworkCorePomeloVersion)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<TargetFrameworks>net10.0;net9.0;net8.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\..\package-versions.props" />
Expand Down
2 changes: 1 addition & 1 deletion src/Examples/GettingStarted/GettingStarted.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<TargetFrameworks>net10.0;net9.0;net8.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\..\package-versions.props" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<TargetFrameworks>net10.0</TargetFrameworks>
<OpenApiGenerateDocumentsOnBuild>true</OpenApiGenerateDocumentsOnBuild>
<OpenApiDocumentsDirectory>GeneratedSwagger</OpenApiDocumentsDirectory>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using JetBrains.Annotations;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi;
using Swashbuckle.AspNetCore.SwaggerGen;

namespace JsonApiDotNetCoreExample;
Expand All @@ -16,6 +16,8 @@ public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context)
{
if (_httpContextAccessor.HttpContext == null)
{
swaggerDoc.Servers ??= [];

swaggerDoc.Servers.Add(new OpenApiServer
{
Url = "https://localhost:44340"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<TargetFrameworks>net10.0;net9.0;net8.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\..\package-versions.props" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<TargetFrameworks>net10.0;net9.0;net8.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\..\package-versions.props" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>

<Import Project="..\..\..\package-versions.props" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">
<PropertyGroup>
<!-- TargetFrameworks does not work, see https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/2706 -->
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>

<Import Project="..\..\..\package-versions.props" />
Expand Down
2 changes: 1 addition & 1 deletion src/Examples/ReportsExample/ReportsExample.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<TargetFrameworks>net10.0;net9.0;net8.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\..\package-versions.props" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;netstandard1.0</TargetFrameworks>
<TargetFrameworks>net10.0;net8.0;netstandard1.0</TargetFrameworks>
<IsPackable>true</IsPackable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<RootNamespace>JsonApiDotNetCore</RootNamespace>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net10.0;net8.0</TargetFrameworks>
<IsPackable>true</IsPackable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<OpenApiGenerateDocuments>false</OpenApiGenerateDocuments>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net10.0;net8.0</TargetFrameworks>
<IsPackable>true</IsPackable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<OpenApiGenerateDocuments>false</OpenApiGenerateDocuments>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public void Configure(SwaggerGenOptions options)
options.DocumentFilter<StringEnumOrderingFilter>();
options.DocumentFilter<SetSchemaTypeToObjectDocumentFilter>();
options.DocumentFilter<UnusedComponentSchemaCleaner>();
options.DocumentFilter<RemoveTagsFilter>();
}

private List<Type> SelectDerivedTypes(Type baseType)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net10.0</TargetFrameworks>
<IsPackable>true</IsPackable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<OpenApiGenerateDocuments>false</OpenApiGenerateDocuments>
Expand Down Expand Up @@ -33,6 +33,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.OpenApi" Version="$(MicrosoftOpenApiVersion)" />
<PackageReference Include="SauceControl.InheritDoc" Version="$(InheritDocVersion)" PrivateAssets="All" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="$(SwashbuckleFrozenVersion)" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public string GetSchemaId(Type type)

private string ApplySchemaTemplate(string schemaTemplate, ResourceType? resourceType, string? relationshipName, AtomicOperationCode? operationCode)
{
string schemaId = schemaTemplate;
string? schemaId = schemaTemplate;

schemaId = resourceType != null
? schemaId.Replace("[ResourceName]", resourceType.PublicName.Singularize()).Pascalize()
Expand All @@ -131,7 +131,7 @@ private string ApplySchemaTemplate(string schemaTemplate, ResourceType? resource
schemaId = schemaId.Replace("[OperationCode]", operationCode.Value.ToString().Pascalize());
}

string pascalCaseSchemaId = schemaId.Pascalize();
string? pascalCaseSchemaId = schemaId.Pascalize();

JsonNamingPolicy? namingPolicy = _options.SerializerOptions.PropertyNamingPolicy;
return namingPolicy != null ? namingPolicy.ConvertName(pascalCaseSchemaId) : pascalCaseSchemaId;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Microsoft.OpenApi;

namespace JsonApiDotNetCore.OpenApi.Swashbuckle;

internal static class MicrosoftOpenApiCompatibilityExtensions
{
public static void SetNullable(this OpenApiSchema schema, bool nullable)
{
ArgumentNullException.ThrowIfNull(schema);

if (nullable)
{
schema.Type ??= JsonSchemaType.Null;
schema.Type |= JsonSchemaType.Null;
}
else
{
if (schema.Type != null)
{
schema.Type &= ~JsonSchemaType.Null;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public OpenApiDescriptionLinkProvider(IOptionsMonitor<SwaggerGeneratorOptions> s

if (swaggerGeneratorOptions.SwaggerDocs.Count > 0)
{
string latestVersionDocumentName = swaggerGeneratorOptions.SwaggerDocs.Last().Key;
string? latestVersionDocumentName = swaggerGeneratorOptions.SwaggerDocs.Last().Key;

SwaggerOptions swaggerOptions = _swaggerOptionsMonitor.CurrentValue;
return swaggerOptions.RouteTemplate.Replace("{documentName}", latestVersionDocumentName).Replace("{extension:regex(^(json|ya?ml)$)}", "json");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private string ApplyTemplate(string openApiOperationIdTemplate, ResourceType? re
// @formatter:wrap_chained_method_calls chop_always
// @formatter:wrap_before_first_method_call true

string pascalCaseOpenApiOperationId = openApiOperationIdTemplate
string? pascalCaseOpenApiOperationId = openApiOperationIdTemplate
.Replace("[Method]", method)
.Replace("[PrimaryResourceName]", resourceType?.PublicName.Singularize())
.Replace("[RelationshipName]", relationshipName)
Expand Down
Loading
Loading