Добавил маппинг JsonValue в конфигурацию сваггера

This commit is contained in:
ngfrolov 2023-04-21 13:48:29 +05:00
parent 4cb42c9f72
commit 4d52a9b89f
Signed by: ng.frolov
GPG Key ID: E99907A0357B29A7

View File

@ -1,4 +1,5 @@
using AsbCloudInfrastructure.Services;
using AsbCloudApp.Data.GTR;
using AsbCloudInfrastructure.Services;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.IdentityModel.Tokens;
@ -18,6 +19,15 @@ namespace AsbCloudWebApi
services.AddSwaggerGen(c =>
{
c.MapType<DateOnly>(() => new OpenApiSchema { Type = "string", Format = "date" });
c.MapType<JsonValue>(() => new OpenApiSchema {
AnyOf = new OpenApiSchema[]
{
new OpenApiSchema {Type = "string", Format = "string" },
new OpenApiSchema {Type = "number", Format = "int32" },
new OpenApiSchema {Type = "number", Format = "float" },
}
});
c.CustomOperationIds(e =>
{
return $"{e.ActionDescriptor.RouteValues["action"]}";