Skip to content

Commit

Permalink
template: replace SwaggerUI with Scalar. Un-deprecated Swashbuckle fo…
Browse files Browse the repository at this point in the history
…r spec generation because of major bugs like dotnet/aspnetcore#58968
  • Loading branch information
ascott18 committed Nov 15, 2024
1 parent 2ab3ebd commit 9d9e753
Show file tree
Hide file tree
Showing 16 changed files with 157 additions and 71 deletions.
10 changes: 2 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@
## Features

- Added support for .NET 9.
- `IntelliTect.Coalesce.Swashbuckle` is now deprecated in favor of `Microsoft.AspNetCore.OpenApi` for .NET 9+ projects. To upgrade:
- Replace `services.AddSwaggerGen(...)` with `services.AddOpenApi()`.
- Replace `app.MapSwagger()` with `app.MapOpenApi()`.
- Replace `app.UseSwaggerUI()` with `app.MapScalarApiReference()` from package `Scalar.AspNetCore`. The OpenAPI UI maps to `/scalar/v1` by default.
- Added a `reset` method to all [API caller objects](https://intellitect.github.io/Coalesce/stacks/vue/layers/api-clients.html#api-callers). This method resets all stateful fields on the object to default values.
- Template: Added username/password auth option (aka individual user accounts, aka local accounts)

## Fixes

- Fix an ObjectDisposedException from `StandardBehaviors.GetExceptionResult` when using an `IDbContextFactory` in an `Execute[Save|Delete]Async` implementation.


# 5.1.0

## Features
Expand All @@ -26,7 +21,6 @@
- `c-admin-table`: Clicking a row takes you to the details page (#465)
- `c-admin-table`: Always show button for details page (#465)


## Fixes

- Service controllers missing `ActionResult File(IFile)` method. (#474)
Expand All @@ -42,7 +36,7 @@

# 5.0.3

## Fixes
## Fixes

- Remove flawed logic that chooses the wrong foreign key for navigation properties where the target type of the navigation property has a primary key that also serves as a foreign key in some other relationship. In exceedingly rare cases, you may now have to add a `[ForeignKey(Name = ...)]` attribute to any navigation properties that may now throw a codegen validation error that their foreign key property cannot be discovered automatically. Related to this issue, `ClassViewModel.IsOneToOne` is now deprecated and slated for future removal.

Expand All @@ -53,7 +47,7 @@
- Make "not found" messages from data sources clearer when the ID is null or empty string. (#447)
- Added multi-tenancy options to the template. (#441, #461)

## Fixes
## Fixes

- Template: adjust manual chunking configuration to avoid circular deps. (#455)
- Audit logs: key props now respect configured property exclusions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@
"OpenAPI": {
"type": "parameter",
"datatype": "bool",
"displayName": "OpenAPI/Swagger",
"description": "Include configuration to expose an OpenAPI document and SwaggerUI using Swashbuckle."
"displayName": "OpenAPI",
"description": "Include configuration to expose an OpenAPI document, and interactive UI with Scalar."
},
"Tenancy": {
"type": "parameter",
Expand Down Expand Up @@ -273,7 +273,10 @@
},
{
"condition": "!EmailSendGrid",
"exclude": ["**/SendGridEmailOptions.cs", "**/SendGridEmailService.cs"]
"exclude": [
"**/SendGridEmailOptions.cs",
"**/SendGridEmailService.cs"
]
},
{
"condition": "!ExampleModel",
Expand All @@ -283,6 +286,10 @@
"**/Widget.cs"
]
},
{
"condition": "!OpenAPI",
"exclude": ["**/OpenAPI.vue"]
},
{
"condition": "!AzurePipelines",
"exclude": ["**/azure-pipelines.yml"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
Expand All @@ -19,7 +19,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Moq.AutoMock" Version="3.5.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.DataProtection.EntityFrameworkCore" Version="8.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.10" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.EntityFrameworkCore" Version="9.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0" />

<!-- Transitive dependency of Microsoft.Data.SqlClient. Resolves vulnerability. -->
<PackageReference Include="Azure.Identity" Version="1.12.1" />

<!-- Transitive dependency of many things. Resolves vulnerability. -->
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" />

<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<DotnetCliToolTargetFramework>net8.0</DotnetCliToolTargetFramework>
<TargetFramework>net9.0</TargetFramework>
<DotnetCliToolTargetFramework>net9.0</DotnetCliToolTargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -12,15 +12,16 @@
<PackageReference Include="IntelliTect.Coalesce.Vue" Version="$(CoalesceVersion)" />
<!--#if (OpenAPI) -->
<PackageReference Include="IntelliTect.Coalesce.Swashbuckle" Version="$(CoalesceVersion)" />
<PackageReference Include="Scalar.AspNetCore" Version="1.2.37" />
<!--#endif -->
<!--#if (AppInsights) -->
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
<!--#endif -->
<!--#if (MicrosoftAuth) -->
<PackageReference Include="Microsoft.AspNetCore.Authentication.MicrosoftAccount" Version="8.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.MicrosoftAccount" Version="9.0.0" />
<!--#endif -->
<!--#if (GoogleAuth) -->
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="8.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="9.0.0" />
<!--#endif -->
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Microsoft.Extensions.Logging.Console;
#if OpenAPI
using Microsoft.OpenApi.Models;
using Scalar.AspNetCore;
#endif
using System.Security.Claims;
using System.Text.Json;
Expand Down Expand Up @@ -192,10 +193,7 @@

#if OpenAPI
app.MapSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/current/swagger.json", "Current API");
});
app.MapScalarApiReference(c => c.OpenApiRoutePattern = "/swagger/{documentName}/swagger.json");
#endif

app.MapRazorPages();
Expand Down
Loading

0 comments on commit 9d9e753

Please sign in to comment.