Code Generation Settings
APIMatic's code generation engine has various code generation configurations like code styling, code branding, continuous integration settings, endpoint/model settings and more to customize the behaviour and outlook of the generated SDKs. To configure code generation settings:
- On APIMatic Dashboard, click on Edit API on the API for which you want to configure code generation settings.
- From the left-side context menu, click on CodeGen settings under Settings. You can now configure various kinds of settings for code generation.
API Metadata
You can also provide these settings as API specification metadata file during import.
Generic Code Styling
These configurations change the overall look and feel of the generated code.
Setting | Description | Languages Applicable |
---|---|---|
Asynchronous Code | Enabling this generates asynchronous code. Objective C generates asynchronous code irrespective of this option. | |
HTTP Method Prefix | Enabling this will prefix the HTTP method i.e Get, Create, Update or Delete to the name of the methods. For e.g the endpoint Contact using POST becomes CreateContact | |
Model Postfix | Postfixes each model class with the word Model. For e.g the model Contact becomes ContactModel. | |
Enum Postfix | Postfixes each enum class with the word Enum. For e.g the enum Days becomes DaysEnum. | |
Append JSON Headers | Automatically determines the request and response content types and appends appropriate "accept" and "content-type" headers. | |
Use Common Library | Uses a common library comprising of common classes used by the generated SDKs leading to reduced code duplication. | |
Controller Postfix | Postfixes each controller class with the word Controller. For e.g the controller User becomes UserController. | |
Generate Interfaces | Generates interfaces for controller classes in the generated SDKs. Objective C and GO generate interfaces irrespective of this option. | |
Underscore Numbers | Adds underscores before and after numbers for underscore_case in the generated SDKs. | |
Enable Logging | Enabling this generates code in the SDKs for logging events in the API cycle using a library. Logger can be configured in the SDK. | |
Sort Resources | Sorts resources such as endpoints, endpoint groups and models in generated documentation. Applies to both read-me files generated with SDKs as well as DX Portal-based documentation. | |
Do-Not-Split Words | Code Generation will not split these words when converting identifiers from API specification to language-specific identifiers. Only alphanumeric characters are allowed. For e.g. if you provide the words "apimatic" and "vmware" in your white list, APIMaticandvmWare becomes ApimaticAndVmware or apimatic_and_vmware , depending on the case used in the SDK language. |
Configuration Settings
These configurations are pre dominantly platform specific settings choosing between different programming paradigms for that particular language
Setting | Description | Languages Applicable |
---|---|---|
Use AndroidManifest.xml | Configuration parameters are populated in the Android Manifest file if this option is enabled. | |
Disable Linting | Files/dependencies used for linting are not generated if this option is enabled. | |
Use AppInfo.plist | Configuration parameters are populated in the Appinfo.plist file if this option is enabled. | |
Use Properties File for Configuration | Loads SDK configuration from properties file when provided. | |
Generate CoreData | CoreData is a native framework for persistence in iOS. Enabling this option generates a CoreData model document combining all the models in the project. It also generates entity classes which are required for CoreData. | |
Enable PHP Composer Version String | Enable to add version component to composer.json file. This can cause conflicts with Git tag-based version publishing and should be used with caution. | |
Generate Advanced Docs | Generate advanced read me files. | |
ReturnCompleteHttpResponse | Return complete HTTP response including headers and status code. |
Continuous Integration Settings
Apimatic also generates configuration files for CI tools. The user can use these settings to toggle the generation of configuration file for specific CI tools.
Setting | Description | Languages Applicable |
---|---|---|
Generate AppVeyor | Enabling this option generates configuration file appveyor.yml for AppVeyor. | |
Generate CircleCI | Enabling this option generates configuration file circle.yml for CircleCI. | |
Generate Jenkins | Enabling this option generates configuration file Jenkinsfile for Jenkins. | |
Generate Travis | Enabling this option generates configuration file .travis.yml for Travis. |
Endpoint Settings
These configurations manage the endpoints specific behaviour in the generated SDKs.
Setting | Description | Languages Applicable |
---|---|---|
Collect Parameters | Enabling this option collects API endpoint parameters as collections instead of individual method parameters. | |
Nullify 404 | Enabling this would return null response on the HTTP status code 404. | |
Validate Required Parameters | Enabling this option validates required API endpoint parameters to be not null. Default values for required parameters are ignored. | |
Preserve Parameter Order | Enabling this attempts to preserve the parameter order in endpoints and models as defined by the user. | |
Allow Skipping SSL Certificate Verification | Create a configuration option in SDKs to optionally skip certificate verification when establishing HTTPS connections. | |
Timeout | This option specifies the duration (in seconds) after which requests would timeout. |
Model Settings
These configurations manage the model-specific behavior in the generated SDKs.
Setting | Description | Languages Applicable |
---|---|---|
Enable Additional Model Properties | Enabling this option allows models to have additional properties. If an endpoint response (with response-type of model) contains additional properties that are not part of the model definition, these will not be discarded during deserialization and serialization of the model. | |
Ignore Null Properties | Enabling this option ignore all null properties during serialization of a model as JSON. | |
Generate Models | Use maps instead of models when disabled. |
Code Branding Options
These settings allow white-labeling and personalization of SDKs.
Setting | Description | Languages Applicable |
---|---|---|
Brand Label | The specified brand label will be added to the header of all generated files. | |
C# Default Namespace | The default value of the root namespace to be used in C# SDKs. | |
Project Name | The name of the project for Generated SDKs. API name is used as the project name by default. | |
Client Interface Name | The class name of the client library interface. | |
Apply Customizations | Customer-specific customizations to be applied during SDK and doc generation. These keys are provided by APIMatic Support team where necessary. | |
User Agent | The user agent is added to the headers of all API calls to identify the sender of the request. You can add the language name of the SDK from which the call is made by including {language} in the value and the sanitized API version using {version} . | |
Java Package Name | The default value of the package name to be used in Java SDKs. | |
PHP Composer Package Name | Sets name in composer.json file for PHP SDKs. You must provide a string with the format your-vendor-name/package-name . | |
Java Group ID | Group ID to be used in Maven POM file generated in Java SDKs. Group ID must follow Java package name rules. |
API Monitoring Powered by Runscope
Runscope is a service which allows API providers to monitor their API. In case of any downtime or failing requests, Runscope will notify them so that the issue can be resolved at the earliest.
APIMatic partners with Runscope to enable API providers to inspect/debug all of the request and response data traveling back and forth from the clients using their SDKs.
Setting | Description |
---|---|
Enable Runscope | This flag enables API Monitoring and debugging using Runscope within the generated SDKs |
Bucket Key | This is the key that you'll get for a bucket (group of endpoints) from Runscope. |