JsonSchemaGeneratorSettings 在 v.11 中不包含 SerializerSettings

问题描述 投票:0回答:1

我有一个像这样的 SwaggerUi3 实现

app.UseSwaggerUi3(typeof(Startup).Assembly, settings =>
{
    settings.Path = "/api/v1/swagger";
    settings.DocumentPath = "/api/v1/swagger/swagger.json";
    var serializerSettings = new JsonSerializerSettings();
    serializerSettings.Converters.Add(new StringEnumConverter());
    settings.GeneratorSettings.SerializerSettings = serializerSettings;
    settings.GeneratorSettings.SchemaType = NJsonSchema.SchemaType.OpenApi3;
    settings.GeneratorSettings.Title = "MyProject";
    settings.GeneratorSettings.Version = "v1";
    settings.GeneratorSettings.UseErrorResponse<ApiErrorResponse>();
    settings.GeneratorSettings.DocumentProcessors.Add(new LowercaseDocumentProcessor());

    settings.GeneratorSettings.UsePolymorphism(o => {
        o.UseBaseClass<ConnectorConfigDtoBase>(x => x.Discriminator);
        o.UseBaseClass<TargetConfigDtoBase>(x => x.Discriminator);
        o.UseBaseClass<FilterConfigDtoBase>(x => x.Discriminator);
    });

    settings.GeneratorSettings.AddOperationFilter(ctx =>
    {
        return ctx.OperationDescription.Path.StartsWith("/api/v1");
    });
});

但是当我将 NJsonSchema 更新到版本 11 时,我无法添加这个

settings.GeneratorSettings.SerializerSettings = serializerSettings;

如何解决这个问题

JsonSchemaGeneratorSettings.SerializerSettings 已删除

c# swagger-ui njsonschema
1个回答
0
投票

你修好了吗?我也有同样的问题,如果你有的话,请在这里发布解决方案。

© www.soinside.com 2019 - 2024. All rights reserved.