[openapi] Move specification files to /openapi
This commit is contained in:
parent
1fd4bd0fad
commit
c4d2317897
2 changed files with 10 additions and 5 deletions
|
@ -31,20 +31,25 @@ public static class WebApplicationExtensions
|
||||||
|
|
||||||
public static IApplicationBuilder UseSwaggerWithOptions(this WebApplication app)
|
public static IApplicationBuilder UseSwaggerWithOptions(this WebApplication app)
|
||||||
{
|
{
|
||||||
app.UseSwagger();
|
app.UseSwagger(options =>
|
||||||
|
{
|
||||||
|
options.RouteTemplate = "/openapi/{documentName}.{extension:regex(^(json|ya?ml)$)}";
|
||||||
|
});
|
||||||
|
|
||||||
app.UseSwaggerUI(options =>
|
app.UseSwaggerUI(options =>
|
||||||
{
|
{
|
||||||
options.DocumentTitle = "Iceshrimp API documentation";
|
options.DocumentTitle = "Iceshrimp API documentation";
|
||||||
options.SwaggerEndpoint("iceshrimp/swagger.json", "Iceshrimp.NET");
|
options.SwaggerEndpoint("/openapi/iceshrimp.json", "Iceshrimp.NET");
|
||||||
options.SwaggerEndpoint("federation/swagger.json", "Federation");
|
options.SwaggerEndpoint("/openapi/federation.json", "Federation");
|
||||||
options.SwaggerEndpoint("mastodon/swagger.json", "Mastodon");
|
options.SwaggerEndpoint("/openapi/mastodon.json", "Mastodon");
|
||||||
options.InjectStylesheet("/swagger/styles.css");
|
options.InjectStylesheet("/css/swagger.css");
|
||||||
options.EnablePersistAuthorization();
|
options.EnablePersistAuthorization();
|
||||||
options.EnableTryItOutByDefault();
|
options.EnableTryItOutByDefault();
|
||||||
options.DisplayRequestDuration();
|
options.DisplayRequestDuration();
|
||||||
options.DefaultModelsExpandDepth(-1); // Hide "Schemas" section
|
options.DefaultModelsExpandDepth(-1); // Hide "Schemas" section
|
||||||
options.ConfigObject.AdditionalItems.Add("tagsSorter", "alpha"); // Sort tags alphabetically
|
options.ConfigObject.AdditionalItems.Add("tagsSorter", "alpha"); // Sort tags alphabetically
|
||||||
});
|
});
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue