Cleanup OpenAPI WebUI (Swagger)
This commit is contained in:
parent
8522cb7d0d
commit
3dc64fad38
3 changed files with 17 additions and 3 deletions
|
@ -44,7 +44,6 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Core\Database\Tables\"/>
|
<Folder Include="Core\Database\Tables\"/>
|
||||||
<Folder Include="wwwroot\"/>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
using Asp.Versioning;
|
using Asp.Versioning;
|
||||||
using Iceshrimp.Backend.Core.Extensions;
|
using Iceshrimp.Backend.Core.Extensions;
|
||||||
|
using Microsoft.OpenApi.Models;
|
||||||
|
using Swashbuckle.AspNetCore.SwaggerUI;
|
||||||
using Vite.AspNetCore.Extensions;
|
using Vite.AspNetCore.Extensions;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
@ -21,7 +23,9 @@ builder.Services.AddApiVersioning(options => {
|
||||||
options.UnsupportedApiVersionStatusCode = 501;
|
options.UnsupportedApiVersionStatusCode = 501;
|
||||||
});
|
});
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
builder.Services.AddSwaggerGen();
|
builder.Services.AddSwaggerGen(options => {
|
||||||
|
options.SwaggerDoc("v1", new OpenApiInfo { Title = "Iceshrimp.NET", Version = "1.0" });
|
||||||
|
});
|
||||||
builder.Services.AddRazorPages();
|
builder.Services.AddRazorPages();
|
||||||
builder.Services.AddViteServices(options => {
|
builder.Services.AddViteServices(options => {
|
||||||
options.PackageDirectory = "../Iceshrimp.Frontend";
|
options.PackageDirectory = "../Iceshrimp.Frontend";
|
||||||
|
@ -44,7 +48,15 @@ var config = app.Initialize(args);
|
||||||
// This determines the order of middleware execution in the request pipeline
|
// This determines the order of middleware execution in the request pipeline
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
app.UseSwagger();
|
app.UseSwagger();
|
||||||
app.UseSwaggerUI(options => { options.DocumentTitle = "Iceshrimp API documentation"; });
|
app.UseSwaggerUI(options => {
|
||||||
|
options.DocumentTitle = "Iceshrimp API documentation";
|
||||||
|
options.SwaggerEndpoint("v1/swagger.json", "Iceshrimp.NET");
|
||||||
|
options.InjectStylesheet("/swagger/styles.css");
|
||||||
|
options.EnablePersistAuthorization();
|
||||||
|
options.EnableTryItOutByDefault();
|
||||||
|
options.DisplayRequestDuration();
|
||||||
|
options.DefaultModelsExpandDepth(-1); // Hide "Schemas" section
|
||||||
|
});
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
app.UseRateLimiter();
|
app.UseRateLimiter();
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
|
3
Iceshrimp.Backend/wwwroot/swagger/styles.css
Normal file
3
Iceshrimp.Backend/wwwroot/swagger/styles.css
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.swagger-ui .topbar .download-url-wrapper {
|
||||||
|
display: none;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue