Skip to content

Commit 83f8bd8

Browse files
committed
Added swagger to Payment.api
1 parent 99dd90e commit 83f8bd8

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

src/Services/Payment/Payment.API/Payment.API.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<ItemGroup>
1010
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" />
1111
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
12+
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
1213
</ItemGroup>
1314
<ItemGroup>
1415
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />

src/Services/Payment/Payment.API/Startup.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using RabbitMQ.Client;
1717
using System;
1818
using System.Threading.Tasks;
19+
using Swashbuckle.AspNetCore.Swagger;
1920

2021
namespace Payment.API
2122
{
@@ -75,6 +76,19 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
7576
checks.AddValueTaskCheck("HTTP Endpoint", () => new ValueTask<IHealthCheckResult>(HealthCheckResult.Healthy("Ok")));
7677
});
7778

79+
// Add framework services.
80+
services.AddSwaggerGen(options =>
81+
{
82+
options.DescribeAllEnumsAsStrings();
83+
options.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info
84+
{
85+
Title = "eShopOnContainers - Payment HTTP API",
86+
Version = "v1",
87+
Description = "The Payment Microservice HTTP API. This is a Data-Driven/CRUD microservice sample",
88+
TermsOfService = "Terms Of Service"
89+
});
90+
});
91+
7892
RegisterEventBus(services);
7993

8094
var container = new ContainerBuilder();

0 commit comments

Comments
 (0)