From 7349edb16069f456484442fda26cc8c2827c8e6f Mon Sep 17 00:00:00 2001 From: Christian Helle Date: Wed, 17 Jun 2026 23:55:26 +0200 Subject: [PATCH 1/8] refactor: inline OpenApiSourceConfig into RefitGeneratorSettings --- .../Settings/OpenApiSourceConfig.cs | 28 ------------------- .../Settings/RefitGeneratorSettings.cs | 13 ++------- 2 files changed, 2 insertions(+), 39 deletions(-) delete mode 100644 src/Refitter.Core/Settings/OpenApiSourceConfig.cs diff --git a/src/Refitter.Core/Settings/OpenApiSourceConfig.cs b/src/Refitter.Core/Settings/OpenApiSourceConfig.cs deleted file mode 100644 index e7047e51a..000000000 --- a/src/Refitter.Core/Settings/OpenApiSourceConfig.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; -using System.Text.Json.Serialization; - -namespace Refitter.Core; - -/// -/// Configuration for the OpenAPI document source paths. -/// -[ExcludeFromCodeCoverage] -public class OpenApiSourceConfig -{ - /// - /// Gets or sets the path to the Open API. - /// - [Description("The path to the OpenAPI document.")] - [JsonPropertyName("openApiPath")] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string? OpenApiPath { get; set; } - - /// - /// Gets or sets the paths to multiple Open API documents. When specified, the documents are merged. - /// This takes precedence over when non-empty. - /// - [Description("The paths to multiple OpenAPI documents. When specified, the documents are merged into a single client.")] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - public string[]? OpenApiPaths { get; set; } -} diff --git a/src/Refitter.Core/Settings/RefitGeneratorSettings.cs b/src/Refitter.Core/Settings/RefitGeneratorSettings.cs index 30cc81e87..95adca451 100644 --- a/src/Refitter.Core/Settings/RefitGeneratorSettings.cs +++ b/src/Refitter.Core/Settings/RefitGeneratorSettings.cs @@ -21,7 +21,6 @@ public class RefitGeneratorSettings /// public const string DefaultNamespace = OutputConfig.DefaultNamespace; - private readonly OpenApiSourceConfig openApiSource = new(); private readonly CodeGenerationConfig codeGeneration = new(); private readonly ParameterConfig parameterConfig = new(); private readonly OutputConfig outputConfig = new(); @@ -36,11 +35,7 @@ public class RefitGeneratorSettings [Description("The path to the OpenAPI document.")] [JsonPropertyName("openApiPath")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string? OpenApiPath - { - get => openApiSource.OpenApiPath; - set => openApiSource.OpenApiPath = value; - } + public string? OpenApiPath { get; set; } /// /// Gets or sets the paths to multiple Open API documents. When specified, the documents are merged. @@ -48,11 +43,7 @@ public string? OpenApiPath /// [Description("The paths to multiple OpenAPI documents. When specified, the documents are merged into a single client.")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - public string[]? OpenApiPaths - { - get => openApiSource.OpenApiPaths; - set => openApiSource.OpenApiPaths = value; - } + public string[]? OpenApiPaths { get; set; } /// /// Gets or sets the namespace for the generated code. (default: GeneratedCode) From b27fd8477198f8538c68dc18973af5428bce160d Mon Sep 17 00:00:00 2001 From: Christian Helle Date: Wed, 17 Jun 2026 23:56:18 +0200 Subject: [PATCH 2/8] refactor: inline ParameterConfig into RefitGeneratorSettings --- src/Refitter.Core/Settings/ParameterConfig.cs | 63 ------------------- .../Settings/RefitGeneratorSettings.cs | 37 ++--------- 2 files changed, 6 insertions(+), 94 deletions(-) delete mode 100644 src/Refitter.Core/Settings/ParameterConfig.cs diff --git a/src/Refitter.Core/Settings/ParameterConfig.cs b/src/Refitter.Core/Settings/ParameterConfig.cs deleted file mode 100644 index f69be631d..000000000 --- a/src/Refitter.Core/Settings/ParameterConfig.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; -using System.Text.Json.Serialization; -using NSwag.CodeGeneration; - -namespace Refitter.Core; - -/// -/// Configuration for method parameter code generation options. -/// -[ExcludeFromCodeCoverage] -public class ParameterConfig -{ - /// - /// Enable or disable the use of cancellation tokens. - /// - [Description("Enable or disable the use of cancellation tokens.")] - public bool UseCancellationTokens { get; set; } - - /// - /// Set to true to explicitly format date query string parameters - /// in ISO 8601 standard date format using delimiters (for example: 2023-06-15) - /// - [Description( - """ - Set to true to explicitly format date query string parameters - in ISO 8601 standard date format using delimiters (for example: 2023-06-15) - """ - )] - public bool UseIsoDateFormat { get; set; } - - /// - /// Set to true to re-order optional parameters to the end of the parameter list - /// - [Description("Re-order optional parameters to the end of the parameter list.")] - public bool OptionalParameters { get; set; } - - /// - /// Set to true to wrap multiple query parameters into a single complex one. Default is false (no wrapping). - /// See https://github.com/reactiveui/refit?tab=readme-ov-file#dynamic-querystring-parameters for more information. - /// - [Description( - """ - Wrap multiple query parameters into a single complex one. - See https://github.com/reactiveui/refit?tab=readme-ov-file#dynamic-querystring-parameters for more information. - """ - )] - public bool UseDynamicQuerystringParameters { get; set; } - - /// - /// Gets or sets the collection format to use for array query parameters. - /// Default is CollectionFormat.Multi. - /// - [Description("The collection format to use for array query parameters. Default is CollectionFormat.Multi.")] - [JsonConverter(typeof(JsonStringEnumConverter))] - public CollectionFormat CollectionFormat { get; set; } = CollectionFormat.Multi; - - /// - /// Gets or sets the parameter name generator for customizing parameter names. - /// - [JsonIgnore] - public IParameterNameGenerator? ParameterNameGenerator { get; set; } -} diff --git a/src/Refitter.Core/Settings/RefitGeneratorSettings.cs b/src/Refitter.Core/Settings/RefitGeneratorSettings.cs index 95adca451..b03f82224 100644 --- a/src/Refitter.Core/Settings/RefitGeneratorSettings.cs +++ b/src/Refitter.Core/Settings/RefitGeneratorSettings.cs @@ -22,7 +22,6 @@ public class RefitGeneratorSettings public const string DefaultNamespace = OutputConfig.DefaultNamespace; private readonly CodeGenerationConfig codeGeneration = new(); - private readonly ParameterConfig parameterConfig = new(); private readonly OutputConfig outputConfig = new(); private readonly TypeConfig typeConfig = new(); private readonly FilterConfig filterConfig = new(); @@ -239,11 +238,7 @@ public TypeAccessibility TypeAccessibility /// Enable or disable the use of cancellation tokens. /// [Description("Enable or disable the use of cancellation tokens.")] - public bool UseCancellationTokens - { - get => parameterConfig.UseCancellationTokens; - set => parameterConfig.UseCancellationTokens = value; - } + public bool UseCancellationTokens { get; set; } /// /// Set to true to explicitly format date query string parameters @@ -255,11 +250,7 @@ Set to true to explicitly format date query string parameters in ISO 8601 standard date format using delimiters (for example: 2023-06-15) """ )] - public bool UseIsoDateFormat - { - get => parameterConfig.UseIsoDateFormat; - set => parameterConfig.UseIsoDateFormat = value; - } + public bool UseIsoDateFormat { get; set; } /// /// Add additional namespace to generated types @@ -344,11 +335,7 @@ public string? OperationNameTemplate /// Set to true to re-order optional parameters to the end of the parameter list /// [Description("Re-order optional parameters to the end of the parameter list.")] - public bool OptionalParameters - { - get => parameterConfig.OptionalParameters; - set => parameterConfig.OptionalParameters = value; - } + public bool OptionalParameters { get; set; } /// /// Gets or sets the relative path to a folder in which the output files are generated. (default: ./Generated) @@ -502,11 +489,7 @@ Wrap multiple query parameters into a single complex one. See https://github.com/reactiveui/refit?tab=readme-ov-file#dynamic-querystring-parameters for more information. """ )] - public bool UseDynamicQuerystringParameters - { - get => parameterConfig.UseDynamicQuerystringParameters; - set => parameterConfig.UseDynamicQuerystringParameters = value; - } + public bool UseDynamicQuerystringParameters { get; set; } /// /// Set to true to generate multiple files. Default is false @@ -559,11 +542,7 @@ public bool UsePolymorphicSerialization /// Gets or sets the parameter name generator for customizing parameter names. /// [JsonIgnore] - public IParameterNameGenerator? ParameterNameGenerator - { - get => parameterConfig.ParameterNameGenerator; - set => parameterConfig.ParameterNameGenerator = value; - } + public IParameterNameGenerator? ParameterNameGenerator { get; set; } /// /// Gets or sets a value indicating whether to generate Security Schema Authentication headers. @@ -582,11 +561,7 @@ public AuthenticationHeaderStyle AuthenticationHeaderStyle /// [Description("The collection format to use for array query parameters. Default is CollectionFormat.Multi.")] [JsonConverter(typeof(JsonStringEnumConverter))] - public CollectionFormat CollectionFormat - { - get => parameterConfig.CollectionFormat; - set => parameterConfig.CollectionFormat = value; - } + public CollectionFormat CollectionFormat { get; set; } = CollectionFormat.Multi; /// /// Gets or sets a directory path which contains liquid templates for NSwag. If null or empty, uses default From 3fed6e23e2f30f5dc816efa57845386170f07f85 Mon Sep 17 00:00:00 2001 From: Christian Helle Date: Wed, 17 Jun 2026 23:56:58 +0200 Subject: [PATCH 3/8] refactor: inline TypeConfig into RefitGeneratorSettings --- .../Settings/RefitGeneratorSettings.cs | 25 ++---------- src/Refitter.Core/Settings/TypeConfig.cs | 38 ------------------- 2 files changed, 4 insertions(+), 59 deletions(-) delete mode 100644 src/Refitter.Core/Settings/TypeConfig.cs diff --git a/src/Refitter.Core/Settings/RefitGeneratorSettings.cs b/src/Refitter.Core/Settings/RefitGeneratorSettings.cs index b03f82224..92d79ae9a 100644 --- a/src/Refitter.Core/Settings/RefitGeneratorSettings.cs +++ b/src/Refitter.Core/Settings/RefitGeneratorSettings.cs @@ -23,7 +23,6 @@ public class RefitGeneratorSettings private readonly CodeGenerationConfig codeGeneration = new(); private readonly OutputConfig outputConfig = new(); - private readonly TypeConfig typeConfig = new(); private readonly FilterConfig filterConfig = new(); private readonly SchemaConfig schemaConfig = new(); private readonly FeatureConfig featureConfig = new(); @@ -75,11 +74,7 @@ public string? ContractsNamespace /// [Description("Controls how generated contract properties are named. Default is PascalCase. Possible values: PascalCase, PreserveOriginal.")] [JsonConverter(typeof(JsonStringEnumConverter))] - public PropertyNamingPolicy PropertyNamingPolicy - { - get => typeConfig.PropertyNamingPolicy; - set => typeConfig.PropertyNamingPolicy = value; - } + public PropertyNamingPolicy PropertyNamingPolicy { get; set; } = PropertyNamingPolicy.PascalCase; /// /// Gets or sets a value indicating whether contracts should be generated. @@ -228,11 +223,7 @@ public string[] IgnoredOperationHeaders /// [Description("The generated type accessibility. Default is Public.")] [JsonConverter(typeof(JsonStringEnumConverter))] - public TypeAccessibility TypeAccessibility - { - get => typeConfig.TypeAccessibility; - set => typeConfig.TypeAccessibility = value; - } + public TypeAccessibility TypeAccessibility { get; set; } = TypeAccessibility.Public; /// /// Enable or disable the use of cancellation tokens. @@ -463,11 +454,7 @@ public bool GenerateDefaultAdditionalProperties /// Set to true to generate contracts as immutable records instead of classes /// [Description("Generate contracts as immutable records instead of classes.")] - public bool ImmutableRecords - { - get => typeConfig.ImmutableRecords; - set => typeConfig.ImmutableRecords = value; - } + public bool ImmutableRecords { get; set; } /// /// Get ot set the settings describing how to configure Apizr @@ -600,9 +587,5 @@ public bool GenerateJsonSerializerContext /// Gets or sets a suffix to append to all generated contract type names. /// [Description("Suffix to append to all generated contract type names. Default is null which doesn't append any suffix.")] - public string? ContractTypeSuffix - { - get => typeConfig.ContractTypeSuffix; - set => typeConfig.ContractTypeSuffix = value; - } + public string? ContractTypeSuffix { get; set; } } diff --git a/src/Refitter.Core/Settings/TypeConfig.cs b/src/Refitter.Core/Settings/TypeConfig.cs deleted file mode 100644 index 61bc15cb8..000000000 --- a/src/Refitter.Core/Settings/TypeConfig.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; -using System.Text.Json.Serialization; - -namespace Refitter.Core; - -/// -/// Configuration for generated type visibility, naming conventions, and immutability. -/// -[ExcludeFromCodeCoverage] -public class TypeConfig -{ - /// - /// Gets or sets the generated type accessibility. (default: Public) - /// - [Description("The generated type accessibility. Default is Public.")] - [JsonConverter(typeof(JsonStringEnumConverter))] - public TypeAccessibility TypeAccessibility { get; set; } = TypeAccessibility.Public; - - /// - /// Gets or sets how generated contract properties are named. - /// - [Description("Controls how generated contract properties are named. Default is PascalCase. Possible values: PascalCase, PreserveOriginal.")] - [JsonConverter(typeof(JsonStringEnumConverter))] - public PropertyNamingPolicy PropertyNamingPolicy { get; set; } = PropertyNamingPolicy.PascalCase; - - /// - /// Gets or sets a suffix to append to all generated contract type names. - /// - [Description("Suffix to append to all generated contract type names. Default is null which doesn't append any suffix.")] - public string? ContractTypeSuffix { get; set; } - - /// - /// Set to true to generate contracts as immutable records instead of classes - /// - [Description("Generate contracts as immutable records instead of classes.")] - public bool ImmutableRecords { get; set; } -} From 3deb820c3fc7083ab0f5e5c125da382b2bb0a3d8 Mon Sep 17 00:00:00 2001 From: Christian Helle Date: Wed, 17 Jun 2026 23:57:35 +0200 Subject: [PATCH 4/8] refactor: inline FilterConfig into RefitGeneratorSettings --- src/Refitter.Core/Settings/FilterConfig.cs | 43 ------------------- .../Settings/RefitGeneratorSettings.cs | 31 +++---------- 2 files changed, 5 insertions(+), 69 deletions(-) delete mode 100644 src/Refitter.Core/Settings/FilterConfig.cs diff --git a/src/Refitter.Core/Settings/FilterConfig.cs b/src/Refitter.Core/Settings/FilterConfig.cs deleted file mode 100644 index a2c7d309d..000000000 --- a/src/Refitter.Core/Settings/FilterConfig.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; - -namespace Refitter.Core; - -/// -/// Configuration for filtering which endpoints and schemas to include in generated code. -/// -[ExcludeFromCodeCoverage] -public class FilterConfig -{ - /// - /// Set to true to only include Endpoints that contain this tag. - /// May be set multiple times and result in OR'ed evaluation. - /// - [Description("Generate a Refit interface for each endpoint.")] - public string[] IncludeTags { get; set; } = []; - - /// - /// Set to true to only include Paths that match the provided regular expression. - /// May be set multiple times - /// - [Description("Only include Paths that match the provided regular expression. May be set multiple times.")] - public string[] IncludePathMatches { get; set; } = []; - - /// - /// Gets or sets a collection of headers to omit from operation signatures. (default: []) - /// - [Description("A collection of headers to omit from operation signatures.")] - public string[] IgnoredOperationHeaders { get; set; } = []; - - /// - /// Exclude namespaces on generated types - /// - [Description("Exclude namespaces on generated types.")] - public string[] ExcludeNamespaces { get; set; } = []; - - /// - /// Add additional namespace to generated types - /// - [Description("Add additional namespace to generated types.")] - public string[] AdditionalNamespaces { get; set; } = []; -} diff --git a/src/Refitter.Core/Settings/RefitGeneratorSettings.cs b/src/Refitter.Core/Settings/RefitGeneratorSettings.cs index 92d79ae9a..ddc2e299b 100644 --- a/src/Refitter.Core/Settings/RefitGeneratorSettings.cs +++ b/src/Refitter.Core/Settings/RefitGeneratorSettings.cs @@ -23,7 +23,6 @@ public class RefitGeneratorSettings private readonly CodeGenerationConfig codeGeneration = new(); private readonly OutputConfig outputConfig = new(); - private readonly FilterConfig filterConfig = new(); private readonly SchemaConfig schemaConfig = new(); private readonly FeatureConfig featureConfig = new(); @@ -212,11 +211,7 @@ public bool GenerateOperationHeaders /// Gets or sets a collection of headers to omit from operation signatures. (default: []) /// [Description("A collection of headers to omit from operation signatures.")] - public string[] IgnoredOperationHeaders - { - get => filterConfig.IgnoredOperationHeaders; - set => filterConfig.IgnoredOperationHeaders = value; - } + public string[] IgnoredOperationHeaders { get; set; } = []; /// /// Gets or sets the generated type accessibility. (default: Public) @@ -247,21 +242,13 @@ Set to true to explicitly format date query string parameters /// Add additional namespace to generated types /// [Description("Add additional namespace to generated types.")] - public string[] AdditionalNamespaces - { - get => filterConfig.AdditionalNamespaces; - set => filterConfig.AdditionalNamespaces = value; - } + public string[] AdditionalNamespaces { get; set; } = []; /// /// Exclude namespaces on generated types /// [Description("Exclude namespaces on generated types.")] - public string[] ExcludeNamespaces - { - get => filterConfig.ExcludeNamespaces; - set => filterConfig.ExcludeNamespaces = value; - } + public string[] ExcludeNamespaces { get; set; } = []; /// /// Set to true to Generate a Refit interface for each endpoint @@ -279,22 +266,14 @@ public MultipleInterfaces MultipleInterfaces /// May be set multiple times /// [Description("Only include Paths that match the provided regular expression. May be set multiple times.")] - public string[] IncludePathMatches - { - get => filterConfig.IncludePathMatches; - set => filterConfig.IncludePathMatches = value; - } + public string[] IncludePathMatches { get; set; } = []; /// /// Set to true to only include Endpoints that contain this tag. /// May be set multiple times and result in OR'ed evaluation. /// [Description("Generate a Refit interface for each endpoint.")] - public string[] IncludeTags - { - get => filterConfig.IncludeTags; - set => filterConfig.IncludeTags = value; - } + public string[] IncludeTags { get; set; } = []; /// /// Gets or sets a value indicating whether to generate deprecated operations, otherwise false From 4cdaa846866d48b8edc805f1df9e3f07d14ed856 Mon Sep 17 00:00:00 2001 From: Christian Helle Date: Wed, 17 Jun 2026 23:58:04 +0200 Subject: [PATCH 5/8] refactor: inline SchemaConfig into RefitGeneratorSettings --- .../Settings/RefitGeneratorSettings.cs | 19 ++----- src/Refitter.Core/Settings/SchemaConfig.cs | 49 ------------------- 2 files changed, 3 insertions(+), 65 deletions(-) delete mode 100644 src/Refitter.Core/Settings/SchemaConfig.cs diff --git a/src/Refitter.Core/Settings/RefitGeneratorSettings.cs b/src/Refitter.Core/Settings/RefitGeneratorSettings.cs index ddc2e299b..e7f7ce0c8 100644 --- a/src/Refitter.Core/Settings/RefitGeneratorSettings.cs +++ b/src/Refitter.Core/Settings/RefitGeneratorSettings.cs @@ -23,7 +23,6 @@ public class RefitGeneratorSettings private readonly CodeGenerationConfig codeGeneration = new(); private readonly OutputConfig outputConfig = new(); - private readonly SchemaConfig schemaConfig = new(); private readonly FeatureConfig featureConfig = new(); /// @@ -368,11 +367,7 @@ Apply tree-shaking to the OpenApi schema. This works in conjunction with includeTags and includePathMatches. """ )] - public bool TrimUnusedSchema - { - get => schemaConfig.TrimUnusedSchema; - set => schemaConfig.TrimUnusedSchema = value; - } + public bool TrimUnusedSchema { get; set; } /// /// Array of regular expressions that determine if a schema needs to be kept. @@ -384,11 +379,7 @@ public bool TrimUnusedSchema This works in conjunction with TrimUnusedSchema. """ )] - public string[] KeepSchemaPatterns - { - get => schemaConfig.KeepSchemaPatterns; - set => schemaConfig.KeepSchemaPatterns = value; - } + public string[] KeepSchemaPatterns { get; set; } = []; /// /// Set to true to keep all possible type-instances of inheritance/union types. @@ -402,11 +393,7 @@ If this is false only directly referenced types will be kept. This works in conjunction with TrimUnusedSchema. """ )] - public bool IncludeInheritanceHierarchy - { - get => schemaConfig.IncludeInheritanceHierarchy; - set => schemaConfig.IncludeInheritanceHierarchy = value; - } + public bool IncludeInheritanceHierarchy { get; set; } /// /// The NSwag IOperationNameGenerator implementation to use diff --git a/src/Refitter.Core/Settings/SchemaConfig.cs b/src/Refitter.Core/Settings/SchemaConfig.cs deleted file mode 100644 index 6f67aba7a..000000000 --- a/src/Refitter.Core/Settings/SchemaConfig.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; - -namespace Refitter.Core; - -/// -/// Configuration for OpenAPI schema tree-shaking and unused schema trimming. -/// -[ExcludeFromCodeCoverage] -public class SchemaConfig -{ - /// - /// Set to true to apply tree-shaking to the OpenApi schema. - /// This works in conjunction with and . - /// - [Description( - """ - Apply tree-shaking to the OpenApi schema. - This works in conjunction with includeTags and includePathMatches. - """ - )] - public bool TrimUnusedSchema { get; set; } - - /// - /// Array of regular expressions that determine if a schema needs to be kept. - /// This works in conjunction with . - /// - [Description( - """ - Array of regular expressions that determine if a schema needs to be kept. - This works in conjunction with TrimUnusedSchema. - """ - )] - public string[] KeepSchemaPatterns { get; set; } = []; - - /// - /// Set to true to keep all possible type-instances of inheritance/union types. - /// If this is false only directly referenced types will be kept. - /// This works in conjunction with . - /// - [Description( - """ - Keep all possible type-instances of inheritance/union types. - If this is false only directly referenced types will be kept. - This works in conjunction with TrimUnusedSchema. - """ - )] - public bool IncludeInheritanceHierarchy { get; set; } -} From c4206c960d890679c219f3632c9bc595a5186c4d Mon Sep 17 00:00:00 2001 From: Christian Helle Date: Wed, 17 Jun 2026 23:58:42 +0200 Subject: [PATCH 6/8] refactor: inline FeatureConfig into RefitGeneratorSettings --- src/Refitter.Core/Settings/FeatureConfig.cs | 59 ------------------- .../Settings/RefitGeneratorSettings.cs | 31 ++-------- 2 files changed, 5 insertions(+), 85 deletions(-) delete mode 100644 src/Refitter.Core/Settings/FeatureConfig.cs diff --git a/src/Refitter.Core/Settings/FeatureConfig.cs b/src/Refitter.Core/Settings/FeatureConfig.cs deleted file mode 100644 index 0a5945f05..000000000 --- a/src/Refitter.Core/Settings/FeatureConfig.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; -using System.Text.Json.Serialization; - -namespace Refitter.Core; - -/// -/// Configuration for optional features including Apizr, polymorphic serialization, -/// authentication headers, and AOT compilation support. -/// -[ExcludeFromCodeCoverage] -public class FeatureConfig -{ - /// - /// Get ot set the settings describing how to configure Apizr - /// - [Description("The settings describing how to configure Apizr.")] - public ApizrSettings? ApizrSettings { get; set; } - - /// - /// Set to true to use System.Text.Json polymorphic serialization. Default is false - /// Gets a value indicating whether to use System.Text.Json polymorphic serialization - /// Replaces NSwag JsonInheritanceConverter attributes with System.Text.Json JsonPolymorphicAttributes. - /// To have the native support of inheritance (de)serialization and fallback to base types when - /// payloads with (yet) unknown types are offered by newer versions of an API - /// See https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/polymorphism for more information - /// - [Description( - """ - Use System.Text.Json polymorphic serialization. Default is false. - Replace NSwag JsonInheritanceConverter attributes with System.Text.Json JsonPolymorphicAttributes. - To have the native support of inheritance (de)serialization and fallback to base types when - payloads with (yet) unknown types are offered by newer versions of an API - See https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/polymorphism for more information - """ - )] - public bool UsePolymorphicSerialization { get; set; } - - /// - /// Gets or sets a value indicating whether to generate JsonSerializerContext for AOT compilation support. - /// The context is emitted into the contracts namespace and only when contracts are generated. - /// - [Description("Generate JsonSerializerContext for AOT compilation support in the contracts namespace when contracts are generated.")] - public bool GenerateJsonSerializerContext { get; set; } - - /// - /// Gets or sets a value indicating whether to generate Security Schema Authentication headers. - /// - [Description("Generate Security Schema Authentication headers")] - [JsonConverter(typeof(JsonStringEnumConverter))] - public AuthenticationHeaderStyle AuthenticationHeaderStyle { get; set; } - - /// - /// Gets or sets the security scheme name for which to generate authentication headers. - /// When specified, only endpoints using this security scheme will have authentication headers generated. - /// - [Description("Security scheme for which to generate authentication headers.")] - public string? SecurityScheme { get; set; } -} diff --git a/src/Refitter.Core/Settings/RefitGeneratorSettings.cs b/src/Refitter.Core/Settings/RefitGeneratorSettings.cs index e7f7ce0c8..2d8976117 100644 --- a/src/Refitter.Core/Settings/RefitGeneratorSettings.cs +++ b/src/Refitter.Core/Settings/RefitGeneratorSettings.cs @@ -23,7 +23,6 @@ public class RefitGeneratorSettings private readonly CodeGenerationConfig codeGeneration = new(); private readonly OutputConfig outputConfig = new(); - private readonly FeatureConfig featureConfig = new(); /// /// Gets or sets the path to the Open API. @@ -426,11 +425,7 @@ public bool GenerateDefaultAdditionalProperties /// Get ot set the settings describing how to configure Apizr /// [Description("The settings describing how to configure Apizr.")] - public ApizrSettings? ApizrSettings - { - get => featureConfig.ApizrSettings; - set => featureConfig.ApizrSettings = value; - } + public ApizrSettings? ApizrSettings { get; set; } /// /// Set to true to wrap multiple query parameters into a single complex one. Default is false (no wrapping). @@ -485,11 +480,7 @@ payloads with (yet) unknown types are offered by newer versions of an API See https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/polymorphism for more information """ )] - public bool UsePolymorphicSerialization - { - get => featureConfig.UsePolymorphicSerialization; - set => featureConfig.UsePolymorphicSerialization = value; - } + public bool UsePolymorphicSerialization { get; set; } /// /// Gets or sets the parameter name generator for customizing parameter names. @@ -502,11 +493,7 @@ public bool UsePolymorphicSerialization /// [Description("Generate Security Schema Authentication headers")] [JsonConverter(typeof(JsonStringEnumConverter))] - public AuthenticationHeaderStyle AuthenticationHeaderStyle - { - get => featureConfig.AuthenticationHeaderStyle; - set => featureConfig.AuthenticationHeaderStyle = value; - } + public AuthenticationHeaderStyle AuthenticationHeaderStyle { get; set; } /// /// Gets or sets the collection format to use for array query parameters. @@ -532,22 +519,14 @@ public string? CustomTemplateDirectory /// When specified, only endpoints using this security scheme will have authentication headers generated. /// [Description("Security scheme for which to generate authentication headers.")] - public string? SecurityScheme - { - get => featureConfig.SecurityScheme; - set => featureConfig.SecurityScheme = value; - } + public string? SecurityScheme { get; set; } /// /// Gets or sets a value indicating whether to generate JsonSerializerContext for AOT compilation support. /// The context is emitted into the contracts namespace and only when contracts are generated. /// [Description("Generate JsonSerializerContext for AOT compilation support in the contracts namespace when contracts are generated.")] - public bool GenerateJsonSerializerContext - { - get => featureConfig.GenerateJsonSerializerContext; - set => featureConfig.GenerateJsonSerializerContext = value; - } + public bool GenerateJsonSerializerContext { get; set; } /// /// Gets or sets a suffix to append to all generated contract type names. From 450f9189e059c8b241afc979ad712b63536c309f Mon Sep 17 00:00:00 2001 From: Christian Helle Date: Wed, 17 Jun 2026 23:59:38 +0200 Subject: [PATCH 7/8] refactor: inline OutputConfig into RefitGeneratorSettings --- src/Refitter.Core/Settings/OutputConfig.cs | 80 ------------------- .../Settings/RefitGeneratorSettings.cs | 41 ++-------- 2 files changed, 8 insertions(+), 113 deletions(-) delete mode 100644 src/Refitter.Core/Settings/OutputConfig.cs diff --git a/src/Refitter.Core/Settings/OutputConfig.cs b/src/Refitter.Core/Settings/OutputConfig.cs deleted file mode 100644 index aae7e4477..000000000 --- a/src/Refitter.Core/Settings/OutputConfig.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; - -namespace Refitter.Core; - -/// -/// Configuration for generated output paths, filenames, and namespaces. -/// -[ExcludeFromCodeCoverage] -public class OutputConfig -{ - /// - /// Default output folder for generated files. - /// - public const string DefaultOutputFolder = "./Generated"; - - /// - /// Default namespace for generated code. - /// - public const string DefaultNamespace = "GeneratedCode"; - - /// - /// Gets or sets the namespace for the generated code. (default: GeneratedCode) - /// - [Description("The namespace for the generated code. Default is GeneratedCode.")] - public string Namespace { get; set; } = DefaultNamespace; - - /// - /// Gets or sets the namespace for the generated contracts. (default: GeneratedCode); - /// - [Description("The namespace for the generated contracts. Default is GeneratedCode.")] - public string? ContractsNamespace { get; set; } - - /// - /// Gets or sets the relative path to a folder in which the output files are generated. (default: ./Generated) - /// - [Description("The relative path to a folder in which the output files are generated. Default is ./Generated.")] - public string OutputFolder { get; set; } = DefaultOutputFolder; - - /// - /// Gets or sets the relative path to a folder where to store the generated contracts. (default: ./Generated) - /// - [Description("The relative path to a folder where to store the generated contracts. Default is ./Generated.")] - public string? ContractsOutputFolder { get; set; } - - /// - /// Gets or sets the filename of the generated code. - /// For the CLI tool, the default is Output.cs - /// For the Source Generator, this is the name of the generated class and the default is [.refitter defined naming OR .refitter filename].g.cs) - /// - [Description( - """ - The filename of the generated code. - For the CLI tool, the default is Output.cs - For the Source Generator, this is the name of the generated class - and the default is [.refitter defined naming OR .refitter filename].g.cs - """ - )] - public string? OutputFilename { get; set; } - - /// - /// Set to true to generate multiple files. Default is false - /// This is automatically set to true when is specified - /// Refit interface(s) are written to a file called RefitInterfaces.cs - /// Contracts are written to a file called Contracts.cs - /// Dependency Injection is written to a file called DependencyInjection.cs - /// When is enabled, an additional serializer context file is emitted. - /// - [Description( - """ - Generate multiple files. Default is false. - This is automatically set to true when ContractsOutputFolder is specified - Refit interface(s) are written to a file called RefitInterfaces.cs - Contracts are written to a file called Contracts.cs - Dependency Injection is written to a file called DependencyInjection.cs - When GenerateJsonSerializerContext is enabled, an additional serializer context file is emitted. - """ - )] - public bool GenerateMultipleFiles { get; set; } -} diff --git a/src/Refitter.Core/Settings/RefitGeneratorSettings.cs b/src/Refitter.Core/Settings/RefitGeneratorSettings.cs index 2d8976117..5369c6a02 100644 --- a/src/Refitter.Core/Settings/RefitGeneratorSettings.cs +++ b/src/Refitter.Core/Settings/RefitGeneratorSettings.cs @@ -14,15 +14,14 @@ public class RefitGeneratorSettings /// /// Default output folder for generated files. /// - public const string DefaultOutputFolder = OutputConfig.DefaultOutputFolder; + public const string DefaultOutputFolder = "./Generated"; /// /// Default namespace for generated code. /// - public const string DefaultNamespace = OutputConfig.DefaultNamespace; + public const string DefaultNamespace = "GeneratedCode"; private readonly CodeGenerationConfig codeGeneration = new(); - private readonly OutputConfig outputConfig = new(); /// /// Gets or sets the path to the Open API. @@ -44,21 +43,13 @@ public class RefitGeneratorSettings /// Gets or sets the namespace for the generated code. (default: GeneratedCode) /// [Description("The namespace for the generated code. Default is GeneratedCode.")] - public string Namespace - { - get => outputConfig.Namespace; - set => outputConfig.Namespace = value; - } + public string Namespace { get; set; } = DefaultNamespace; /// /// Gets or sets the namespace for the generated contracts. (default: GeneratedCode); /// [Description("The namespace for the generated contracts. Default is GeneratedCode.")] - public string? ContractsNamespace - { - get => outputConfig.ContractsNamespace; - set => outputConfig.ContractsNamespace = value; - } + public string? ContractsNamespace { get; set; } /// /// Gets or sets the naming settings. @@ -309,21 +300,13 @@ public string? OperationNameTemplate /// Gets or sets the relative path to a folder in which the output files are generated. (default: ./Generated) /// [Description("The relative path to a folder in which the output files are generated. Default is ./Generated.")] - public string OutputFolder - { - get => outputConfig.OutputFolder; - set => outputConfig.OutputFolder = value; - } + public string OutputFolder { get; set; } = DefaultOutputFolder; /// /// Gets or sets the relative path to a folder where to store the generated contracts. (default: ./Generated) /// [Description("The relative path to a folder where to store the generated contracts. Default is ./Generated.")] - public string? ContractsOutputFolder - { - get => outputConfig.ContractsOutputFolder; - set => outputConfig.ContractsOutputFolder = value; - } + public string? ContractsOutputFolder { get; set; } /// /// Gets or sets the filename of the generated code. @@ -338,11 +321,7 @@ The filename of the generated code. and the default is [.refitter defined naming OR .refitter filename].g.cs) """ )] - public string? OutputFilename - { - get => outputConfig.OutputFilename; - set => outputConfig.OutputFilename = value; - } + public string? OutputFilename { get; set; } /// /// Gets or sets the settings describing how to register generated interface to the .NET Core DI container @@ -457,11 +436,7 @@ Dependency Injection is written to a file called DependencyInjection.cs When GenerateJsonSerializerContext is enabled, an additional serializer context file is emitted. """ )] - public bool GenerateMultipleFiles - { - get => outputConfig.GenerateMultipleFiles; - set => outputConfig.GenerateMultipleFiles = value; - } + public bool GenerateMultipleFiles { get; set; } /// /// Set to true to use System.Text.Json polymorphic serialization. Default is false From 03e9b3710c7d02d5cc8c788f3815371d34e98650 Mon Sep 17 00:00:00 2001 From: Christian Helle Date: Thu, 18 Jun 2026 00:02:06 +0200 Subject: [PATCH 8/8] refactor: inline CodeGenerationConfig into RefitGeneratorSettings --- .../Settings/CodeGenerationConfig.cs | 141 ------------------ .../Settings/RefitGeneratorSettings.cs | 112 +++----------- 2 files changed, 19 insertions(+), 234 deletions(-) delete mode 100644 src/Refitter.Core/Settings/CodeGenerationConfig.cs diff --git a/src/Refitter.Core/Settings/CodeGenerationConfig.cs b/src/Refitter.Core/Settings/CodeGenerationConfig.cs deleted file mode 100644 index fe1f95bf6..000000000 --- a/src/Refitter.Core/Settings/CodeGenerationConfig.cs +++ /dev/null @@ -1,141 +0,0 @@ -using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; -using System.Text.Json.Serialization; - -namespace Refitter.Core; - -/// -/// Configuration for what code generation features are enabled. -/// -[ExcludeFromCodeCoverage] -public class CodeGenerationConfig -{ - /// - /// Gets or sets a value indicating whether contracts should be generated. - /// - [Description("Generate contracts. Default is true.")] - public bool GenerateContracts { get; set; } = true; - - /// - /// Gets or sets a value indicating whether clients should be generated. - /// - [Description("Generate clients. Default is true.")] - public bool GenerateClients { get; set; } = true; - - /// - /// Gets or sets a value indicating whether clients should implement IDisposable. - /// - [Description("Generate clients that implement IDisposable.")] - public bool GenerateDisposableClients { get; set; } - - /// - /// Gets or sets a value indicating whether XML doc comments should be generated. - /// - [Description("Generate XML doc comments. Default is true.")] - public bool GenerateXmlDocCodeComments { get; set; } = true; - - /// - /// Gets or sets a value indicating whether ApiException and IApiResponse should be documented with - /// the relevant status codes specified in the OpenAPI document. - /// - [Description( - """ - Indicating whether ApiException and IApiResponse should be documented with - the relevant status codes specified in the OpenAPI document. - """ - )] - public bool GenerateStatusCodeComments { get; set; } = true; - - /// - /// Gets or sets a value indicating whether to add auto-generated header. - /// - [Description("Add auto-generated header. Default is true.")] - public bool AddAutoGeneratedHeader { get; set; } = true; - - /// - /// Gets or sets a value indicating whether to add accept headers [Headers("Accept: application/json")]. - /// - [Description("Add accept headers [Headers(\"Accept: application/json\")]. Default is true.")] - public bool AddAcceptHeaders { get; set; } = true; - - /// - /// Gets or sets a value indicating whether to add content-type headers [Headers("Content-Type: application/json")]. - /// - [Description("Add content-type headers [Headers(\"Content-Type: application/json\")]. Default is true.")] - public bool AddContentTypeHeaders { get; set; } = true; - - /// - /// Gets or sets a value indicating whether to return IApiResponse objects. - /// - [Description("Return IApiResponse objects.")] - public bool ReturnIApiResponse { get; set; } - - /// - /// Gets or sets a value indicating whether to return IObservable or Task - /// - [Description("Return IObservable or Task.")] - public bool ReturnIObservable { get; set; } - - /// - /// Gets or sets a dictionary of operation ids and a specific response type that they should use. The type is - /// wrapped in a task, but otherwise unmodified (so make sure that the namespaces are imported or specified). - /// - [Description( - """ - A dictionary of operation ids and a specific response type that they should use. - The type is wrapped in a task, but otherwise unmodified (so make sure that the namespaces are imported or specified). - """ - )] - public Dictionary ResponseTypeOverride { get; set; } = new(); - - /// - /// Gets or sets a value indicating whether to generate operation headers. - /// - [Description("Generate operation headers. Default is true.")] - public bool GenerateOperationHeaders { get; set; } = true; - - /// - /// Gets or sets a value indicating whether to generate deprecated operations, otherwise false - /// - [Description("Generate deprecated operations. Default is true.")] - public bool GenerateDeprecatedOperations { get; set; } = true; - - /// - /// Set to true to Generate a Refit interface for each endpoint - /// - [Description("Generate a Refit interface for each endpoint.")] - [JsonConverter(typeof(JsonStringEnumConverter))] - public MultipleInterfaces MultipleInterfaces { get; set; } - - /// - /// Generate operation names using pattern. - /// When using , this is name of the Execute() method in the interface. - /// - [Description( - """ - Generate operation names using pattern. When using --multiple-interfaces ByEndpoint, - this is name of the Execute() method in the interface. - """ - )] - public string? OperationNameTemplate { get; set; } - - /// - /// The NSwag IOperationNameGenerator implementation to use - /// - [Description("The NSwag IOperationNameGenerator implementation to use.")] - [JsonConverter(typeof(JsonStringEnumConverter))] - public OperationNameGeneratorTypes OperationNameGenerator { get; set; } - - /// - /// Set to false to skip default additional properties. Default is true - /// - [Description("Skip default additional properties. Default is true.")] - public bool GenerateDefaultAdditionalProperties { get; set; } = true; - - /// - /// Gets or sets a directory path which contains liquid templates for NSwag. If null or empty, uses default - /// templates. - /// - [Description("Custom directory with NSwag fluid templates for code generation. Default is null which uses the default NSwag templates. See https://github.com/RicoSuter/NSwag/wiki/Templates")] - public string? CustomTemplateDirectory { get; set; } -} diff --git a/src/Refitter.Core/Settings/RefitGeneratorSettings.cs b/src/Refitter.Core/Settings/RefitGeneratorSettings.cs index 5369c6a02..98679aefc 100644 --- a/src/Refitter.Core/Settings/RefitGeneratorSettings.cs +++ b/src/Refitter.Core/Settings/RefitGeneratorSettings.cs @@ -21,8 +21,6 @@ public class RefitGeneratorSettings /// public const string DefaultNamespace = "GeneratedCode"; - private readonly CodeGenerationConfig codeGeneration = new(); - /// /// Gets or sets the path to the Open API. /// @@ -68,41 +66,25 @@ public class RefitGeneratorSettings /// Gets or sets a value indicating whether contracts should be generated. /// [Description("Generate contracts. Default is true.")] - public bool GenerateContracts - { - get => codeGeneration.GenerateContracts; - set => codeGeneration.GenerateContracts = value; - } + public bool GenerateContracts { get; set; } = true; /// /// Gets or sets a value indicating whether clients should be generated. /// [Description("Generate clients. Default is true.")] - public bool GenerateClients - { - get => codeGeneration.GenerateClients; - set => codeGeneration.GenerateClients = value; - } + public bool GenerateClients { get; set; } = true; /// /// Gets or sets a value indicating whether clients should implement IDisposable. /// [Description("Generate clients that implement IDisposable.")] - public bool GenerateDisposableClients - { - get => codeGeneration.GenerateDisposableClients; - set => codeGeneration.GenerateDisposableClients = value; - } + public bool GenerateDisposableClients { get; set; } /// /// Gets or sets a value indicating whether XML doc comments should be generated. /// [Description("Generate XML doc comments. Default is true.")] - public bool GenerateXmlDocCodeComments - { - get => codeGeneration.GenerateXmlDocCodeComments; - set => codeGeneration.GenerateXmlDocCodeComments = value; - } + public bool GenerateXmlDocCodeComments { get; set; } = true; /// /// Gets or sets a value indicating whether ApiException and IApiResponse should be documented with @@ -114,61 +96,37 @@ Indicating whether ApiException and IApiResponse should be documen the relevant status codes specified in the OpenAPI document. """ )] - public bool GenerateStatusCodeComments - { - get => codeGeneration.GenerateStatusCodeComments; - set => codeGeneration.GenerateStatusCodeComments = value; - } + public bool GenerateStatusCodeComments { get; set; } = true; /// /// Gets or sets a value indicating whether to add auto-generated header. /// [Description("Add auto-generated header. Default is true.")] - public bool AddAutoGeneratedHeader - { - get => codeGeneration.AddAutoGeneratedHeader; - set => codeGeneration.AddAutoGeneratedHeader = value; - } + public bool AddAutoGeneratedHeader { get; set; } = true; /// /// Gets or sets a value indicating whether to add accept headers [Headers("Accept: application/json")]. /// [Description("Add accept headers [Headers(\"Accept: application/json\")]. Default is true.")] - public bool AddAcceptHeaders - { - get => codeGeneration.AddAcceptHeaders; - set => codeGeneration.AddAcceptHeaders = value; - } + public bool AddAcceptHeaders { get; set; } = true; /// /// Gets or sets a value indicating whether to add content-type headers [Headers("Content-Type: application/json")]. /// [Description("Add content-type headers [Headers(\"Content-Type: application/json\")]. Default is true.")] - public bool AddContentTypeHeaders - { - get => codeGeneration.AddContentTypeHeaders; - set => codeGeneration.AddContentTypeHeaders = value; - } + public bool AddContentTypeHeaders { get; set; } = true; /// /// Gets or sets a value indicating whether to return IApiResponse objects. /// [Description("Return IApiResponse objects.")] - public bool ReturnIApiResponse - { - get => codeGeneration.ReturnIApiResponse; - set => codeGeneration.ReturnIApiResponse = value; - } + public bool ReturnIApiResponse { get; set; } /// /// Gets or sets a value indicating whether to return IObservable or Task /// [Description("Return IObservable or Task.")] - public bool ReturnIObservable - { - get => codeGeneration.ReturnIObservable; - set => codeGeneration.ReturnIObservable = value; - } + public bool ReturnIObservable { get; set; } /// /// Gets or sets a dictionary of operation ids and a specific response type that they should use. The type is @@ -176,25 +134,17 @@ public bool ReturnIObservable /// [Description( """ - AddAcceptHeaders dictionary of operation ids and a specific response type that they should use. + A dictionary of operation ids and a specific response type that they should use. The type is wrapped in a task, but otherwise unmodified (so make sure that the namespaces are imported or specified). """ )] - public Dictionary ResponseTypeOverride - { - get => codeGeneration.ResponseTypeOverride; - set => codeGeneration.ResponseTypeOverride = value; - } + public Dictionary ResponseTypeOverride { get; set; } = new(); /// /// Gets or sets a value indicating whether to generate operation headers. /// [Description("Generate operation headers. Default is true.")] - public bool GenerateOperationHeaders - { - get => codeGeneration.GenerateOperationHeaders; - set => codeGeneration.GenerateOperationHeaders = value; - } + public bool GenerateOperationHeaders { get; set; } = true; /// /// Gets or sets a collection of headers to omit from operation signatures. (default: []) @@ -244,11 +194,7 @@ Set to true to explicitly format date query string parameters /// [Description("Generate a Refit interface for each endpoint.")] [JsonConverter(typeof(JsonStringEnumConverter))] - public MultipleInterfaces MultipleInterfaces - { - get => codeGeneration.MultipleInterfaces; - set => codeGeneration.MultipleInterfaces = value; - } + public MultipleInterfaces MultipleInterfaces { get; set; } /// /// Set to true to only include Paths that match the provided regular expression. @@ -268,11 +214,7 @@ public MultipleInterfaces MultipleInterfaces /// Gets or sets a value indicating whether to generate deprecated operations, otherwise false /// [Description("Generate deprecated operations. Default is true.")] - public bool GenerateDeprecatedOperations - { - get => codeGeneration.GenerateDeprecatedOperations; - set => codeGeneration.GenerateDeprecatedOperations = value; - } + public bool GenerateDeprecatedOperations { get; set; } = true; /// /// Generate operation names using pattern. @@ -284,11 +226,7 @@ public bool GenerateDeprecatedOperations this is name of the Execute() method in the interface. """ )] - public string? OperationNameTemplate - { - get => codeGeneration.OperationNameTemplate; - set => codeGeneration.OperationNameTemplate = value; - } + public string? OperationNameTemplate { get; set; } /// /// Set to true to re-order optional parameters to the end of the parameter list @@ -378,21 +316,13 @@ This works in conjunction with TrimUnusedSchema. /// [Description("The NSwag IOperationNameGenerator implementation to use.")] [JsonConverter(typeof(JsonStringEnumConverter))] - public OperationNameGeneratorTypes OperationNameGenerator - { - get => codeGeneration.OperationNameGenerator; - set => codeGeneration.OperationNameGenerator = value; - } + public OperationNameGeneratorTypes OperationNameGenerator { get; set; } /// /// Set to false to skip default additional properties. Default is true /// [Description("Skip default additional properties. Default is true.")] - public bool GenerateDefaultAdditionalProperties - { - get => codeGeneration.GenerateDefaultAdditionalProperties; - set => codeGeneration.GenerateDefaultAdditionalProperties = value; - } + public bool GenerateDefaultAdditionalProperties { get; set; } = true; /// /// Set to true to generate contracts as immutable records instead of classes @@ -483,11 +413,7 @@ payloads with (yet) unknown types are offered by newer versions of an API /// templates. /// [Description("Custom directory with NSwag fluid templates for code generation. Default is null which uses the default NSwag templates. See https://github.com/RicoSuter/NSwag/wiki/Templates")] - public string? CustomTemplateDirectory - { - get => codeGeneration.CustomTemplateDirectory; - set => codeGeneration.CustomTemplateDirectory = value; - } + public string? CustomTemplateDirectory { get; set; } /// /// Gets or sets the security scheme name for which to generate authentication headers.