SDK customization options
The customizations
section is used to customize your SDKs.
Setting | Type | Required | Default | Description |
---|---|---|---|---|
authentication | object | ❌ | N/A | Customization the API authentication settings |
documentation | object | ❌ | N/A | Customization the documentation generation settings |
generateEnv | bool | ❌ | true | Should example .env files be generated? |
license | object | ❌ | N/A | What license should the SDKs be covered under? |
retry | object | ❌ | N/A | Retry functionality customization |
injectedModels | array | ❌ | N/A | A list of models to inject into their parent models |
environmentVariables | array | ❌ | N/A | A list of environment variables to inject into the SDKs |
refreshToken | object | ❌ | N/A | Refresh token customization |
environments | array | ❌ | N/A | A list of deployment environments |
inferServiceNames | bool | ❌ | false | Should the SDKs infer service names from the spec? |
responseHeaders | bool | ❌ | false | Should response headers be included in the response object. |
devContainer | bool | ❌ | false | Should the generated SDKs contain the files to be able to run it as a dev container |
includeOptionalSnippetParameters | bool | ❌ | true | Should optional parameters be included in the code snippets in generated documentation |
endpointCustomizations | object | ❌ | N/A | Customize an endpoint based on a path and method name |
authentication
Supported SDK languages and versions:
TypeScript v1 TypeScript v2 Java v1 Java v2 Python v1 Python v2 C# Go PHP ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
The authentication
options allow you to configure the authentication that your API uses, that is set using the auth
options. This section is an object with the following options:
Option | Type | Required | Default | Description |
---|---|---|---|---|
access | object | ❌ | N/A | Custom access token authentication options |
apiKey | object | ❌ | N/A | API key authentication options |
You can read more on authentication in our authentication guide.
access
The access
options allow you to configure the custom access token that is sent to your API when the auth
option is set to custom
. This section is an object with the following options:
Option | Type | Required | Default | Description |
---|---|---|---|---|
prefix | string | ❌ | N/A | The prefix to use for the custom access token authentication |
prefix
The prefix
is used to define a custom prefix when using an access token. By default when using custom access token authentication, the Authorization
header is passed as Bearer <token>
. For example, if your bearer token is Passw0rd123!
, the header would be:
Header | Value |
---|---|
Authorization | Bearer Passw0rd123! |
By setting the prefix
, you can replace Bearer
with the value of your choice.
For example, if you have the following:
{
...
"auth": [
"custom"
],
"customizations": {
"authentication": {
"access": {
"prefix": "Token"
}
}
}
...
}
Then the header would be:
Header | Value |
---|---|
Authorization | Token Passw0rd123! |
apiKey
The apiKey
option is used to configure the API key authentication for the SDKs. This is used if the auth
setting is set to apikey
. This is an object with the following options:
Option | Type | Required | Default | Description |
---|---|---|---|---|
header | string | ❌ | X-API-KEY | The header to use for the API key authentication |
header
The header
option sets the header to use for the API key authentication. This is used by the SDKs to set the header when making requests to the API. For example, if you have the following:
{
...
"customizations": {
"authentication": {
"apiKey": {
"header": "MY_CUSTOM_APIKEY_HEADER"
}
}
}
...
}
Then the API key will be passed to your API using the MY_CUSTOM_APIKEY_HEADER
header.
If this is not set, then API keys by default will be passed using the X-API-KEY
header.
documentation
The documentation
options allow you to configure the documentation that is generated with your SDK. You define what types of documentation is created using the the docs
options. This section is an object with the following options:
Option | Type | Required | Default | Description |
---|---|---|---|---|
snippets | object | ❌ | N/A | SDK snippets customization options |
You can read more about documentation generation in our documentation generation guide.
snippets
Supported SDK languages and versions:
TypeScript v1 TypeScript v2 Java v1 Java v2 Python v1 Python v2 C# Go PHP ❌ ✅ ❌ ✅ ✅