Skip to content

Commit

Permalink
Remove namespace settings from codeGeneratorSettings
Browse files Browse the repository at this point in the history
The namespace setting in `codeGeneratorSettings` and related documentation was removed. This setting is a duplicated and was never respected, it was just causing confusion and was deemed unnecessary. The `namespace` property is already defined in `RefitGeneratorSettings` and from the CLI argument `--namespace`
  • Loading branch information
christianhelle committed Oct 14, 2023
1 parent 51e943a commit 1d40bac
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 12 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ The following is an example `.refitter` file
"firstBackoffRetryInSeconds": 0.5 // Optional. Default=1.0
},
"codeGeneratorSettings": { // Optional. Default settings are the values set in this example
"namespace": "GeneratedCode",
"requiredPropertiesMustBeDefined": true,
"generateDataAnnotations": true,
"anyType": "object",
Expand Down Expand Up @@ -228,7 +227,6 @@ The following is an example `.refitter` file
- `pollyMaxRetryCount` - This is the max retry count used in the Polly retry policy. Default is 6
- `firstBackoffRetryInSeconds` - This is the duration of the initial retry backoff. Default is 1 second
- `codeGeneratorSettings` - Setting this allows customization of the NSwag generated types and contracts
- `namespace` - Default is `GeneratedCode`,
- `requiredPropertiesMustBeDefined` - Default is true,
- `generateDataAnnotations` - Default is true,
- `anyType` - Default is `object`,
Expand Down
3 changes: 0 additions & 3 deletions docs/docfx_project/articles/refitter-file-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ The following is an example `.refitter` file
"firstBackoffRetryInSeconds": 0.5 // Optional. Default=1.0
},
"codeGeneratorSettings": { // Optional. Default settings are the values set in this example
"namespace": "GeneratedCode",
"requiredPropertiesMustBeDefined": true,
"generateDataAnnotations": true,
"anyType": "object",
Expand Down Expand Up @@ -90,7 +89,6 @@ The following is an example `.refitter` file
Here are some basic explanations of each property:

- `openApiPath` - points to the OpenAPI Specifications file. This can be the path to a file stored on disk, relative to the `.refitter` file. This can also be a URL to a remote file that will be downloaded over HTTP/HTTPS
- `namespace` - the namespace used in the generated code. If not specified, this defaults to `GeneratedCode`
- `naming.useOpenApiTitle` - a boolean indicating whether the OpenApi title should be used. Default is `true`
- `naming.interfaceName` - the name of the generated interface. The generated code will automatically prefix this with `I` so if this set to `MyApiClient` then the generated interface is called `IMyApiClient`. Default is `ApiClient`
- `generateContracts` - a boolean indicating whether contracts should be generated. A use case for this is several API clients use the same contracts. Default is `true`
Expand All @@ -117,7 +115,6 @@ Here are some basic explanations of each property:
- `pollyMaxRetryCount` - This is the max retry count used in the Polly retry policy. Default is 6
- `firstBackoffRetryInSeconds` - This is the duration of the initial retry backoff. Default is 1 second
- `codeGeneratorSettings` - Setting this allows customization of the NSwag generated types and contracts
- `namespace` - Default is `GeneratedCode`,
- `requiredPropertiesMustBeDefined` - Default is true,
- `generateDataAnnotations` - Default is true,
- `anyType` - Default is `object`,
Expand Down
5 changes: 0 additions & 5 deletions src/Refitter.Core/Settings/CodeGeneratorSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
/// </summary>
public class CodeGeneratorSettings
{
/// <summary>
/// Gets or sets the .NET namespace of the generated types (default: GeneratedCode).
/// </summary>
public string Namespace { get; set; } = "GeneratedCode";

/// <summary>
/// Gets or sets a value indicating whether a required property must be defined in JSON
/// (sets Required.Always when the property is required) (default: true).
Expand Down
1 change: 0 additions & 1 deletion src/Refitter.SourceGenerator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ The following is an example `.refitter` file
- `pollyMaxRetryCount` - This is the max retry count used in the Polly retry policy. Default is 6
- `firstBackoffRetryInSeconds` - This is the duration of the initial retry backoff. Default is 1 second
- `codeGeneratorSettings` - Setting this allows customization of the NSwag generated types and contracts
- `namespace` - Default is `GeneratedCode`,
- `requiredPropertiesMustBeDefined` - Default is true,
- `generateDataAnnotations` - Default is true,
- `anyType` - Default is `object`,
Expand Down
32 changes: 31 additions & 1 deletion src/Refitter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,44 @@ The following is an example `.refitter` file
- `includeTags` - 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 is `true`
- `operationNameTemplate` - Generate operation names using pattern. This must contain the string {operationName}. An example usage of this could be `{operationName}Async` to suffix all method names with Async. When using multipleIinterfaces=ByEndpoint, This is name of the Execute() method in the interface
- `operationNameTemplate` - Generate operation names using pattern. This must contain the string {operationName}. An example usage of this could be `{operationName}Async` to suffix all method names with Async
- `optionalParameters` - Generate non-required parameters as nullable optional parameters
- `dependencyInjectionSettings` - Setting this will generated extension methods to `IServiceCollection` for configuring Refit clients
- `baseUrl` - Used as the HttpClient base address. Leave this blank to manually set the base URL
- `httpMessageHandlers` - A collection of `HttpMessageHandler` that is added to the HttpClient pipeline
- `usePolly` - Set this to true to configure the HttpClient to use Polly using a retry policy with a jittered backoff
- `pollyMaxRetryCount` - This is the max retry count used in the Polly retry policy. Default is 6
- `firstBackoffRetryInSeconds` - This is the duration of the initial retry backoff. Default is 1 second
- `codeGeneratorSettings` - Setting this allows customization of the NSwag generated types and contracts
- `requiredPropertiesMustBeDefined` - Default is true,
- `generateDataAnnotations` - Default is true,
- `anyType` - Default is `object`,
- `dateType` - Default is `System.DateTimeOffset`,
- `dateTimeType` - Default is `System.DateTimeOffset`,
- `timeType` - Default is `System.TimeSpan`,
- `timeSpanType` - Default is `System.TimeSpan`,
- `arrayType` - Default is `System.Collections.Generic.ICollection`,
- `dictionaryType` - Default is `System.Collections.Generic.IDictionary`,
- `arrayInstanceType` - Default is `System.Collections.ObjectModel.Collection`,
- `dictionaryInstanceType` - Default is `System.Collections.Generic.Dictionary`,
- `arrayBaseType` - Default is `System.Collections.ObjectModel.Collection`,
- `dictionaryBaseType` - Default is `System.Collections.Generic.Dictionary`,
- `propertySetterAccessModifier` - 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,
- `inlineNamedTuples` - Default is true,
- `inlineNamedArrays` - Default is false,
- `generateOptionalPropertiesAsNullable` - Default is false,
- `generateNullableReferenceTypes` - Default is false,
- `generateNativeRecords` - Default is false
- `generateDefaultValues` - Default is true
- `inlineNamedAny` - Default is false
- `excludedTypeNames` - Default is empty

To generate code from an OpenAPI specifications file, run the following:

Expand Down

0 comments on commit 1d40bac

Please sign in to comment.