Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON schema #314

Merged
merged 2 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 198 additions & 2 deletions docs/docfx_project/articles/refitter-file-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The `.refitter` file is a JSON serialized version of the [RefitGeneratorSettings

The following is an example `.refitter` file

```js
```json
{
"openApiPath": "/path/to/your/openAPI", // Required
"namespace": "Org.System.Service.Api.GeneratedCode", // Optional. Default=GeneratedCode
Expand Down Expand Up @@ -99,6 +99,8 @@ The following is an example `.refitter` file
}
```

### Descriptions

- `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`
Expand Down Expand Up @@ -161,4 +163,198 @@ The following is an example `.refitter` file
- `generateNativeRecords` - Default is false
- `generateDefaultValues` - Default is true
- `inlineNamedAny` - Default is false
- `excludedTypeNames` - Default is empty
- `excludedTypeNames` - Default is empty

### JSON Schema

```json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"openApiPath": {
"type": "string",
"description": "The path to the OpenAPI specification file."
},
"namespace": {
"type": "string",
"description": "The namespace for the generated 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."
},
"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."
},
"returnIApiResponse": {
"type": "boolean",
"description": "Indicates whether to return IApiResponse."
},
"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."
},
"additionalNamespaces": {
"type": "array",
"items": {
"type": "string"
},
"description": "Additional namespaces to include in the generated code."
},
"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."
},
"operationNameGenerator": {
"type": "string",
"description": "The generator used to generate operation names."
},
"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."
},
"pollyMaxRetryCount": {
"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."
}
},
"description": "Settings for dependency injection."
},
"codeGeneratorSettings": {
"type": "object",
"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."
}
},
"description": "Settings for the code generator."
}
}
}
```
Loading