Removed ASP.NET Core's (2.1) default model validation behavior

This commit is contained in:
rafsanulhasan 2018-08-13 21:20:55 +06:00
parent 6d0882d020
commit e159536ff3

View File

@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.ServiceBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
@ -49,6 +50,11 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
{
RegisterAppInsights(services);
services.Configure<ApiBehaviorOptions>(opt =>
{
opt.SuppressModelStateInvalidFilter = true;
});
// Add framework services.
services.AddMvc(options =>
{
@ -207,7 +213,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
.UseSwaggerUI(c =>
{
c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Basket.API V1");
c.OAuthClientId ("basketswaggerui");
c.OAuthClientId("basketswaggerui");
c.OAuthAppName("Basket Swagger UI");
});