在 NJsonSchema 10.9 中,我曾经用 C# 创建模式生成器,如下所示:
private static JsonSchemaGenerator MakeGenerator()
{
JsonSchemaGeneratorSettings settings = new()
{
DefaultReferenceTypeNullHandling = ReferenceTypeNullHandling.NotNull,
AllowReferencesWithProperties = true,
FlattenInheritanceHierarchy = true
};
return new( settings );
}
Run Code Online (Sandbox Code Playgroud)
从版本 11 开始,JsonSchemaGeneratorSettings 是一个抽象类。我能找到的唯一实现是 SystemTextSchemaGeneratorSettings,它不能满足我的要求。实现JsonSchemaGeneratorSettings需要IReflectionService,但是DefaultReflectionService类也消失了。
有谁知道我必须做什么才能获得与 10.9 中相同的行为?
njsonschema ×1