.Refitter File format
The .refitter file is a JSON serialized version of the RefitGeneratorSettings
The following is an example .refitter file
{
"openApiPath": "/path/to/your/openAPI", // Required if openApiPaths is not specified
"namespace": "Org.System.Service.Api.GeneratedCode", // Optional. Default=GeneratedCode
"contractsNamespace": "Org.System.Service.Api.GeneratedCode.Contracts", // Optional. Default=GeneratedCode
"propertyNamingPolicy": "PascalCase", // Optional. Values=PascalCase|PreserveOriginal. Default=PascalCase
"naming": {
"useOpenApiTitle": false, // Optional. Default=true
"interfaceName": "MyApiClient" // Optional. Default=ApiClient
},
"generateContracts": true, // Optional. Default=true
"generateClients": true, // Optional. Default=true
"generateXmlDocCodeComments": true, // Optional. Default=true
"generateStatusCodeComments": true, // Optional. Default=true
"addAutoGeneratedHeader": true, // Optional. Default=true
"addAcceptHeaders": true, // Optional. Default=true
"addContentTypeHeaders": true, // Optional. Default=true
"returnIApiResponse": false, // Optional. Default=false
"returnIAsyncEnumerable": true, // Optional. Default=true. Generate IAsyncEnumerable for streaming responses
"responseTypeOverride": { // Optional. Default={}
"File_Upload": "IApiResponse",
"File_Download": "System.Net.Http.HttpContent"
},
"generateOperationHeaders": true, // Optional. Default=true
"ignoredOperationHeaders": ["apiKey"], // Optional. Default=[]
"typeAccessibility": "Public", // Optional. Values=Public|Internal. Default=Public
"useCancellationTokens": false, // Optional. Default=false
"useIsoDateFormat": false, // Optional. Default=false
"multipleInterfaces": "ByEndpoint", // Optional. May be one of "ByEndpoint" or "ByTag"
"generateDeprecatedOperations": false, // Optional. Default=true
"operationNameTemplate": "{operationName}Async", // Optional. Must contain {operationName}. When multipleInterfaces == "ByEndpoint", this is name of the Execute() method in the interface where all instances of the string '{operationName}' is replaced with 'Execute'
"optionalParameters": false, // Optional. Default=false
"outputFolder": "../CustomOutput", // Optional. Default=./Generated
"outputFilename": "RefitInterface.cs", // Optional. Default=Output.cs for CLI tool
"contractsOutputFolder": "../Contracts", // Optional. Default=NULL
"generateMultipleFiles": false, // Optional. Automatically set to true if contractsOutputFolder is specified. Default=false
"additionalNamespaces": [ // Optional
"Namespace1",
"Namespace2"
],
"excludeNamespaces": [ // Optional. Exclude namespaces that match the provided regular expressions
"^Namespace[.].*",
"^Namespace$"
],
"includeTags": [ // Optional. OpenAPI Tag to include when generating code
"Pet",
"Store",
"User"
],
"includePathMatches": [ // Optional. Only include Paths that match the provided regular expression
"^/pet/.*",
"^/store/.*"
],
"trimUnusedSchema": false, // Optional. Default=false
"keepSchemaPatterns": [ // Optional. Force to keep matching schema, uses regular expressions. Use together with trimUnusedSchema=true
"^Model$",
"^Person.+"
],
"generateDefaultAdditionalProperties": true, // Optional. default=true
"forceAdditionalProperties": false, // Optional. default=false
"allowRemoteReferences": false, // Optional. Default=false. When true, remote http/https $ref references inside the document are resolved
"silent": false, // Optional. Default=false. Suppress all console output when running the CLI tool. Errors are still reported through the exit code
"operationNameGenerator": "Default", // Optional. May be one of Default, MultipleClientsFromOperationId, MultipleClientsFromPathSegments, MultipleClientsFromFirstTagAndOperationId, MultipleClientsFromFirstTagAndOperationName, MultipleClientsFromFirstTagAndPathSegments, SingleClientFromOperationId, SingleClientFromPathSegments
"immutableRecords": false,
"useDynamicQuerystringParameters": false, // Optional. Default=false
"useMultipartFormObject": false, // Optional. Default=false
"usePolymorphicSerialization": true, // Optional. Default=false
"generateDisposableClients": true, // Optional. Default=false
"collectionFormat": "Multi", // Optional. Determines the format of collection parameters. Values=Multi|Csv|Ssv|Tsv|Pipes. Default=Multi. Array query parameters that declare an OpenAPI 3 style of form, pipeDelimited or spaceDelimited, or an explicit explode, use the matching format instead; other styles use this setting
"dependencyInjectionSettings": { // Optional
"baseUrl": "https://petstore3.swagger.io/api/v3", // Optional. Leave this blank to set the base address manually
"httpMessageHandlers": [ // Optional
"AuthorizationMessageHandler",
"TelemetryMessageHandler"
],
"usePolly": true, // DEPRECATED - Use "transientErrorHandler": "None|Polly|HttpResilience" instead
"useWindowsAuthentication": true, // Optional. Default=false
"transientErrorHandler": "HttpResilience", // Optional. Set this to configure transient error handling with a retry policy that uses a jittered backoff. May be one of None, Polly, HttpResilience
"maxRetryCount": 3, // Optional. Default=6
"firstBackoffRetryInSeconds": 0.5, // Optional. Default=1.0
"useGeneratedRefitClient": true // Optional. Use the source-generated AddRefitGeneratedClient instead of AddRefitClient. Requires Refit 12.1.0+ (14.0.0+ if the interfaces have query parameters). With Refit 17+, use this or reference Refit.HttpClientFactory.Reflection (the source generator enables it automatically for Refit 17+ without that package). Default=false
},
"apizrSettings": { // Optional
"withRequestOptions": true, // Optional. Default=true
"withRegistrationHelper": false, // Optional. Default=false
"withCacheProvider": "None", // Optional. Values=None|Akavache|MonkeyCache|InMemory|DistributedAsString|DistributedAsByteArray. Default=None
"withPriority": false, // Optional. Default=false
"withMediation": false, // Optional. Default=false
"withOptionalMediation": false, // Optional. Default=false
"withMappingProvider": "None", // Optional. Values=None|AutoMapper|Mapster. Default=None
"withFileTransfer": false // Optional. Default=false
},
"codeGeneratorSettings": { // Optional. Default settings are the values set in this example
"requiredPropertiesMustBeDefined": true,
"generateDataAnnotations": true,
"anyType": "object",
"dateType": "System.DateTimeOffset",
"dateTimeType": "System.DateTimeOffset",
"timeType": "System.TimeSpan",
"timeSpanType": "System.TimeSpan",
"arrayType": "System.Collections.Generic.ICollection",
"dictionaryType": "System.Collections.Generic.IDictionary",
"arrayInstanceType": "System.Collections.ObjectModel.Collection",
"dictionaryInstanceType": "System.Collections.Generic.Dictionary",
"arrayBaseType": "System.Collections.ObjectModel.Collection",
"dictionaryBaseType": "System.Collections.Generic.Dictionary",
"integerType": "Int32", // Optional. Default="Int32". The .NET type for OpenAPI integers without a format. Possible values: "Int32", "Int64"
"propertySetterAccessModifier": "",
"generateImmutableArrayProperties": false,
"generateImmutableDictionaryProperties": false,
"handleReferences": false,
"jsonSerializerSettingsTransformationMethod": null,
"generateJsonMethods": false,
"enforceFlagEnums": false,
"inlineNamedDictionaries": false,
"inlineNamedTuples": true,
"inlineNamedArrays": false,
"generateOptionalPropertiesAsNullable": false,
"generateNullableReferenceTypes": false,
"generateNativeRecords": false,
"generateDefaultValues": true,
"inlineNamedAny": false,
"inlineJsonConverters": true, // Optional. Default=true. Set to false to not generate JsonConverter attributes for enum properties
"dateFormat": "string",
"dateTimeFormat": "string",
"excludedTypeNames": [
"ExcludedTypeFoo",
"ExcludedTypeBar"
],
"customTemplateDirectory": "./path/to/directory/" //Optional. See <https://github.com/RicoSuter/NSwag/wiki/Templates>
"jsonLibraryVersion": 8.0 // Optional. Default=8.0. JSON library version for System.Text.Json. When set to 9.0 or higher, enables .NET 9+ JsonStringEnumMemberName support for custom enum value names
}
}
The following example shows how to generate a single client from multiple OpenAPI specifications:
{
"openApiPaths": [
"/path/to/your/openAPI-v1",
"/path/to/your/openAPI-v2"
],
"namespace": "Org.System.Service.Api.GeneratedCode"
}
When using openApiPaths, the documents are merged into a single generated client, where the first document wins on schema conflicts.
Descriptions
openApiPath- points to the OpenAPI Specifications file. This can be the path to a file stored on disk, relative to the.refitterfile. This can also be a URL to a remote file that will be downloaded over HTTP/HTTPS. Required ifopenApiPathsis not specifiedopenApiPaths- a collection of paths to multiple OpenAPI Specifications files. When specified, the documents are merged into a single generated client. The first document wins on schema conflicts. Required ifopenApiPathis not specifiednamespace- the namespace used in the generated code. If not specified, this defaults toGeneratedCodecontractsNamespace- the namespace used in the generated contracts. If not specified, this defaults to whatnamespaceis set topropertyNamingPolicy- controls how generated contract properties are named. Possible values arePascalCase(default) andPreserveOriginal.PreserveOriginalkeeps valid identifiers as-is, escapes reserved C# keywords with@, and minimally sanitizes invalid names into compilable identifiers while still emitting[JsonPropertyName]naming.useOpenApiTitle- a boolean indicating whether the OpenApi title should be used. Default istruenaming.interfaceName- the name of the generated interface. The generated code will automatically prefix this withIso if this set toMyApiClientthen the generated interface is calledIMyApiClient. Default isApiClientgenerateContracts- a boolean indicating whether contracts should be generated. A use case for this is several API clients use the same contracts. Default istruegenerateClients- a boolean indicating whether Refit interface(s) should be generated. Default istruegenerateXmlDocCodeComments- a boolean indicating whether XML doc comments should be generated. Default istruegenerateStatusCodeComments- a boolean indicating whether status code comments should be generated in the XML docs. Default istrueaddAutoGeneratedHeader- a boolean indicating whether XML doc comments should be generated. Default istrueaddAcceptHeaders- a boolean indicating whether to add accept headers [Headers("Accept: application/json")]. Default istrueaddContentTypeHeaders- a boolean indicating whether to add content-type headers. Default istruereturnIApiResponse- a boolean indicating whether to returnIApiResponse<T>objects. Default isfalsereturnIAsyncEnumerable- a boolean indicating whether streaming responses generateIAsyncEnumerable<T>. Default istrue. Set tofalseto skipIAsyncEnumerable<T>and use the normal configured return type insteadresponseTypeOverride- a dictionary with operation ids (as specified in the OpenAPI document) and a particular return type to use. The types are wrapped in a task, but otherwise unmodified (so make sure to specify or import their namespaces). Default is{}generateOperationHeaders- a boolean indicating whether to use operation headers in the generated methods. Default istrueignoredOperationHeaders- A collection of headers to omit from operation signatures. Default is[]typeAccessibility- the generated type accessibility. Possible values arePublicandInternal. Default isPublicuseCancellationTokens- Use cancellation tokens in the generated methods. Default isfalseuseIsoDateFormat- Set totrueto explicitly format date query string parameters in ISO 8601 standard date format using delimiters (for example: 2023-06-15). Default isfalsemultipleInterfaces- Set toByEndpointto generate an interface for each endpoint, orByTagto group Endpoints by their Tag (like SwaggerUI groups them).outputFolder- a string describing a relative path to a desired output folder. Default is./GeneratedoutputFilename- Output filename. Default isOutput.cswhen used from the CLI tool, otherwise its the .refitter filename. SoPetstore.refitterbecomesPetstore.cs.contractsOutputFolder- a string describing a relative path to a desired output folder for the Contracts.cs file. By the default, this uses the value specified inoutputFolderadditionalNamespaces- A collection of additional namespaces to include in the generated file. A use case for this is when you want to reuse contracts from a different namespace than the generated code. Default is emptyexcludeNamespaces- A collection of regular expressions to exclude namespaces from the generated file. A use case for this is when your project has global usings where these namespaces would be redundant. Default is emptyincludeTags- A collection of tags to use a filter for including endpoints that contain this tag.includePathMatches- A collection of regular expressions used to filter paths.generateDeprecatedOperations- a boolean indicating whether deprecated operations should be generated or skipped. Default istrueoperationNameTemplate- Generate operation names using pattern. This must contain the string {operationName}. An example usage of this could be{operationName}Asyncto suffix all method names with Async. When using multiple interfaces withByEndpoint, this is name of the Execute() method in the interface where all instances of the string '{operationName}' is replaced with 'Execute'optionalParameters- Generate non-required parameters as nullable optional parameterstrimUnusedSchema- Removes unreferenced components schema to keep the generated output to a minimumkeepSchemaPatterns: A collection of regular expressions to force to keep matching schema. This is used together withtrimUnusedSchemaincludeInheritanceHierarchy: 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 withtrimUnusedSchemagenerateDefaultAdditionalProperties: Set tofalseto skip default additional properties. Default istrueforceAdditionalProperties: Set totrueto generate additional properties ([JsonExtensionData]) on every contract, even when the schema setsadditionalProperties: false. Useful for read-modify-write clients that must round-trip fields unknown to an older spec. Schema-valued additional properties are left unchanged. Takes precedence overgenerateDefaultAdditionalProperties. Default isfalseallowRemoteReferences: Whentrue, remote (http/https)$refreferences inside the document are resolved. Disabled by default to prevent generation-time SSRF and remote file inclusion. Local$refreferences are always confined to the input document's directory tree. Default isfalsesilent: Set totrueto suppress all console output when running the CLI tool. Errors are still reported through the exit code. Default isfalseoperationNameGenerator: The NSwagIOperationNameGeneratorimplementation to use. See https://refitter.github.io/api/Refitter.Core.OperationNameGeneratorTypes.htmlimmutableRecords: Set totrueto generate contracts as immutable records instead of classes. Default isfalseuseDynamicQuerystringParameters: Set totrueto wrap multiple query parameters into a single complex one. Default isfalse(no wrapping). See https://github.com/reactiveui/refit?tab=readme-ov-file#dynamic-querystring-parameters for more information.useMultipartFormObject: Set totrueto wrap the non-file fields of amultipart/form-datarequest body into a single[FormObject]parameter, so Refit writes each field (including enums) as a plain text part instead of a JSON part. File fields stay as separateStreamPartparameters, and object fields stay as separate parameters sent as JSON parts. Default isfalse(no wrapping). Requires theRefit.Reflectionpackage and is not supported byAddRefitGeneratedClientor NativeAOT. See https://www.reactiveui.net/documentation/refit/requests/multipart/#flatten-a-form-object-reflection-only-path for more information.usePolymorphicSerialization: Set totrueto useSystem.Text.Jsonpolymorphic serialization.generateMultipleFiles: Set totrueto generate multiple files. This is automatically set totruewhenContractsOutputFolderis specified. Refit interface(s) are written to a file calledRefitInterfaces.cs, Contracts are written to a file calledContracts.cs, and Dependency Injection is written to a file calledDependencyInjection.csdependencyInjectionSettings- Setting this will generated extension methods toIServiceCollectionfor configuring Refit clients, including optional Windows Authentication supportbaseUrl- Used as the HttpClient base address. Leave this blank to manually set the base URLhttpMessageHandlers- A collection ofHttpMessageHandlerthat is added to the HttpClient pipelineusePolly- Set this totrueto configure the HttpClient to use Polly using a retry policy with a jittered backoff. This is DEPRECATED, usetransientErrorHandlerinsteadtransientErrorHandler: Set this to configure transient error handling with a retry policy that uses a jittered backoff. See https://refitter.github.io/api/Refitter.Core.TransientErrorHandler.htmlmaxRetryCount- This is the max retry count used in the Polly retry policy. Default is 6firstBackoffRetryInSeconds- This is the duration of the initial retry backoff. Default is 1 seconduseGeneratedRefitClient- Set this totrueto register clients with the source-generatedAddRefitGeneratedClientinstead of the reflection-basedAddRefitClient. Requires Refit 12.1.0 or newer, and Refit 14.0.0 or newer if the interfaces have query parameters. Refit 17 movedAddRefitClientto theRefit.HttpClientFactory.Reflectionpackage. With Refit 17 or newer, either reference that package and leave thisfalse, or set this totrueand pass aJsonSerializerContextto the generated registration method, for exampleRefitSettings.ForJsonContext(MySerializerContext.Default)withgenerateJsonSerializerContextenabled. The source generator sets this totruefor Refit 17 or newer unless the project referencesRefit.HttpClientFactory.Reflection. This is ignored when Apizr registration is generated. Default isfalse
apizrSettings- Setting this will format Refit interface to be managed by Apizr. See https://www.apizr.net for more informationwithRequestOptions- Tells if the Refit interface methods should have a final IApizrRequestOptions options parameterwithRegistrationHelper- Tells if Refitter should generate Apizr registration helpers (extended with dependencyInjectionSettings set, otherwise static)withCacheProvider- Set the cache provider to be usedwithPriority- Tells if Apizr should handle request prioritywithMediation- Tells if Apizr should handle request mediation (extended only)withOptionalMediation- Tells if Apizr should handle optional request mediation (extended only)withMappingProvider- Set the mapping provider to be usedwithFileTransfer- Tells if Apizr should handle file transfer
codeGeneratorSettings- Setting this allows customization of the NSwag generated types and contractsrequiredPropertiesMustBeDefined- Default is true,generateDataAnnotations- Default is true,anyType- Default isobject,dateType- Default isSystem.DateTimeOffset,dateTimeType- Default isSystem.DateTimeOffset,timeType- Default isSystem.TimeSpan,timeSpanType- Default isSystem.TimeSpan,arrayType- Default isSystem.Collections.Generic.ICollection,dictionaryType- Default isSystem.Collections.Generic.IDictionary,arrayInstanceType- Default isSystem.Collections.ObjectModel.Collection,dictionaryInstanceType- Default isSystem.Collections.Generic.Dictionary,arrayBaseType- Default isSystem.Collections.ObjectModel.Collection,dictionaryBaseType- Default isSystem.Collections.Generic.Dictionary,integerType- Default isInt32. The .NET type to use for OpenAPI integer types without a format specifier. Possible values:Int32,Int64propertySetterAccessModifier- Default is ``,generateImmutableArrayProperties- Default is false,generateImmutableDictionaryProperties- Default is false,handleReferences- Default is false,jsonSerializerSettingsTransformationMethod- Default is null,generateJsonMethods- Default is false,enforceFlagEnums- Default is false,inlineNamedDictionaries- Default is false. When enabled, usages of named dictionary schemas use the dictionary type directly (e.g.IDictionary<string, T>) and the named types are not generatedinlineNamedTuples- Default is true,inlineNamedArrays- Default is false. When enabled, usages of named array schemas use the collection type directly (e.g.ICollection<T>) and the named types are not generatedgenerateOptionalPropertiesAsNullable- Default is false,generateNullableReferenceTypes- Default is false,generateNativeRecords- Default is falsegenerateDefaultValues- Default is trueinlineNamedAny- Default is falseinlineJsonConverters- Default is true. When set to false, enum properties will not have[JsonConverter(typeof(JsonStringEnumConverter))]attributesexcludedTypeNames- Default is empty. Excluded types must be provided by an import or another namespace. WhengenerateNativeRecordsorimmutableRecordsis enabled, an excluded type that a generated contract derives from must itself be a record, since C# records cannot inherit from classesdateFormat- Default is nulldateTimeFormat- Default is nulljsonLibraryVersion- Default is8.0. JSON library version for System.Text.Json. When set to9.0or higher, enables .NET 9+JsonStringEnumMemberNamesupport for custom enum value names
JSON Schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"openApiPath": {
"type": "string",
"description": "The path to the OpenAPI specification file. Required if openApiPaths is not specified."
},
"openApiPaths": {
"type": "array",
"items": {
"type": "string"
},
"description": "The paths to multiple OpenAPI specification files. When specified, the documents are merged into a single generated client. The first document wins on schema conflicts. Required if openApiPath is not specified."
},
"namespace": {
"type": "string",
"description": "The namespace for the generated code."
},
"contractsNamespace": {
"type": "string",
"description": "The namespace for the generated contracts code."
},
"naming": {
"type": "object",
"properties": {
"useOpenApiTitle": {
"type": "boolean",
"description": "Indicates whether to use the OpenAPI title for naming."
},
"interfaceName": {
"type": "string",
"description": "The name of the generated interface."
}
}
},
"generateContracts": {
"type": "boolean",
"description": "Indicates whether to generate contracts."
},
"generateClients": {
"type": "boolean",
"description": "Indicates whether to generate Refit interface(s)."
},
"generateXmlDocCodeComments": {
"type": "boolean",
"description": "Indicates whether to generate XML documentation code comments."
},
"addAutoGeneratedHeader": {
"type": "boolean",
"description": "Indicates whether to add an auto-generated header."
},
"addAcceptHeaders": {
"type": "boolean",
"description": "Indicates whether to add accept headers."
},
"addContentTypeHeaders": {
"type": "boolean",
"description": "Indicates whether to add content-type headers."
},
"returnIApiResponse": {
"type": "boolean",
"description": "Indicates whether to return IApiResponse."
},
"returnIAsyncEnumerable": {
"type": "boolean",
"description": "Indicates whether streaming responses generate IAsyncEnumerable. Default is true."
},
"responseTypeOverride": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "Overrides the response type for specific status codes."
},
"generateOperationHeaders": {
"type": "boolean",
"description": "Indicates whether to generate operation headers."
},
"typeAccessibility": {
"type": "string",
"enum": [
"Public",
"Internal"
],
"description": "The accessibility level for generated types."
},
"useCancellationTokens": {
"type": "boolean",
"description": "Indicates whether to use cancellation tokens."
},
"useIsoDateFormat": {
"type": "boolean",
"description": "Indicates whether to use ISO date format."
},
"multipleInterfaces": {
"type": "string",
"enum": [
"ByEndpoint",
"ByTag"
],
"description": "Specifies how to generate multiple interfaces."
},
"outputFolder": {
"type": "string",
"description": "The output folder for the generated code."
},
"outputFilename": {
"type": "string",
"description": "The output filename for the generated code."
},
"contractsOutputFolder": {
"type": "string",
"description": "The output folder for the generated contracts code",
},
"additionalNamespaces": {
"type": "array",
"items": {
"type": "string"
},
"description": "Additional namespaces to include in the generated code."
},
"excludeNamespaces": {
"type": "array",
"items": {
"type": "string"
},
"description": "Exclude namespaces that match the provided regular expressions."
},
"includeTags": {
"type": "array",
"items": {
"type": "string"
},
"description": "Tags to include in the generation process."
},
"includePathMatches": {
"type": "array",
"items": {
"type": "string"
},
"description": "Path patterns to include in the generation process."
},
"generateDeprecatedOperations": {
"type": "boolean",
"description": "Indicates whether to generate deprecated operations."
},
"operationNameTemplate": {
"type": "string",
"description": "The template for generating operation names."
},
"optionalParameters": {
"type": "boolean",
"description": "Indicates whether to include optional parameters."
},
"trimUnusedSchema": {
"type": "boolean",
"description": "Indicates whether to trim unused schema."
},
"keepSchemaPatterns": {
"type": "array",
"items": {
"type": "string"
},
"description": "Patterns to keep in the schema."
},
"generateDefaultAdditionalProperties": {
"type": "boolean",
"description": "Indicates whether to generate default additional properties."
},
"forceAdditionalProperties": {
"type": "boolean",
"description": "Indicates whether to generate additional properties even when schemas set additionalProperties to false."
},
"allowRemoteReferences": {
"type": "boolean",
"description": "When true, remote (http/https) $ref references inside the document are resolved. Disabled by default to prevent generation-time SSRF and remote file inclusion. Local $ref references are always confined to the input document's directory tree."
},
"silent": {
"type": "boolean",
"description": "Suppress all console output when running the CLI tool. Errors are still reported through the exit code."
},
"operationNameGenerator": {
"type": "string",
"description": "The generator used to generate operation names."
},
"immutableRecords": {
"type": "boolean",
"description": "Set to true to generate contracts as immutable records instead of classes"
},
"useDynamicQuerystringParameters": {
"type": "boolean",
"description": "Set to true to wrap multiple query parameters into a single complex one."
},
"useMultipartFormObject": {
"type": "boolean",
"description": "Set to true to wrap the non-file fields of a multipart/form-data request body into a single [FormObject] parameter. Requires the Refit.Reflection package."
},
"usePolymorphicSerialization": {
"type": "boolean",
"description": "Set to true to use System.Text.Json polymorphic serialization"
},
"generateMultipleFiles": {
"type": "boolean",
"description": "Set to `true` to generate multiple files. 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`, and Dependency Injection is written to a file called `DependencyInjection.cs`"
},
"dependencyInjectionSettings": {
"type": "object",
"properties": {
"baseUrl": {
"type": "string",
"description": "The base URL for the dependency injection settings."
},
"httpMessageHandlers": {
"type": "array",
"items": {
"type": "string"
},
"description": "HTTP message handlers for the dependency injection settings."
},
"usePolly": {
"type": "boolean",
"description": "Indicates whether to use Polly for the dependency injection settings."
},
"maxRetryCount": {
"type": "integer",
"description": "The maximum retry count for Polly in the dependency injection settings."
},
"firstBackoffRetryInSeconds": {
"type": "integer",
"description": "The first backoff retry in seconds for the dependency injection settings."
},
"useGeneratedRefitClient": {
"type": "boolean",
"description": "Uses the source-generated AddRefitGeneratedClient registration instead of AddRefitClient. Requires Refit 12.1.0 or newer, and Refit 14.0.0 or newer if the interfaces have query parameters. With Refit 17 or newer, AddRefitClient needs the Refit.HttpClientFactory.Reflection package, and AddRefitGeneratedClient needs a JsonSerializerContext passed through RefitSettings. The source generator enables this automatically for Refit 17 or newer unless the project references Refit.HttpClientFactory.Reflection. Ignored when Apizr registration is generated."
}
},
"description": "Settings for dependency injection."
},
"apizrSettings": {
"type": "object",
"properties": {
"withRequestOptions": {
"type": "boolean",
"description": "Tells if the Refit interface methods should have a final IApizrRequestOptions options parameter"
},
"withRegistrationHelper": {
"type": "boolean",
"description": "Tells if Refitter should generate Apizr registration helpers (extended with dependencyInjectionSettings set, otherwise static)."
},
"withCacheProvider": {
"type": "string",
"enum": [
"None",
"Akavache",
"MonkeyCache",
"InMemory",
"DistributedAsString",
"DistributedAsByteArray"
],
"description": "Set the cache provider to be used."
},
"withPriority": {
"type": "boolean",
"description": "Tells if Apizr should handle request priority."
},
"withMediation": {
"type": "boolean",
"description": "Tells if Apizr should handle request mediation (extended only)."
},
"withOptionalMediation": {
"type": "boolean",
"description": "Tells if Apizr should handle optional request mediation (extended only)."
},
"withMappingProvider": {
"type": "string",
"enum": [
"None",
"AutoMapper",
"Mapster"
],
"description": "Set the mapping provider to be used."
},
"withFileTransfer": {
"type": "boolean",
"description": "Tells if Apizr should handle file transfer."
}
},
"description": "Settings for Apizr."
},
"codeGeneratorSettings": {
"type": "object",
"description": "Settings for the code generator."
"properties": {
"requiredPropertiesMustBeDefined": {
"type": "boolean",
"description": "Indicates whether required properties must be defined in the code generator settings."
},
"generateDataAnnotations": {
"type": "boolean",
"description": "Indicates whether to generate data annotations in the code generator settings."
},
"anyType": {
"type": "string",
"description": "The type used for 'any' in the code generator settings."
},
"dateType": {
"type": "string"
},
"dateTimeType": {
"type": "string"
},
"timeType": {
"type": "string"
},
"timeSpanType": {
"type": "string"
},
"arrayType": {
"type": "string"
},
"dictionaryType": {
"type": "string"
},
"arrayInstanceType": {
"type": "string"
},
"dictionaryInstanceType": {
"type": "string"
},
"arrayBaseType": {
"type": "string"
},
"dictionaryBaseType": {
"type": "string"
},
"propertySetterAccessModifier": {
"type": "string"
},
"jsonConverters": {
"type": "array",
"items": {
"type": "string"
}
},
"generateImmutableArrayProperties": {
"type": "boolean"
},
"generateImmutableDictionaryProperties": {
"type": "boolean"
},
"handleReferences": {
"type": "boolean"
},
"jsonSerializerSettingsTransformationMethod": {
"type": "string"
},
"generateJsonMethods": {
"type": "boolean"
},
"enforceFlagEnums": {
"type": "boolean"
},
"inlineNamedDictionaries": {
"type": "boolean"
},
"inlineNamedTuples": {
"type": "boolean"
},
"inlineNamedArrays": {
"type": "boolean"
},
"generateOptionalPropertiesAsNullable": {
"type": "boolean"
},
"generateNullableReferenceTypes": {
"type": "boolean"
},
"generateNativeRecords": {
"type": "boolean"
},
"generateDefaultValues": {
"type": "boolean"
},
"inlineNamedAny": {
"type": "boolean"
},
"excludedTypeNames": {
"type": "array",
"items": {
"type": "string"
}
},
"dateFormat": {
"type": "string"
},
"dateTimeFormat": {
"type": "string"
},
"jsonLibraryVersion": {
"type": "number",
"description": "JSON library version for System.Text.Json. Default is 8.0. When set to 9.0 or higher, enables .NET 9+ JsonStringEnumMemberName support."
}
},
}
}
}