Swagger comment support added Catalog, Webhook, Order and Basket services. Swagger and swagger comment support added to Identity Service

This commit is contained in:
Onurkan Bakırcı 2022-03-21 15:33:02 +03:00 committed by GitHub
parent 981507dccb
commit 7c6221cc22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 110 additions and 10 deletions

View File

@ -6,7 +6,10 @@
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
<IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
</PropertyGroup>
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<Content Update="web.config">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>

View File

@ -29,11 +29,26 @@ public class Startup
services.AddSwaggerGen(options =>
{
var basePath = AppDomain.CurrentDomain.BaseDirectory;
var fileName = typeof(Program).GetTypeInfo().Assembly.GetName().Name + ".xml";
var xmlComments = Path.Combine(basePath, fileName);
options.IncludeXmlComments(xmlComments);
options.SwaggerDoc("v1", new OpenApiInfo
{
Title = "eShopOnContainers - Basket HTTP API",
Version = "v1",
Description = "The Basket Service HTTP API"
Description = "The Basket Service HTTP API",
TermsOfService = new Uri("https://microsoft.com/"),
Contact = new OpenApiContact
{
Name = "Microsoft Contact",
Url = new Uri("https://microsoft.com/")
},
License = new OpenApiLicense
{
Name = "Microsoft License",
Url = new Uri("https://microsoft.com/")
}
});
options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme

View File

@ -11,7 +11,10 @@
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
<IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
</PropertyGroup>
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<Content Update="appsettings.json">

View File

@ -222,11 +222,26 @@ public static class CustomExtensionMethods
{
services.AddSwaggerGen(options =>
{
var basePath = AppDomain.CurrentDomain.BaseDirectory;
var fileName = typeof(Program).GetTypeInfo().Assembly.GetName().Name + ".xml";
var xmlComments = Path.Combine(basePath, fileName);
options.IncludeXmlComments(xmlComments);
options.SwaggerDoc("v1", new OpenApiInfo
{
Title = "eShopOnContainers - Catalog HTTP API",
Version = "v1",
Description = "The Catalog Microservice HTTP API. This is a Data-Driven/CRUD microservice sample"
Description = "The Catalog Microservice HTTP API. This is a Data-Driven/CRUD microservice sample",
TermsOfService = new Uri("https://microsoft.com/terms"),
Contact = new OpenApiContact
{
Name = "Microsoft Contact",
Url = new Uri("https://microsoft.com/contact")
},
License = new OpenApiLicense
{
Name = "Microsoft License",
Url = new Uri("https://microsoft.com/license")
}
});
});

View File

@ -8,6 +8,11 @@
<IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
</PropertyGroup>
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<Content Include="Setup\**\*;">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>

View File

@ -1,4 +1,4 @@
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.DataProtection;
namespace Microsoft.eShopOnContainers.Services.Identity.API
{
@ -89,6 +89,29 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
services.AddControllersWithViews();
services.AddRazorPages();
var basePath = AppDomain.CurrentDomain.BaseDirectory;
var fileName = typeof(Program).GetTypeInfo().Assembly.GetName().Name + ".xml";
var xmlComments = Path.Combine(basePath, fileName);
options.IncludeXmlComments(xmlComments);
options.SwaggerDoc("v1", new OpenApiInfo
{
Title = "Microsoft - Identity HTTP API",
Version = "v1",
Description = "The Identity Service HTTP API",
TermsOfService = new Uri("https://microsoft.com/"),
Contact = new OpenApiContact
{
Name = "Microsoft Contact",
Url = new Uri("https://microsoft.com/")
},
License = new OpenApiLicense
{
Name = "Microsoft License",
Url = new Uri("https://microsoft.com/")
}
});
});
var container = new ContainerBuilder();
container.Populate(services);

View File

@ -8,7 +8,10 @@
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
<IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
</PropertyGroup>
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<Content Update="web.config;">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>

View File

@ -214,12 +214,27 @@ static class CustomExtensionsMethods
public static IServiceCollection AddCustomSwagger(this IServiceCollection services, IConfiguration configuration)
{
services.AddSwaggerGen(options =>
{
{
var basePath = AppDomain.CurrentDomain.BaseDirectory;
var fileName = typeof(Program).GetTypeInfo().Assembly.GetName().Name + ".xml";
var xmlComments = Path.Combine(basePath, fileName);
options.IncludeXmlComments(xmlComments);
options.SwaggerDoc("v1", new OpenApiInfo
{
Title = "eShopOnContainers - Ordering HTTP API",
Version = "v1",
Description = "The Ordering Service HTTP API"
Description = "The Ordering Service HTTP API",
TermsOfService = new Uri("https://microsoft.com/terms"),
Contact = new OpenApiContact
{
Name = "Microsoft Contact",
Url = new Uri("https://microsoft.com/")
},
License = new OpenApiLicense
{
Name = "Microsoft License",
Url = new Uri("https://microsoft.com/")
}
});
options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
{

View File

@ -139,11 +139,26 @@ static class CustomExtensionMethods
{
services.AddSwaggerGen(options =>
{
var basePath = AppDomain.CurrentDomain.BaseDirectory;
var fileName = typeof(Program).GetTypeInfo().Assembly.GetName().Name + ".xml";
var xmlComments = Path.Combine(basePath, fileName);
options.IncludeXmlComments(xmlComments);
options.SwaggerDoc("v1", new OpenApiInfo
{
Title = "eShopOnContainers - Webhooks HTTP API",
Version = "v1",
Description = "The Webhooks Microservice HTTP API. This is a simple webhooks CRUD registration entrypoint"
Description = "The Webhooks Microservice HTTP API. This is a simple webhooks CRUD registration entrypoint",
TermsOfService = new Uri("https://microsoft.com/"),
Contact = new OpenApiContact
{
Name = "Microsoft Contact",
Url = new Uri("https://microsoft.com/")
},
License = new OpenApiLicense
{
Name = "Microsoft License",
Url = new Uri("https://microsoft.com/")
}
});
options.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme

View File

@ -8,7 +8,10 @@
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
<IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
</PropertyGroup>
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="5.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />