Class CodeGeneratorSettings
CSharp code generator settings
public class CodeGeneratorSettings
- Inheritance
-
CodeGeneratorSettings
- Inherited Members
Properties
AnyType
Gets or sets the any type (default: "object").
public string AnyType { get; set; }
Property Value
ArrayBaseType
Gets or sets the generic array .NET type which is used as base class (default: 'Collection').
public string ArrayBaseType { get; set; }
Property Value
ArrayInstanceType
Gets or sets the generic array .NET type which is used for ArrayType instances (default: 'Collection').
public string ArrayInstanceType { get; set; }
Property Value
ArrayType
Gets or sets the generic array .NET type (default: 'ICollection').
public string ArrayType { get; set; }
Property Value
CustomTemplateDirectory
Gets or sets a directory path which contains liquid templates for NSwag. If null or empty, uses default templates.
public string? CustomTemplateDirectory { get; set; }
Property Value
DateFormat
Gets or sets the date string format to use
public string? DateFormat { get; set; }
Property Value
DateTimeFormat
Gets or sets the date-time string format to use
public string? DateTimeFormat { get; set; }
Property Value
DateTimeType
Gets or sets the date time .NET type (default: 'DateTimeOffset').
public string DateTimeType { get; set; }
Property Value
DateType
Gets or sets the date .NET type (default: 'DateTimeOffset').
public string DateType { get; set; }
Property Value
DictionaryBaseType
Gets or sets the generic dictionary .NET type which is used as base class (default: 'Dictionary').
public string DictionaryBaseType { get; set; }
Property Value
DictionaryInstanceType
Gets or sets the generic dictionary .NET type which is used for DictionaryType instances (default: 'Dictionary').
public string DictionaryInstanceType { get; set; }
Property Value
DictionaryType
Gets or sets the generic dictionary .NET type (default: 'IDictionary').
public string DictionaryType { get; set; }
Property Value
EnforceFlagEnums
Gets or sets a value indicating whether enums should be always generated as bit flags (default: false).
public bool EnforceFlagEnums { get; set; }
Property Value
ExcludedTypeNames
Gets or sets the excluded type names (must be defined in an import or other namespace).
public string[] ExcludedTypeNames { get; set; }
Property Value
- string[]
GenerateDataAnnotations
Gets or sets a value indicating whether to generated data annotation attributes (default: true).
public bool GenerateDataAnnotations { get; set; }
Property Value
GenerateDefaultValues
Gets or sets a value indicating whether to generate default values for properties (when JSON Schema default is set, default: true).
public bool GenerateDefaultValues { get; set; }
Property Value
GenerateImmutableArrayProperties
Gets or sets a value indicating whether to remove the setter for non-nullable array properties (default: false).
public bool GenerateImmutableArrayProperties { get; set; }
Property Value
GenerateImmutableDictionaryProperties
Gets or sets a value indicating whether to remove the setter for non-nullable dictionary properties (default: false).
public bool GenerateImmutableDictionaryProperties { get; set; }
Property Value
GenerateJsonMethods
Gets or sets a value indicating whether to render ToJson() and FromJson() methods (default: false).
public bool GenerateJsonMethods { get; set; }
Property Value
GenerateNativeRecords
Generate C# 9.0 record types instead of record-like classes.
public bool GenerateNativeRecords { get; set; }
Property Value
GenerateNullableReferenceTypes
Gets or sets a value indicating whether to generate Nullable Reference Type annotations (default: false).
public bool GenerateNullableReferenceTypes { get; set; }
Property Value
GenerateOptionalPropertiesAsNullable
Gets or sets a value indicating whether optional schema properties (not required) are generated as nullable properties (default: false).
public bool GenerateOptionalPropertiesAsNullable { get; set; }
Property Value
HandleReferences
Gets or sets a value indicating whether to use preserve references handling (All) in the JSON serializer (default: false).
public bool HandleReferences { get; set; }
Property Value
InlineJsonConverters
Gets or sets a value indicating whether to inline JsonConverter attributes for enum types (default: true).
When set to true (default), the [JsonConverter(typeof(JsonStringEnumConverter))] attribute is placed
on the enum type declaration instead of on individual enum properties, allowing users to override the
converter via JsonSerializerOptions.Converters (e.g. to use JsonStringEnumMemberConverter
for enums whose values contain hyphens or other special characters via [EnumMember]).
When set to false, no [JsonConverter] attribute is emitted at all.
public bool InlineJsonConverters { get; set; }
Property Value
InlineNamedAny
Gets or sets a value indicating whether named/referenced any schemas should be inlined or generated as class.
public bool InlineNamedAny { get; set; }
Property Value
InlineNamedArrays
Gets or sets a value indicating whether named/referenced arrays should be inlined or generated as class with array inheritance.
public bool InlineNamedArrays { get; set; }
Property Value
InlineNamedDictionaries
Gets or sets a value indicating whether named/referenced dictionaries should be inlined or generated as class with dictionary inheritance.
public bool InlineNamedDictionaries { get; set; }
Property Value
InlineNamedTuples
Gets or sets a value indicating whether named/referenced tuples should be inlined or generated as class with tuple inheritance.
public bool InlineNamedTuples { get; set; }
Property Value
IntegerType
Gets or sets the .NET type for OpenAPI integers without a format specifier (default: Int32).
[JsonConverter(typeof(JsonStringEnumConverter))]
public IntegerType IntegerType { get; set; }
Property Value
JsonConverters
Gets or sets the custom Json.NET converters (class names) which are registered for serialization and deserialization.
public string[]? JsonConverters { get; set; }
Property Value
- string[]
JsonSerializerSettingsTransformationMethod
Gets or sets the name of a static method which is called to transform the JsonSerializerSettings (for Newtonsoft.Json) or the JsonSerializerOptions (for System.Text.Json) used in the generated ToJson()/FromJson() methods (default: null).
public string? JsonSerializerSettingsTransformationMethod { get; set; }
Property Value
PropertyNameGenerator
Gets or sets a custom NJsonSchema.CodeGeneration.IPropertyNameGenerator.
[JsonIgnore]
public IPropertyNameGenerator? PropertyNameGenerator { get; set; }
Property Value
- IPropertyNameGenerator
PropertySetterAccessModifier
Gets the access modifier of property setters (default: '').
public string PropertySetterAccessModifier { get; set; }
Property Value
RequiredPropertiesMustBeDefined
Gets or sets a value indicating whether a required property must be defined in JSON (sets Required.Always when the property is required) (default: true).
public bool RequiredPropertiesMustBeDefined { get; set; }
Property Value
TimeSpanType
Gets or sets the time span .NET type (default: 'TimeSpan').
public string TimeSpanType { get; set; }
Property Value
TimeType
Gets or sets the time .NET type (default: 'TimeSpan').
public string TimeType { get; set; }