我有一个像这样的 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 已删除
你修好了吗?我也有同样的问题,如果你有的话,请在这里发布解决方案。