Skip to content

Commit a2e7cc0

Browse files
committed
Upgrade to .NET 10 and enhance OpenAPI support
Updated projects to target .NET 10, leveraging new features and APIs. Upgraded dependencies, including `Microsoft.AspNetCore.OpenApi` and `Swashbuckle.AspNetCore.SwaggerUI`, to their latest versions. Introduced conditional compilation for `net10.0` to support new framework-specific features. Enhanced OpenAPI integration: - Added `DefaultResponseDocumentTransformer` for error schemas. - Added `OAuth2AuthenticationDocumentTransformer` for OAuth2 support. - Improved `AuthenticationDocumentTransformer` and `AuthenticationOperationTransformer` for security schemes and authorization policies. Removed outdated `#if NET9_0_OR_GREATER` directives and replaced them with more specific conditions. Ensured backward compatibility with `net8.0` and `net9.0`.
1 parent ea096d5 commit a2e7cc0

17 files changed

Lines changed: 403 additions & 36 deletions

File tree

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## General
22

33
- Make only high confidence suggestions when reviewing code changes.
4-
- Always use the latest version C#, currently C# 13 features.
4+
- Always use the latest version C#, currently C# 14 features.
55
- Write code that is clean, maintainable, and easy to understand.
66
- Only add comments rarely to explain why a non-intuitive solution was used. The code should be self-explanatory otherwise.
77
- Don't add the UTF-8 BOM to files unless they have non-ASCII characters.

samples/Controllers/ApiKeySample/ApiKeySample.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.10" />
11-
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="9.0.6" />
10+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0" />
11+
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="10.0.0" />
1212
</ItemGroup>
1313

1414
<ItemGroup>

samples/Controllers/BasicAuthenticationSample/BasicAuthenticationSample.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.10" />
11-
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="9.0.6" />
10+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0" />
11+
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="10.0.0" />
1212
</ItemGroup>
1313

1414
<ItemGroup>

samples/Controllers/JwtBearerSample/JwtBearerSample.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.10" />
11-
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="9.0.6" />
10+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0" />
11+
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="10.0.0" />
1212
</ItemGroup>
1313

1414
<ItemGroup>

samples/MinimalApis/ApiKeySample/ApiKeySample.csproj

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.10" />
11-
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="9.0.6" />
10+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0" />
11+
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="10.0.0" />
1212
</ItemGroup>
1313

1414
<ItemGroup>
15-
<ProjectReference Include="..\..\..\src\SimpleAuthentication.Swashbuckle\SimpleAuthentication.Swashbuckle.csproj" />
1615
<ProjectReference Include="..\..\..\src\SimpleAuthentication\SimpleAuthentication.csproj" />
1716
</ItemGroup>
1817

samples/MinimalApis/BasicAuthenticationSample/BasicAuthenticationSample.csproj

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.10" />
11-
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="9.0.6" />
10+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0" />
11+
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="10.0.0" />
1212
</ItemGroup>
1313

1414
<ItemGroup>
15-
<ProjectReference Include="..\..\..\src\SimpleAuthentication.Swashbuckle\SimpleAuthentication.Swashbuckle.csproj" />
1615
<ProjectReference Include="..\..\..\src\SimpleAuthentication\SimpleAuthentication.csproj" />
1716
</ItemGroup>
1817

samples/MinimalApis/JwtBearerSample/JwtBearerSample.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.10" />
11-
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="9.0.6" />
10+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0" />
11+
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="10.0.0" />
1212
</ItemGroup>
1313

1414
<ItemGroup>

samples/MinimalApis/Net8JwtBearerSample/Net8JwtBearerSample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="[8.0.21,9.0.0)" />
10+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="[8.0.22,9.0.0)" />
1111
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.6" />
1212
</ItemGroup>
1313

src/SimpleAuthentication.Abstractions/SimpleAuthentication.Abstractions.csproj

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
4+
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<LangVersion>latest</LangVersion>
@@ -28,11 +28,15 @@
2828
</ItemGroup>
2929

3030
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
31-
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.21" />
31+
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.22" />
3232
</ItemGroup>
3333

3434
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
35-
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.10" />
35+
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.11" />
36+
</ItemGroup>
37+
38+
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
39+
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.0" />
3640
</ItemGroup>
3741

3842
<ItemGroup>

src/SimpleAuthentication.Swashbuckle/SimpleAuthentication.Swashbuckle.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
</ItemGroup>
3333

3434
<ItemGroup>
35-
<PackageReference Include="SimpleAuthenticationTools.Abstractions" Version="3.1.4" />
3635
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="9.0.6" />
3736
</ItemGroup>
3837

@@ -43,5 +42,9 @@
4342
</None>
4443
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
4544
</ItemGroup>
45+
46+
<ItemGroup>
47+
<ProjectReference Include="..\SimpleAuthentication.Abstractions\SimpleAuthentication.Abstractions.csproj" />
48+
</ItemGroup>
4649

4750
</Project>

0 commit comments

Comments
 (0)