Code Generation Settings Overview
APIMatic code generation feature allows you to effortlessly create API client libraries across multiple programming languages. Throughout the code generation process, you have the flexibility to configure different settings to customize these SDKs according to your specific requirements.
This section offers a comprehensive overview of these CodeGen settings, their functionalities, and instructions on how to use them.
note
You can import your API definition file along with a metadata file apimatic-metadata.json that will allow you to configure these settings.
Endpoint Settings
Setting | Description |
---|---|
Return Complete HTTP Response | This setting returns complete HTTP response including headers and status code. |
Use HTTP Method Prefix | This setting allows to prefix the HTTP method Get , Update , or Delete to the name of the methods. |
Encode Template Parameters | This setting encodes endpoint level parameters. |
Validate Required Parameters | This setting validates required API endpoint parameters to be not null. |
Collapse Params to Array | This setting collapses more than 1 parameters into an options array. |
Use Endpoint Method Name | Use the MethodName in the endpoint entity to name endpoints instead of the Name property. |
Nullify 404 | This setting returns null response on the HTTP status code 404 instead of throwing an exception. |
Nullify Empty Responses | This setting enables the endpoints to return null when one or more responses does not specify any content. |
Lift Parameter Description from Custom Type | This setting adds a custom type's description as parameter description when a parameter referencing has missing description. |
Force Keywords Arguments in Ruby | This setting decides whether to use keyword arguments for required parameters or positional arguments. |
Model Settings
Setting | Description |
---|---|
Enable Additional Model Properties | This setting allows to add additional properties of models that are not part of the model description. |
Use Model Prefix | This setting allows to postfix each model class with the word "Model". |
Generate Models | This setting allows to switch between using models and maps. |
Enable Immutable Models | This setting controls whether the models in the SDK should be immutable or not. |
Ignore If Null JSON | This setting ignores all null properties during JSON serialization of a model in the generated SDKs. |
Enable Keyword Arguments in Model Constructor in Ruby | This setting enables the keyword arguments for all properties in the constructor of models in Ruby SDKs. |
Enum Settings
Setting | Description |
---|---|
Generate Enums | This setting converts enums to native types. |
Use Enum Prefix | This setting allows to postfix each enum class with the word "Enum". |
Package Configuration
Setting | Description |
---|---|
Multitarget Dotnet Versions | This setting decides whether to use multiple target frameworks or not. |
Java Group ID | This setting sets the GroupId to be used in Maven POM file generated in Java SDKs. |
Java Artifact ID | This setting sets the Java ArtifactId used by package managers. |
PHP Composer Package Name | This setting sets name in composer.json file for PHP SDKs. |
Enable PHP Composer Version String | This setting adds version component to the composer.json file in PHP SDKs. |
HTTP Configuration
Setting | Description |
---|---|
Enable HTTP Cache | This setting allows to enable/disable HTTP caching for idempotent endpoint methods. |
Append Content Headers | Enable this setting to automatically determine the request and response content types and append appropriate "accept" and "content-type" headers. |
Allow Skipping SSL certificate Verification | This setting creates a configuration option in SDKs to optionally skip certificate verification when establishing HTTPs connections. |
Throw for HTTP Error Status Codes | Disable this setting to return status code and response instead of throwing an exception for error responses. |
SDK Interface Customization
Setting | Description |
---|---|
Project Name | This setting sets the name of the project for generated SDKs. |
C# Namespace | This setting uses the default value of root namespace in C# SDKs. |
Java Package Name | This setting sets the default value of the package name to be used in Java SDKs. |
PHP Namespace | This setting uses the root namespace for PHP SDKs. |
Use Controller Prefix | Enable this setting to postfix each controller class with the word "Controller". |
Controller Postfix | This setting takes a value to postfix to the Endpoint Group names. |
Controller Namespace | This setting specifies name of controller namespace in SDKs. |
Generate Interfaces | Enable this setting to generate interfaces for controller classes in the generated SDKs. |
Client Interface Name | This setting sets the class name of the client library interface. |
Use Security Scheme Name For Single Auth | Enable this setting to derive the auth interface name from the auth scheme name specified in the API definition. |
Do Not Split Words | This setting lists words that should not be split, regardless of the capitalization. |
Synchronous Mode of Code | Enable this setting to generate asynchronous code and disable it for synchronous code. |
Enable Logging | Enable this setting to generate code in the SDKs for logging events in the API cycle using a library. |
Symbolize Hash Keys in Ruby | Enable this setting to use symbols instead of strings for hash keys in Ruby SDKs. |
Underscore Numbers | This setting adds underscores before and after numbers in the generated SDKs. |
Timeout and Retries
Setting | Description |
---|---|
Timeout | This setting specifies the duration (in seconds) after which requests would fail. |
Retry On Timeout | Enable this setting to retry request on timeout. |
Request HTTP Methods to Retry | This setting specifies the HTTP methods to retry again. |
Status Codes to Retry | This setting specifies the HTTP status codes to invoke retry on. |
Maximum Retry Wait Limit | This setting sets the maximum wait time in seconds for overall retrying requests. |
Number of Retries | This setting sets the number of retries to make for calling an idempotent endpoint after which the endpoint should fail. |
Retry Interval | This setting sets the retry time interval between endpoint calls. |
User Configurable Retries | This setting decides if SDK users should be able to configure retries. |
Backoff Factor | This setting adds an exponential backoff factor to increase interval between retries. |
Serialization Settings
Setting | Description |
---|---|
Array Serialization | This setting decides array serialization scheme for primitive types. |
Enable JSON Pass Through for Any | This setting decides whether JSON should be passed through any type in the SDK. |
User Agent Settings
Setting | Description |
---|---|
Enable Global User Agent | Use this setting to enable/disable sending the UserAgent field in the user-agent header. |
User Agent | Use this setting to add the user agent to the header of the API calls to identify the sender of the request. |
Code Branding Settings
Setting | Description |
---|---|
Brand Label | Enable this setting to add a brand label to the header of the generated files. |
Short Copyright Notice | Enable this setting to set a copyright notice to prepend to all code files. |
SDK Docs Configuration
Setting | Description |
---|---|
Disable Docs | Use this setting to disable README file generation for SDKs including any other SDK documentation files. |
Generate Examples for Optional Fields | Use this setting to include optional fields during sample value generation. |
Is Latest Version | Use this setting to hide version number from install commands and package repo links in the docs. |
Usage Example Endpoint | Use this setting to choose an endpoint to display its full usage example in the README file. |
Sort Resources | Use this setting to sort resources such as endpoints, endpoint groups, and models in the generated documentation. |
Exception Settings
Setting | Description |
---|---|
Generate Exceptions | Enable this setting to generate exception classes for Exception Custom types defined by the user. |
Miscellaneous Settings
Setting | Description |
---|---|
Disable Linting | This setting allows to use generate files/dependencies for linting. |
Disable Multiple Auth | This setting allows you to disable multiple authentication support. |
Add Single Auth Deprecated Code | This setting allows you to remove all the deprecated code related to single authentication credentials setup from the SDKs. |
Use Java Properties Config | This setting loads SDK configuration from Java properties file. |
License Text | This setting sets the license text to use in place of the standard MIT license. |
Store Timezone Information | This setting stores timezone information with date-time types. |
Apply Customizations | This setting sets customer-specific customizations to be applied during SDK and docs generation. |
Custom Dependencies | This setting adds custom dependencies to the project. |
Enforce Standardized Casing | This setting specifies whether to enforce standardized casing during SDK and docs generation. |