The liblab configuration file
The liblab config file, liblab.config.json
, contains configuration used by the liblab CLI to generate SDKs.
As a bare minimum, you need to set the location of your API spec in the config file:
{
"specFilePath": "https://exciting.soda/openapi.json"
}
You can then add additional options, such as the SDK languages you want to generate, or what authentication your API uses.
{
"specFilePath": "https://exciting.soda/openapi.json",
"languages": [
"python",
"typescript"
],
"auth": [
"bearer"
]
}
The config file containers a large number of options to allow you to customize the SDKs you generate. One of the most powerful features of liblab is this ability to get fine-grained control over the SDK generation process.
The liblab CLI uses a configuration file instead of extensions in your API spec to allow you to keep a separation between your spec and SDK generation. This provides one source for the configuration, and allows you to quickly make changes without having to redeploy your API if your spec is created by your API gateway.
The config file is created when you run the liblab init
command.
Structure of the configuration file
The config file defines the SDK to create along with configuration based off your API, and sections for generic customizations, language specific customizations, publishing, and configuring validation.
Expand to see an example config file
{
"sdkName": "ExcitingSoda",
"specFilePath": "https://exciting.soda/openapi.json",
"languages": [
"java",
"python",
"typescript"
],
"createDocs": true,
"auth": [
"bearer"
],
"customizations": {
"authentication": {
"access": {
"prefix": "Bearer"
}
},
"generateEnv": true,
"license": {
"type": "MIT"
},
"retry": {
"enabled": true,
"retryDelay": 150,
"maxAttempts": 3
},
},
"languageOptions": {
"typescript": {
"npmName": "ExcitingSoda",
"npmOrg": "ExcitingSoda",
"httpClient": "axios",
"bundle": true,
"exportClassDefault": true,
"githubRepoName": "exciting-soda-typescript-sdk",
"sdkVersion": "1.0.0"
},
"python": {
"pypiPackageName": "ExcitingSoda",
"alwaysInitializeOptionals": true,
"githubRepoName": "exciting-soda-python-sdk",
"sdkVersion": "1.0.0",
},
"java": {
"groupId": "soda.exciting",
"githubRepoName": "exciting-soda-java-sdk",
"sdkVersion": "1.0.0"
}
},
"publishing": {
"githubOrg": "exciting-soda"
}
}
Configuration file sections
Each section is described in more detail in the following documentation: