Skip to main content

Configure CodeGen Settings

You can import your API definition file along with a Metadata file that will allow you to configure various CodeGen and import settings for your API. The details on the available code generation settings is available at Code Generation Settings. These can be specified in the form of an object as described below:

Code Generation Object

Name : CodeGenSettings

The available properties and their respective types are as follows:

SettingTypePurpose
SynchronyModeNumber. Could be 0 or 1.0 represents Asynchronous while 1 represents Synchronous. When Asynchronous, the CodeGen engine generates asynchronous C# and Java code.
ArraySerializationStringArray serialisation scheme for primitive types (applicable to form and query params). Allowed values are Indexed, UnIndexed, Plain, CSV, TSV, PSV
UseHttpMethodPrefixBooleanWhen true, HTTP verbs are used as prefix for generated controller methods.
UseModelPrefixBooleanWhen true, a postfix "Model" is appended to all classes generated from schemas.
UseEnumPrefixBooleanWhen true, a postfix "Enum" is appended to all enumerations lifted from "allowedValues".
AppendContentHeadersBooleanWhen true, code generation engine automatically detects request and response schema and appends content headers e.g., "accept: application/json" and "content-type: application/json" headers for JSON serialization mode.
UseCommonSDKLibraryBooleanWhen true, a common library comprising of common classes is used by the generated SDKs
UseControllerPrefixBooleanWhen true, a postfix "Controller" is appended to all controllers generated from path groups.
GenerateInterfacesBooleanWhen true, interfaces for controller classes are generated in the generated SDKs
PreserveParameterOrderBooleanWhen true, parameter order is tried to be preserved in endpoints and models
AndroidUseAppManifestBooleanWhen true, configuration values e.g., authentication credentials, are expected in AndroidManifest.xml file for the Android SDK. When set, this setting ignores useConstructorsForConfig flag.
EnablePHPComposerVersionStringBooleanWhen true, adds version component to composer.json file in PHP SDKs. This can cause conflicts with Git tag-based version publishing and should be used with care.
EnableJsonPassThroughForAnyBooleanSpecifies whether JSON should be passed through any type in the SDK.
iOSUseAppInfoPlistBooleanWhen true, configuration values e.g., authentication credentials, are expected in app-info.plist file for the iOS SDK. When set, this setting ignores useConstructorsForConfig flag.
iOSGenerateCoreDataBooleanWhen true, iOS CoreData schema and classes are generated.
CollapseParamsToArrayBooleanWhen true, collapse more than 3 parameters into an options arrays
Nullify404BooleanWhen true, null response will be returned on the HTTP status code 404
ValidateRequiredParametersBooleanWhen true, required API endpoint parameters are validated to be not null
PreserveParameterOrderBooleanWhen true, parameter order is tried to be preserved in endpoints and models
TimeoutFloatWhen true the requests will timeout after the specified duration
EnableAdditionalModelPropertiesBooleanWhen true, additional or unknown properties in the response JSON are collected into a dictionary.
BrandLabelStringA string value to brand the generated files. For example: "Acme Corp."
UserAgentStringA string value to use as user-agent in the API calls. This is useful for analytics and tracking purposes. For example: "SDK V1.1"
ProjectNameStringThe name of the project for the Generated SDKs
CSharpNamespaceStringA valid C# namespace value to be used as the default namespace. Leave empty or null to automatically generate.
JavaPackageNameStringA valid Java package name to be used as the base package name. Leave empty or null to automatically generate. This value is applied for both Java and Android code generation templates.
RunscopeEnabledBooleanWhen true Runscope pass-through for traffic monitoring will be enabled
RunscopeBucketStringThis is the Runscope Bucket Key for traffic monitoring
GenerateTravisConfigBooleanWhen true, the Travis Configuration file will be generated along with the SDK
GenerateCircleConfigBooleanWhen true, the Circle Configuration file will be generated along with the SDK
GenerateAppveyorConfigBooleanWhen true, the Appveyor Configuration file will be generated along with the SDK
GenerateJenkinsConfigBooleanWhen true, the Jenkins Configuration file will be generated along with the SDK
StatusCodesToRetryIntegerConfigure the Http status codes to invoke retry on.
RequestMethodsToRetryHTTPVerbConfigure the Http request methods to invoke retry for.
ControllerPostfixBooleanSpecify custom postfix for controller names.
ControllerNamespaceBooleanSpecify name of controller namespace in SDK. Defaults to controllers in the CodeGen.
ReturnCompleteHttpResponseBooleanReturn complete http response including headers and status code.
ThrowForHttpErrorStatusCodesBooleanReturn status code and response instead of throwing an exception for error responses.
GenerateModelsBooleanUse maps instead of models when disabled.
GenerateEnumsBooleanWhether to generate exception classes for Exception Custom types defined by the user.
GenerateExceptionsBooleanWhether to generate exception classes for Exception Custom types defined by the user.
ResponseMappingResponseMappingStrategyAllows using a field of the response during deserialization, instead of the complete response.
SymbolizeHashKeysInRubyBooleanUses symbols instead of strings for hash keys in Ruby.
UsageExampleEndpointUsageExampleEndpointAllows choosing an endpoint to display its full usage example in the README. You can specify Description, EndpointGroupName, EndpointName.
IsLatestVersionBooleanEnabling this will hide version number from install commands and package repo links in the docs.
ShortCopyrightNoticeStringA copyright notice to prepend to all code files. Only for white-labelled SDKs.
CustomDependenciesStringAdd custom dependencies to the project.
LicenseTextStringLicense text to use in place of the standard MIT License.
EnableImmutableModelsBooleanWhether the models in the SDK should be immutable.
UseEndpointMethodNameBooleanUse the MethodName in the Endpoint entity to name endpoints instead of the Name property.
EncodeTemplateParametersBooleanWhether to encode endpoint level template parameters. Can be overridden at the parameter level.
GenerateExamplesForOptionalFieldsBooleanSet this to true to include optional fields during sample value generation.
MultitargetDotnetVersionsBooleanWhether multiple target frameworks are to be used.
BackoffMaxFloatThe maximum back off time.
RetryOnTimeoutBooleanWhen true, specifies whether to retry on request timeout or not.
EnableRetriesBooleanWhen true, enables the retries and backoff feature.
NumberOfRetriesIntegerTells about the number of retries to make. For example: "3".
RetryIntervalFloatStates the retry time interval between the endpoint calls.For example: "1".
BackOffFactorFloatUse this as exponential backoff factor to increase interval between retries.For example: "2".
MaximumRetryWaitTimeIntegerShows the maximum wait time in seconds for overall retrying requests.For example: "120".
HttpStatusCodesToRetryArraySpecifies the Http status codes to retry against. Values could be: "408, 413, 429, 500, 502, 503, 504, 521, 522, 524".
HttpMethodsToRetryArraySpecifies the Http methods to retry against. Allowed values are: "GET, PUT".
EnableGlobalUserAgentBooleanStates whether to send the UserAgent header or not.
ClientInterfaceNameStringDescribes the name of the client in the SDK.
GenerateInterfacesBooleanGenerates interfaces for controller classes.
EnableLoggingBooleanEnables generation of logging code in SDK.
AllowSkippingSSLCertVerificationBooleanAllows clients the option to make insecure endpoint calls that do not verify SSL certificate when using HTTPs.
DoNotSplitWordsStringShows list of words that should not be split, regardless of the capitalisation.
RetriesNumberNumber of retries for calling an idempotent endpoint after which endpoint call should fail. Could be O.
ForceKeywordArgsInRubyBooleanUses keyword arguments for required parameters when set to true and positional arguments when set to false.
JavaGroupIdStringJava Groupid used by package managers such as POM and Gradle.
JavaArtifactIdStringJava ArtifactId used by package managers such as POM and Gradle.
PHPComposerPackageNameStringOptional package name for composer file generated for PHP.
PHPNamespaceStringRoot namespace for the PHP SDKs.
EnableHttpCacheBooleanEnable HTTP caching for idempotent endpoint methods.
UserConfigurableRetriesBooleanTells whether SDK users should be able to configure retries.
DisableDocsBooleanDisables read-me file generation for SDKs (including any other SDK documentation files).
StoreTimezomeInformationBooleanStores timezone information with date-time types. Otherwise, SDKs will attempt to convert all date-times to UTC.
DisableLintingBooleanDisables generation of linting config and test code.
IgnoreIfNullJsonBooleanIgnores all null properties during serialization of models as JSON in the generated SDKs.
UseSingletonPatternBoolean
LiftParameterDescriptionFromCustomTypeBoolean
SortResourcesBooleanThis sorts endpoint groups, endpoints and models during code generation (SDKs and docs).
ApplyCustomizationsStringEach customization is a customer-specific key. It triggers specific customization in codegen and dependent projects.

Example

{
"CodeGenSettings": {
"SynchronyMode": 0,
"ModelSerializationScheme": "Json",
"ArraySerialization": "Indexed",
"Nullify404": true,
"UseHttpMethodPrefix": true,
"UseModelPrefix": true,
"UseExceptionPrefix": true,
"UseEnumPrefix": true,
"UseControllerPrefix": true,
"UseConstructorsForConfig": true,
"Timeout": 0.1,
"AndroidUseAppManifest": true,
"iOSUseAppInfoPlist": true,
"iOSGenerateCoreData": true,
"CollapseParamsToArray": true,
"RunscopeEnabled": true,
"RunscopeBucket": "key",
"AndroidHttpClient": "UNIREST",
"ObjCHttpClient": "UNIREST",
"CSharpHttpClient": "UNIREST",
"CSharpNamespace": "Root",
"JavaPackageName": "Root",
"JavaUsePropertiesConfig": false,
"PHPHttpClient": "UNIREST",
"BrandLabel": "Label",
"UserAgent": "User",
"ProjectName": "Calculator",
"EnableAdditionalModelProperties": true,
"PreserveParameterOrder": true,
"ValidateRequiredParameters": true,
"AppendContentHeaders": true,
"GenerateInterfaces": true,
"UseCommonSDKLibrary": true,
"ParameterArrayFormat": 2,
"UsageExampleEndpoint": {
"Description": "Endpoint description here",
"EndpointGroupName": "Calculator",
"EndpointName": "OperationGet"
},
"GenerateTravisConfig": true,
"GenerateCircleConfig": true,
"GenerateAppveyorConfig": true,
"GenerateJenkinsConfig": true,
"EnableLogging": false,
"EnableHttpCache": false,
"EnablePHPComposerVersionString": false,
"EnableRetries": false,
"EnableGlobalUserAgent": true,
"NumberOfRetries": 3,
"RetryInterval": 1,
"BackOffFactor": 2,
"MaximumRetryWaitTime": 120,
"RetryOnTimeout": true,
"HttpStatusCodesToRetry": 413,
"HttpMethodsToRetry": "GET",
"Retries": 0,
"DisableDocs": false,
"StoreTimezoneInformation": false,
"GenerateInterfaces": true,
"IgnoreIfNullJson": false,
"DisableLinting": false,
"SortResources": false,
"LiftParameterDescriptionFromCustomType": false,
"AllowSkippingSSLCertVerification": false,
"ForceKeywordArgsInRuby": false
}
}