Skip to content

Commit 65c7a60

Browse files
authored
Switch to scalar for swagger-ui generation (#3391)
1 parent 77c802e commit 65c7a60

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

Diff for: ArchiSteamFarm/ArchiSteamFarm.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" />
1616
<PackageReference Include="Nito.AsyncEx.Coordination" />
1717
<PackageReference Include="NLog.Web.AspNetCore" />
18+
<PackageReference Include="Scalar.AspNetCore" />
1819
<PackageReference Include="SteamKit2" />
19-
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" />
2020
<PackageReference Include="System.Composition" />
2121
<PackageReference Include="System.Linq.Async" />
2222
<PackageReference Include="System.Security.Cryptography.ProtectedData" />

Diff for: ArchiSteamFarm/IPC/ArchiKestrel.cs

+7-8
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
using Microsoft.Extensions.Logging;
5555
using Microsoft.Net.Http.Headers;
5656
using NLog.Web;
57+
using Scalar.AspNetCore;
5758
using IPNetwork = Microsoft.AspNetCore.HttpOverrides.IPNetwork;
5859

5960
namespace ArchiSteamFarm.IPC;
@@ -258,14 +259,12 @@ private static void ConfigureApp([SuppressMessage("ReSharper", "SuggestBaseTypeF
258259
app.MapOpenApi("/swagger/{documentName}/swagger.json");
259260

260261
// Add support for swagger UI, this should be after swagger, obviously
261-
app.UseSwaggerUI(
262-
static options => {
263-
options.DisplayRequestDuration();
264-
options.EnableDeepLinking();
265-
options.EnableTryItOutByDefault();
266-
options.ShowCommonExtensions();
267-
options.ShowExtensions();
268-
options.SwaggerEndpoint($"{SharedInfo.ASF}/swagger.json", $"{SharedInfo.ASF} API");
262+
app.MapScalarApiReference(
263+
"/swagger", static options => {
264+
options.DefaultFonts = false;
265+
options.OpenApiRoutePattern = $"/swagger/{SharedInfo.ASF}/swagger.json";
266+
options.Theme = ScalarTheme.Kepler;
267+
options.Title = $"{SharedInfo.AssemblyName} API";
269268
}
270269
);
271270
}

Diff for: Directory.Packages.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.11.1" />
1717
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.11.1" />
1818
<PackageVersion Include="OpenTelemetry.Instrumentation.Runtime" Version="1.11.1" />
19+
<PackageVersion Include="Scalar.AspNetCore" Version="2.0.21" />
1920
<PackageVersion Include="SteamKit2" Version="3.0.2" />
20-
<PackageVersion Include="Swashbuckle.AspNetCore.SwaggerUI" Version="7.3.2" />
2121
<PackageVersion Include="System.Composition" Version="9.0.3" />
2222
<PackageVersion Include="System.Composition.AttributedModel" Version="9.0.3" />
2323
<PackageVersion Include="System.Linq.Async" Version="6.0.1" />

0 commit comments

Comments
 (0)