From f187c6942ea983057ce05da2b5714065ae3d38c4 Mon Sep 17 00:00:00 2001 From: Denis Prokhorchik Date: Sat, 23 Apr 2022 00:29:17 +0300 Subject: [PATCH] feat(task-324): include Swashbuckle.AspNetCore v1.1.0 to o2 s-link api --- .../O2NextGen.SLink.Api.csproj | 1 + .../Properties/launchSettings.json | 2 +- .../s-link/O2NextGen.SLink.Api/Startup.cs | 16 +++++++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Services/s-link/O2NextGen.SLink.Api/O2NextGen.SLink.Api.csproj b/src/Services/s-link/O2NextGen.SLink.Api/O2NextGen.SLink.Api.csproj index 1d09e569..2f8a0d68 100644 --- a/src/Services/s-link/O2NextGen.SLink.Api/O2NextGen.SLink.Api.csproj +++ b/src/Services/s-link/O2NextGen.SLink.Api/O2NextGen.SLink.Api.csproj @@ -11,6 +11,7 @@ + diff --git a/src/Services/s-link/O2NextGen.SLink.Api/Properties/launchSettings.json b/src/Services/s-link/O2NextGen.SLink.Api/Properties/launchSettings.json index 492692dd..6ea21c74 100644 --- a/src/Services/s-link/O2NextGen.SLink.Api/Properties/launchSettings.json +++ b/src/Services/s-link/O2NextGen.SLink.Api/Properties/launchSettings.json @@ -4,7 +4,7 @@ "O2NextGen.SLink.Api": { "commandName": "Project", "launchBrowser": true, - "launchUrl": "api/values", + "launchUrl": "swagger", "applicationUrl": "https://localhost:5001;http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" diff --git a/src/Services/s-link/O2NextGen.SLink.Api/Startup.cs b/src/Services/s-link/O2NextGen.SLink.Api/Startup.cs index 61ca2155..8748d5fa 100644 --- a/src/Services/s-link/O2NextGen.SLink.Api/Startup.cs +++ b/src/Services/s-link/O2NextGen.SLink.Api/Startup.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Swashbuckle.AspNetCore.Swagger; namespace O2NextGen.SLink.Api { @@ -19,6 +20,17 @@ public Startup(IConfiguration configuration) public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); + services.AddSwaggerGen(options => + { + options.DescribeAllEnumsAsStrings(); + options.SwaggerDoc("v1", new Info() + { + Title = "O2NextGen Platform. S-Link HTTP API", + Version = "v1", + Description = "S-Link API Service. The service allows you to create speciali link", + TermsOfService = "Terms of Service" + }); + }); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. @@ -33,8 +45,10 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) app.UseHsts(); } + app.UseSwagger() + .UseSwaggerUI(c => { c.SwaggerEndpoint($"/swagger/v1/swagger.json", "S-Link API V1"); }); app.UseHttpsRedirection(); app.UseMvc(); } } -} +} \ No newline at end of file