Skip to content
Merged
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
5 changes: 1 addition & 4 deletions Daybreak.API/Daybreak.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,7 @@
<PackageReference Include="Serilog.Settings.Configuration" />
<PackageReference Include="Serilog.Sinks.Console" />
<PackageReference Include="Serilog.Sinks.File" />
<PackageReference Include="Swashbuckle.AspNetCore" />
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" />
<PackageReference Include="Scalar.AspNetCore" />
<PackageReference Include="SystemExtensions.NetStandard.Generators" PrivateAssets="all" />
<PackageReference Include="ZLinq" />
</ItemGroup>
Expand Down
2 changes: 0 additions & 2 deletions Daybreak.API/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ private static WebApplication CreateApplication(int port)
.WithRoutes()
.WithHealthChecks();

builder.Services.AddOpenApi();

// Add CORS policy - allow localhost and trusted community sites
builder.Services.AddCors(options =>
{
Expand Down
14 changes: 1 addition & 13 deletions Daybreak.API/Swagger/WebApplicationBuilderExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using Microsoft.AspNetCore.Http.Json;
using Microsoft.AspNetCore.Routing.Constraints;
using Microsoft.Extensions.Options;
using Swashbuckle.AspNetCore.SwaggerGen;
using System.Text.Json;
using Microsoft.AspNetCore.Routing.Constraints;

namespace Daybreak.API.Swagger;

Expand All @@ -11,14 +7,6 @@ public static class WebApplicationBuilderExtensions
public static WebApplicationBuilder WithSwagger(this WebApplicationBuilder builder)
{
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddTransient<ISerializerDataContractResolver>(sp =>
{
var opts = sp.GetRequiredService<IOptions<JsonOptions>>().Value?.SerializerOptions
?? new JsonSerializerOptions(JsonSerializerDefaults.Web);

return new JsonSerializerDataContractResolver(opts);
});
builder.Services.Configure<RouteOptions>(static options =>
{
options.SetParameterPolicy<RegexInlineRouteConstraint>("regex");
Expand Down
8 changes: 5 additions & 3 deletions Daybreak.API/Swagger/WebApplicationExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
namespace Daybreak.API.Swagger;
using Scalar.AspNetCore;

namespace Daybreak.API.Swagger;

public static class WebApplicationExtensions
{
public static WebApplication UseSwaggerWithUI(this WebApplication app)
{
app.UseSwagger();
app.UseSwaggerUI();
app.MapOpenApi();
app.MapScalarApiReference();
return app;
}
}
5 changes: 1 addition & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@
<PackageVersion Include="SevenZipExtractor" Version="1.0.19" />
<PackageVersion Include="SharpCompress" Version="0.47.4" />
<PackageVersion Include="SixLabors.ImageSharp" Version="3.1.12" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="10.1.7" />
<PackageVersion Include="Swashbuckle.AspNetCore.Swagger" Version="10.1.7" />
<PackageVersion Include="Swashbuckle.AspNetCore.SwaggerGen" Version="10.1.7" />
<PackageVersion Include="Swashbuckle.AspNetCore.SwaggerUI" Version="10.1.7" />
<PackageVersion Include="Scalar.AspNetCore" Version="2.14.1" />
<PackageVersion Include="Sybil" Version="0.8.4" />
<PackageVersion Include="System.IO.Compression" Version="4.3.0" />
<PackageVersion Include="System.Diagnostics.PerformanceCounter" Version="10.0.6" />
Expand Down