<PackageReference Include="NJsonSchema" Version="9.4.3" />

JsonSchemaGeneratorSettings

The JSON Schema generator settings.
using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using NJsonSchema.Generation.TypeMappers; using System; using System.Collections.Generic; using System.Collections.ObjectModel; namespace NJsonSchema.Generation { public class JsonSchemaGeneratorSettings { public EnumHandling DefaultEnumHandling { get; set; } public PropertyNameHandling DefaultPropertyNameHandling { get; set; } public bool GenerateAbstractProperties { get; set; } public bool FlattenInheritanceHierarchy { get; set; } public bool GenerateKnownTypes { get; set; } = true; public bool GenerateXmlObjects { get; set; } public bool IgnoreObsoleteProperties { get; set; } public NullHandling NullHandling { get; set; } public IContractResolver ContractResolver { get; set; } [JsonIgnore] public ITypeNameGenerator TypeNameGenerator { get; set; } [JsonIgnore] public ISchemaNameGenerator SchemaNameGenerator { get; set; } [JsonIgnore] public ICollection<ITypeMapper> TypeMappers { get; set; } = new Collection<ITypeMapper>(); [JsonIgnore] public IList<ISchemaProcessor> SchemaProcessors { get; } = new List<ISchemaProcessor>(); public IContractResolver ActualContractResolver { get { if (DefaultPropertyNameHandling != 0 && ContractResolver != null) throw new InvalidOperationException("The settingsDefaultPropertyNameHandling and ContractResolver cannot be used at the same time."); if (ContractResolver != null) return ContractResolver; if (DefaultPropertyNameHandling == PropertyNameHandling.CamelCase) return new CamelCasePropertyNamesContractResolver(); if (DefaultPropertyNameHandling == PropertyNameHandling.SnakeCase) return new DefaultContractResolver { NamingStrategy = new SnakeCaseNamingStrategy() }; return new DefaultContractResolver(); } } public JsonSchemaGeneratorSettings() { DefaultEnumHandling = EnumHandling.Integer; NullHandling = NullHandling.JsonSchema; DefaultPropertyNameHandling = PropertyNameHandling.Default; TypeNameGenerator = new DefaultTypeNameGenerator(); SchemaNameGenerator = new DefaultSchemaNameGenerator(); } } }