Skip to content

Commit 30eaec1

Browse files
authored
Merge pull request #175 from marcominerva/develop
Update to .NET 10
2 parents a0ae977 + e22ef65 commit 30eaec1

23 files changed

Lines changed: 452 additions & 95 deletions

.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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
</PropertyGroup>
88

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

1414
<ItemGroup>

samples/MinimalApis/Net8JwtBearerSample/Program.cs

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using JwtBearerSample.Authentication;
33
using Microsoft.AspNetCore.Authentication;
44
using Microsoft.AspNetCore.Http.HttpResults;
5+
using Microsoft.OpenApi;
56
using SimpleAuthentication;
67
using SimpleAuthentication.JwtBearer;
78
using SimpleAuthentication.Permissions;
@@ -57,7 +58,11 @@
5758
app.UseExceptionHandler();
5859
app.UseStatusCodePages();
5960

60-
app.UseSwagger();
61+
app.UseSwagger(options =>
62+
{
63+
options.OpenApiVersion = OpenApiSpecVersion.OpenApi3_1;
64+
});
65+
6166
app.UseSwaggerUI();
6267

6368
app.UseAuthentication();
@@ -79,11 +84,7 @@
7984
var token = await jwtBearerService.CreateTokenAsync(loginRequest.UserName, claims, absoluteExpiration: expiration);
8085
return TypedResults.Ok(new LoginResponse(token));
8186
})
82-
.WithOpenApi(operation =>
83-
{
84-
operation.Description = "Insert permissions in the scope property (for example: 'profile people:admin')";
85-
return operation;
86-
});
87+
.WithDescription("Insert permissions in the scope property (for example: 'profile people:admin')");
8788

8889
authApiGroup.MapPost("validate", async Task<Results<Ok<User>, BadRequest>> (string token, bool validateLifetime, IJwtBearerService jwtBearerService) =>
8990
{
@@ -95,38 +96,28 @@
9596
}
9697

9798
return TypedResults.Ok(new User(result.Principal.Identity!.Name));
98-
})
99-
.WithOpenApi();
99+
});
100100

101101
authApiGroup.MapPost("refresh", async (string token, bool validateLifetime, DateTime? expiration, IJwtBearerService jwtBearerService) =>
102102
{
103103
var newToken = await jwtBearerService.RefreshTokenAsync(token, validateLifetime, expiration);
104104
return TypedResults.Ok(new LoginResponse(newToken));
105-
})
106-
.WithOpenApi();
105+
});
107106

108107
app.MapGet("api/me", (ClaimsPrincipal user) =>
109108
{
110109
return TypedResults.Ok(new User(user.Identity!.Name));
111110
})
112111
.RequireAuthorization()
113112
.RequirePermission("profile")
114-
.WithOpenApi(operation =>
115-
{
116-
operation.Description = "This endpoint requires the 'profile' permission";
117-
return operation;
118-
});
113+
.WithDescription("This endpoint requires the 'profile' permission");
119114

120115
app.MapGet("api/people", () =>
121116
{
122117
return TypedResults.NoContent();
123118
})
124119
.RequireAuthorization(policyNames: "PeopleRead")
125-
.WithOpenApi(operation =>
126-
{
127-
operation.Description = $"This endpoint requires the '{Permissions.PeopleRead}' or '{Permissions.PeopleAdmin}' permissions";
128-
return operation;
129-
});
120+
.WithDescription($"This endpoint requires the '{Permissions.PeopleRead}' or '{Permissions.PeopleAdmin}' permissions");
130121

131122
app.Run();
132123

src/Directory.Build.props

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

1111
<ItemGroup>
12-
<PackageReference Include="Nerdbank.GitVersioning" Version="3.8.118" PrivateAssets="All" />
12+
<PackageReference Include="Nerdbank.GitVersioning" Version="3.9.50" PrivateAssets="All" />
1313
</ItemGroup>
1414

1515
</Project>

0 commit comments

Comments
 (0)