diff --git a/src/Services/Basket/Basket.API/Basket.API.csproj b/src/Services/Basket/Basket.API/Basket.API.csproj index ebb224824..16d662ea6 100644 --- a/src/Services/Basket/Basket.API/Basket.API.csproj +++ b/src/Services/Basket/Basket.API/Basket.API.csproj @@ -6,7 +6,10 @@ false true - + + true + $(NoWarn);1591 + PreserveNewest diff --git a/src/Services/Basket/Basket.API/GlobalUsings.cs b/src/Services/Basket/Basket.API/GlobalUsings.cs index 75f7a878e..b6eecbc48 100644 --- a/src/Services/Basket/Basket.API/GlobalUsings.cs +++ b/src/Services/Basket/Basket.API/GlobalUsings.cs @@ -58,4 +58,5 @@ global using System.Net; global using System.Security.Claims; global using System.Text.Json; global using System.Threading.Tasks; -global using System; \ No newline at end of file +global using System; +global using System.Reflection; \ No newline at end of file diff --git a/src/Services/Basket/Basket.API/Startup.cs b/src/Services/Basket/Basket.API/Startup.cs index 082560048..6e3171bf9 100644 --- a/src/Services/Basket/Basket.API/Startup.cs +++ b/src/Services/Basket/Basket.API/Startup.cs @@ -29,11 +29,26 @@ public class Startup services.AddSwaggerGen(options => { + var basePath = AppDomain.CurrentDomain.BaseDirectory; + var fileName = typeof(Startup).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 diff --git a/src/Services/Catalog/Catalog.API/Catalog.API.csproj b/src/Services/Catalog/Catalog.API/Catalog.API.csproj index b78ce2af3..7de11b7c2 100644 --- a/src/Services/Catalog/Catalog.API/Catalog.API.csproj +++ b/src/Services/Catalog/Catalog.API/Catalog.API.csproj @@ -11,7 +11,10 @@ false true - + + true + $(NoWarn);1591 + diff --git a/src/Services/Catalog/Catalog.API/Startup.cs b/src/Services/Catalog/Catalog.API/Startup.cs index f7b46cb6f..c7fd068c7 100644 --- a/src/Services/Catalog/Catalog.API/Startup.cs +++ b/src/Services/Catalog/Catalog.API/Startup.cs @@ -222,16 +222,29 @@ public static class CustomExtensionMethods { services.AddSwaggerGen(options => { + var basePath = AppDomain.CurrentDomain.BaseDirectory; + var fileName = typeof(Startup).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") + } }); }); - return services; - } public static IServiceCollection AddIntegrationServices(this IServiceCollection services, IConfiguration configuration) diff --git a/src/Services/Identity/Identity.API/GlobalUsings.cs b/src/Services/Identity/Identity.API/GlobalUsings.cs index bfbb354db..b96eff851 100644 --- a/src/Services/Identity/Identity.API/GlobalUsings.cs +++ b/src/Services/Identity/Identity.API/GlobalUsings.cs @@ -58,7 +58,9 @@ global using System.Security.Cryptography.X509Certificates; global using System.Text.RegularExpressions; global using System.Threading.Tasks; global using System; - +global using System.Reflection; +global using Microsoft.OpenApi.Models; +global using System.IO; diff --git a/src/Services/Identity/Identity.API/Identity.API.csproj b/src/Services/Identity/Identity.API/Identity.API.csproj index 0398ccb4b..e484b7730 100644 --- a/src/Services/Identity/Identity.API/Identity.API.csproj +++ b/src/Services/Identity/Identity.API/Identity.API.csproj @@ -8,6 +8,11 @@ true + + true + $(NoWarn);1591 + + PreserveNewest diff --git a/src/Services/Identity/Identity.API/Startup.cs b/src/Services/Identity/Identity.API/Startup.cs index 43662acdd..1b902e246 100644 --- a/src/Services/Identity/Identity.API/Startup.cs +++ b/src/Services/Identity/Identity.API/Startup.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.DataProtection; +using Microsoft.AspNetCore.DataProtection; namespace Microsoft.eShopOnContainers.Services.Identity.API { @@ -89,6 +89,30 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API services.AddControllersWithViews(); services.AddRazorPages(); + services.AddSwaggerGen(options => + { + var basePath = AppDomain.CurrentDomain.BaseDirectory; + var fileName = typeof(Startup).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); diff --git a/src/Services/Ordering/Ordering.API/Application/Behaviors/TransactionBehaviour.cs b/src/Services/Ordering/Ordering.API/Application/Behaviors/TransactionBehaviour.cs index 0417d40f6..21117d730 100644 --- a/src/Services/Ordering/Ordering.API/Application/Behaviors/TransactionBehaviour.cs +++ b/src/Services/Ordering/Ordering.API/Application/Behaviors/TransactionBehaviour.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.Logging; public class TransactionBehaviour : IPipelineBehavior + where TRequest : IRequest { private readonly ILogger> _logger; private readonly OrderingContext _dbContext; diff --git a/src/Services/Ordering/Ordering.API/Ordering.API.csproj b/src/Services/Ordering/Ordering.API/Ordering.API.csproj index 5b011d037..18b6ea0e8 100644 --- a/src/Services/Ordering/Ordering.API/Ordering.API.csproj +++ b/src/Services/Ordering/Ordering.API/Ordering.API.csproj @@ -8,7 +8,10 @@ false true - + + true + $(NoWarn);1591 + PreserveNewest diff --git a/src/Services/Ordering/Ordering.API/Startup.cs b/src/Services/Ordering/Ordering.API/Startup.cs index 501a55361..0cbd5b0a0 100644 --- a/src/Services/Ordering/Ordering.API/Startup.cs +++ b/src/Services/Ordering/Ordering.API/Startup.cs @@ -214,13 +214,29 @@ static class CustomExtensionsMethods public static IServiceCollection AddCustomSwagger(this IServiceCollection services, IConfiguration configuration) { services.AddSwaggerGen(options => - { + { + var basePath = AppDomain.CurrentDomain.BaseDirectory; + var fileName = typeof(Startup).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 { Type = SecuritySchemeType.OAuth2, diff --git a/src/Services/Webhooks/Webhooks.API/GlobalUsings.cs b/src/Services/Webhooks/Webhooks.API/GlobalUsings.cs index c575b7235..cd5624bad 100644 --- a/src/Services/Webhooks/Webhooks.API/GlobalUsings.cs +++ b/src/Services/Webhooks/Webhooks.API/GlobalUsings.cs @@ -48,3 +48,7 @@ global using Webhooks.API.IntegrationEvents; global using Webhooks.API.Model; global using Webhooks.API.Services; global using Webhooks.API; +global using System.Reflection; +global using Microsoft.OpenApi.Models; +global using System.IO; + diff --git a/src/Services/Webhooks/Webhooks.API/Startup.cs b/src/Services/Webhooks/Webhooks.API/Startup.cs index 256941efa..c57f3f962 100644 --- a/src/Services/Webhooks/Webhooks.API/Startup.cs +++ b/src/Services/Webhooks/Webhooks.API/Startup.cs @@ -139,11 +139,26 @@ static class CustomExtensionMethods { services.AddSwaggerGen(options => { + var basePath = AppDomain.CurrentDomain.BaseDirectory; + var fileName = typeof(Startup).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 diff --git a/src/Services/Webhooks/Webhooks.API/Webhooks.API.csproj b/src/Services/Webhooks/Webhooks.API/Webhooks.API.csproj index 063a01cf3..98e8efcaf 100644 --- a/src/Services/Webhooks/Webhooks.API/Webhooks.API.csproj +++ b/src/Services/Webhooks/Webhooks.API/Webhooks.API.csproj @@ -8,7 +8,10 @@ false true - + + true + $(NoWarn);1591 +