<PackageReference Include="NJsonSchema" Version="11.0.0-preview005" />

JsonSchemaAppender

public class JsonSchemaAppender
Appends a schema to a document (i.e. another schema).
using System; using System.Runtime.CompilerServices; namespace NJsonSchema { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] public class JsonSchemaAppender { private readonly ITypeNameGenerator _typeNameGenerator; public object RootObject { get; } protected JsonSchema RootSchema => (JsonSchema)RootObject; public JsonSchemaAppender(object rootObject, ITypeNameGenerator typeNameGenerator) { RootObject = rootObject; _typeNameGenerator = typeNameGenerator; } public virtual void AppendSchema(JsonSchema schema, [System.Runtime.CompilerServices.Nullable(2)] string typeNameHint) { if (schema == null) throw new ArgumentNullException("schema"); if (schema != RootObject && !RootSchema.Definitions.Values.Contains(schema)) { string text = _typeNameGenerator.Generate(schema, typeNameHint, RootSchema.Definitions.Keys); if (!string.IsNullOrEmpty(text) && !RootSchema.Definitions.ContainsKey(text)) RootSchema.Definitions[text] = schema; else RootSchema.Definitions["ref_" + Guid.NewGuid().ToString().Replace("-", "_")] = schema; } } } }