Table of Contents

Class RefitGeneratorSettings

Namespace
Refitter.Core
Assembly
Refitter.Core.dll

Provide settings for Refit generator.

public class RefitGeneratorSettings
Inheritance
RefitGeneratorSettings
Inherited Members

Fields

DefaultNamespace

public const string DefaultNamespace = "GeneratedCode"

Field Value

string

DefaultOutputFolder

public const string DefaultOutputFolder = "./Generated"

Field Value

string

Properties

AddAcceptHeaders

Gets or sets a value indicating whether to add accept headers [Headers("Accept: application/json")].

public bool AddAcceptHeaders { get; set; }

Property Value

bool

AddAutoGeneratedHeader

Gets or sets a value indicating whether to add auto-generated header.

public bool AddAutoGeneratedHeader { get; set; }

Property Value

bool

AdditionalNamespaces

Add additional namespace to generated types

public string[] AdditionalNamespaces { get; set; }

Property Value

string[]

ApizrSettings

Get ot set the settings describing how to configure Apizr

public ApizrSettings? ApizrSettings { get; set; }

Property Value

ApizrSettings

CodeGeneratorSettings

Gets or sets the settings describing how to generate types using NSwag

public CodeGeneratorSettings? CodeGeneratorSettings { get; set; }

Property Value

CodeGeneratorSettings

ContractsNamespace

public string? ContractsNamespace { get; set; }

Property Value

string

ContractsOutputFolder

Gets or sets the relative path to a folder where to store the generated contracts. (default: ./Generated)

public string? ContractsOutputFolder { get; set; }

Property Value

string

DependencyInjectionSettings

Gets or sets the settings describing how to register generated interface to the .NET Core DI container

public DependencyInjectionSettings? DependencyInjectionSettings { get; set; }

Property Value

DependencyInjectionSettings

ExcludeNamespaces

Exclude namespaces on generated types

public string[] ExcludeNamespaces { get; set; }

Property Value

string[]

GenerateClients

Gets or sets a value indicating whether clients should be generated.

public bool GenerateClients { get; set; }

Property Value

bool

GenerateContracts

Gets or sets a value indicating whether contracts should be generated.

public bool GenerateContracts { get; set; }

Property Value

bool

GenerateDefaultAdditionalProperties

Set to false to skip default additional properties. Default is true

public bool GenerateDefaultAdditionalProperties { get; set; }

Property Value

bool

GenerateDeprecatedOperations

Set to true to generate deprecated operations, otherwise false

public bool GenerateDeprecatedOperations { get; set; }

Property Value

bool

GenerateMultipleFiles

Set to true to 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

public bool GenerateMultipleFiles { get; set; }

Property Value

bool

GenerateOperationHeaders

Gets or sets a value indicating whether to generate operation headers.

public bool GenerateOperationHeaders { get; set; }

Property Value

bool

GenerateStatusCodeComments

Gets or sets a value indicating whether ApiException and IApiResponse should be documented with the relevant status codes specified in the OpenAPI document.

public bool GenerateStatusCodeComments { get; set; }

Property Value

bool

GenerateXmlDocCodeComments

Gets or sets a value indicating whether XML doc comments should be generated.

public bool GenerateXmlDocCodeComments { get; set; }

Property Value

bool

ImmutableRecords

Set to true to generate contracts as immutable records instead of classes

public bool ImmutableRecords { get; set; }

Property Value

bool

IncludePathMatches

Set to true to Generate a Refit interface for each endpoint

public string[] IncludePathMatches { get; set; }

Property Value

string[]

IncludeTags

Set to true to Generate a Refit interface for each endpoint

public string[] IncludeTags { get; set; }

Property Value

string[]

KeepSchemaPatterns

Array of regular expressions that determine if a schema needs to be kept. This works in conjunction with TrimUnusedSchema.

public string[] KeepSchemaPatterns { get; set; }

Property Value

string[]

MultipleInterfaces

Set to true to Generate a Refit interface for each endpoint

[JsonConverter(typeof(JsonStringEnumConverter))]
public MultipleInterfaces MultipleInterfaces { get; set; }

Property Value

MultipleInterfaces

Namespace

Gets or sets the namespace for the generated code. (default: GeneratedCode)

public string Namespace { get; set; }

Property Value

string

Naming

Gets or sets the naming settings.

public NamingSettings Naming { get; set; }

Property Value

NamingSettings

OpenApiPath

Gets or sets the path to the Open API.

public string OpenApiPath { get; set; }

Property Value

string

OperationNameGenerator

The NSwag IOperationNameGenerator implementation to use

[JsonConverter(typeof(JsonStringEnumConverter))]
public OperationNameGeneratorTypes OperationNameGenerator { get; set; }

Property Value

OperationNameGeneratorTypes

OperationNameTemplate

Generate operation names using pattern. When using MultipleInterfacesByEndpoint, this is name of the Execute() method in the interface.

public string? OperationNameTemplate { get; set; }

Property Value

string

OptionalParameters

Set to true to re-order optional parameters to the end of the parameter list

public bool OptionalParameters { get; set; }

Property Value

bool

OutputFilename

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)

public string? OutputFilename { get; set; }

Property Value

string

OutputFolder

Gets or sets the relative path to a folder in which the output files are generated. (default: ./Generated)

public string OutputFolder { get; set; }

Property Value

string

ParameterNameGenerator

[JsonIgnore]
public IParameterNameGenerator? ParameterNameGenerator { get; set; }

Property Value

IParameterNameGenerator

ResponseTypeOverride

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).

public Dictionary<string, string> ResponseTypeOverride { get; set; }

Property Value

Dictionary<string, string>

ReturnIApiResponse

Gets or sets a value indicating whether to return IApiResponse objects.

public bool ReturnIApiResponse { get; set; }

Property Value

bool

ReturnIObservable

Gets or sets a value indicating whether to return IObservable or Task

public bool ReturnIObservable { get; set; }

Property Value

bool

TrimUnusedSchema

Set to true to apply tree-shaking to the OpenApi schema. This works in conjunction with IncludeTags and IncludePathMatches.

public bool TrimUnusedSchema { get; set; }

Property Value

bool

TypeAccessibility

Gets or sets the generated type accessibility. (default: Public)

[JsonConverter(typeof(JsonStringEnumConverter))]
public TypeAccessibility TypeAccessibility { get; set; }

Property Value

TypeAccessibility

UseCancellationTokens

Enable or disable the use of cancellation tokens.

public bool UseCancellationTokens { get; set; }

Property Value

bool

UseDynamicQuerystringParameters

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.

public bool UseDynamicQuerystringParameters { get; set; }

Property Value

bool

UseIsoDateFormat

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; }

Property Value

bool

UsePolymorphicSerialization

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

public bool UsePolymorphicSerialization { get; set; }

Property Value

bool