Skip to main content

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

SettingDescription
Return Complete HTTP ResponseThis setting returns complete HTTP response including headers and status code.
Use HTTP Method PrefixThis setting allows to prefix the HTTP method Get, Update, or Delete to the name of the methods.
Encode Template ParametersThis setting encodes endpoint level parameters.
Validate Required ParametersThis setting validates required API endpoint parameters to be not null.
Collapse Params to ArrayThis setting collapses more than 1 parameters into an options array.
Use Endpoint Method NameUse the MethodName in the endpoint entity to name endpoints instead of the Name property.
Nullify 404This setting returns null response on the HTTP status code 404 instead of throwing an exception.
Lift Parameter Description from Custom TypeThis setting adds a custom type's description as parameter description when a parameter referencing has missing description.
Force Keywords Arguments in RubyThis setting decides whether to use keyword arguments for required parameters or positional arguments.

Model Settings

SettingDescription
Enable Additional Model PropertiesThis setting allows to add additional properties of models that are not part of the model description.
Use Model PrefixThis setting allows to postfix each model class with the word "Model".
Generate ModelsThis setting allows to switch between using models and maps.
Enable Immutable ModelsThis setting controls whether the models in the SDK should be immutable or not.
Ignore If Null JSONThis setting ignores all null properties during JSON serialization of a model in the generated SDKs.

Enum Settings

SettingDescription
Generate EnumsThis setting converts enums to native types.
Use Enum PrefixThis setting allows to postfix each enum class with the word "Enum".

Package Configuration

SettingDescription
Multitarget Dotnet VersionsThis setting decides whether to use multiple target frameworks or not.
Java Group IDThis setting sets the GroupId to be used in Maven POM file generated in Java SDKs.
Java Artifact IDThis setting sets the Java ArtifactId used by package managers.
PHP Composer Package NameThis setting sets name in composer.json file for PHP SDKs.
Enable PHP Composer Version StringThis setting adds version component to the composer.json file in PHP SDKs.

HTTP Configuration

SettingDescription
Enable HTTP CacheThis setting allows to enable/disable HTTP caching for idempotent endpoint methods.
Append Content HeadersEnable this setting to automatically determine the request and response content types and append appropriate "accept" and "content-type" headers.
Allow Skipping SSL certificate VerificationThis setting creates a configuration option in SDKs to optionally skip certificate verification when establishing HTTPs connections.
Throw for HTTP Error Status CodesDisable this setting to return status code and response instead of throwing an exception for error responses.

SDK Interface Customization

SettingDescription
Project NameThis setting sets the name of the project for generated SDKs.
C# NamespaceThis setting uses the default value of root namespace in C# SDKs.
Java Package NameThis setting sets the default value of the package name to be used in Java SDKs.
PHP NamespaceThis setting uses the root namespace for PHP SDKs.
Use Controller PrefixEnable this setting to postfix each controller class with the word "Controller".
Controller PostfixThis setting takes a value to postfix to the Endpoint Group names.
Controller NamespaceThis setting specifies name of controller namespace in SDKs.
Generate InterfacesEnable this setting to generate interfaces for controller classes in the generated SDKs.
Client Interface NameThis setting sets the class name of the client library interface.
Do Not Split WordsThis setting lists words that should not be split, regardless of the capitalization.
Synchronous Mode of CodeEnable this setting to generate asynchronous code and disable it for synchronous code.
Enable LoggingEnable this setting to generate code in the SDKs for logging events in the API cycle using a library.
Symbolize Hash Keys in RubyEnable this setting to use symbols instead of strings for hash keys in Ruby SDKs.
Underscore NumbersThis setting adds underscores before and after numbers in the generated SDKs.

Timeout and Retries

SettingDescription
TimeoutThis setting specifies the duration (in seconds) after which requests would fail.
Retry On TimeoutEnable this setting to retry request on timeout.
Request HTTP Methods to RetryThis setting specifies the HTTP methods to retry again.
Status Codes to RetryThis setting specifies the HTTP status codes to invoke retry on.
Maximum Retry Wait LimitThis setting sets the maximum wait time in seconds for overall retrying requests.
Number of RetriesThis setting sets the number of retries to make for calling an idempotent endpoint after which the endpoint should fail.
Retry IntervalThis setting sets the retry time interval between endpoint calls.
User Configurable RetriesThis setting decides if SDK users should be able to configure retries.
Backoff FactorThis setting adds an exponential backoff factor to increase interval between retries.

Serialization Settings

SettingDescription
Array SerializationThis setting decides array serialization scheme for primitive types.
Enable JSON Pass Through for AnyThis setting decides whether JSON should be passed through any type in the SDK.

User Agent Settings

SettingDescription
Enable Global User AgentUse this setting to enable/disable sending the UserAgent field in the user-agent header.
User AgentUse this setting to add the user agent to the header of the API calls to identify the sender of the request.

Code Branding Settings

SettingDescription
Brand LabelEnable this setting to add a brand label to the header of the generated files.
Short Copyright NoticeEnable this setting to set a copyright notice to prepend to all code files.

SDK Docs Configuration

SettingDescription
Disable DocsUse this setting to disable README file generation for SDKs including any other SDK documentation files.
Generate Examples for Optional FieldsUse this setting to include optional fields during sample value generation.
Is Latest VersionUse this setting to hide version number from install commands and package repo links in the docs.
Usage Example EndpointUse this setting to choose an endpoint to display its full usage example in the README file.
Sort ResourcesUse this setting to sort resources such as endpoints, endpoint groups, and models in the generated documentation.

Exception Settings

SettingDescription
Generate ExceptionsEnable this setting to generate exception classes for Exception Custom types defined by the user.

Miscellaneous Settings

SettingDescription
Disable LintingThis setting allows to use generate files/dependencies for linting.
Disable Multiple AuthThis setting allows you to disable multiple authentication support.
Add Single Auth Deprecated CodeThis setting allows you to remove all the deprecated code related to single authentication credentials setup from the SDKs.
Use Java Properties ConfigThis setting loads SDK configuration from Java properties file.
License TextThis setting sets the license text to use in place of the standard MIT license.
Store Timezone InformationThis setting stores timezone information with date-time types.
Apply CustomizationsThis setting sets customer-specific customizations to be applied during SDK and docs generation.
Custom DependenciesThis setting adds custom dependencies to the project.