public static IServiceCollection AddApiDocumentation(this IServiceCollection serviceCollection, ApiDocumentationOptions apiDocumentationOptions) { if (apiDocumentationOptions.Enabled) { serviceCollection.AddSwaggerGen(c => c.SwaggerDoc("v1", new OpenApiInfo { Title = "NxPlx API", Version = "v1" })); } return(serviceCollection); }
public static void UseApiDocumentation(this IApplicationBuilder app, string documentationUrl, ApiDocumentationOptions apiDocumentationOptions) { if (apiDocumentationOptions.Enabled) { app.UseSwagger(); app.UseSwaggerUI(c => { c.RoutePrefix = documentationUrl; c.SwaggerEndpoint($"/api/swagger/v1/swagger.json", "NxPlx API"); }); } }