Serialization
The following CodeGen settings allow you to configure serialization and deserialization of values in APIMatic generated SDKs.
Array Serialization
This setting adds array serialization scheme for primitive types (applicable to form and query params).
Allowed values are: Indexed
, UnIndexed
, Plain
, CSV
, TSV
, PSV
. There are different ways of representing variable assignments in these formats:
Value | Details |
---|---|
Indexed | This type of variable assignment includes an index, denoted by square brackets, to indicate which element of an array should be assigned the specified value. For example, variableName[0]=value1 assigns the value value1 to the first element of the variableName array. |
UnIndexed | This type of variable assignment does not include an index and is used to add a new value to the end of an array. For example, variableName[]=value1 would append value1 to the end of the variableName array. |
Plain | This type of variable assignment is used for non-array variables and assigns a single value to the variable. Multiple assignments can be separated by & . For example, variableName=value1&variableName=value2 assigns the values value1 and value2 to the variableName variable. |
CSV | This type of variable assignment is similar to the Plain type, but multiple values are separated by commas without any variable names. For example, variableName=value1,value2 assigns the values value1 and value2 to the variableName variable. |
TSV | This type of variable assignment is similar to the CSV type, but the values are separated by tab \t character. For example, variableName=value1\tvalue2 assigns the values value1 and value2 to the variableName variable. |
PSV | This type of variable assignment is similar to the CSV type, but the values are separated by pipe | character. For example, variableName=value1|value2 assigns the values value1 and value2 to the variableName variable. |
Usage
To use this feature, you need to specify an ArraySerialization
value. By default, its value is set to Indexed
.
"info": {
...,
"x-codegen-settings": {
"ArraySerialization": "Indexed"
}
}
Language Support
C# | Java | PHP | Python | Ruby | TS | Go |
---|---|---|---|---|---|---|
✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
Enable JSON Pass Through for Any
Use this setting to decide whether JSON should be passed through any type in the SDK.
Usage
To use this feature, you need to specify a Boolean
value. By default, its value is set to false
.
"info": {
...,
"x-codegen-settings": {
"EnableJsonPassThroughForAny": false
}
}
Language Support
C# | Java | PHP | Python | Ruby | TS | Go |
---|---|---|---|---|---|---|
✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ❌ |
Change in SDK
Configuring this setting has the following effect on the generated SDK:
- C#
- Java
- PHP
- Python
- Ruby
- TypeScript
Value | Change |
true |
|
false (default) |
|
Value | Change |
true |
|
false (default) |
|
Value | Change |
true |
|
false (default) |
|
Value | Change |
true |
|
false (default) |
|
Value | Change |
true |
|
false (default) |
|
Value | Change |
true |
|
false (default) |
|