Core SDK options
The core SDK options configure the basic settings, such as the location of the spec to use, the SDK languages to generate, and the authentication type to use. These options are set at the top level of the liblab config file.
Option | Type | Required | Default | Description |
---|---|---|---|---|
sdkName | string | ❌ 1 | N/A | The name of the SDK |
baseUrl | string | ❌ | "" | The base URL of the API |
specFilePath | string | ✅ | N/A | The path to the API spec, either a local path or a URL |
languages | array | ❌ | ["python", "typescript"] | The list of languages to generate SDKs for |
auth | array | ❌ | None | The type of authentication to use |
createDocs | bool | ❌ | false | Should developer documentation be generated? |
customizations | object | ❌ | N/A | Customizations to SDKs. See the SDK customization options documentation for more details |
languageOptions | object | ❌ | N/A | Language specific options for the SDKs. See the SDK language options documentation for more details |
publishing | object | ❌ | N/A | Publishing options for the SDKs. See the SDK publishing options documentation for more details |
validationsToIgnore | array | ❌ | N/A | A list of API spec validations to ignore. See the API spec validations options documentation for more details |
1 sdkName
is required if your spec file doesn't have the title
set. See the sdkName
section for more information.
sdkName
The sdkName
is used to set the name for your SDK. This name is used for the package name for the different SDKs, it is used to name the class that provides SDK access, and is used in the README and other documentation.
This name will be re-cased to be idiomatic for the SDK language. For example - if you set the sdkName
to Exciting-Soda
:
{
"sdkName": "Exciting-Soda"
...
}
You will get the following:
- TypeScript
- Python
- Java
The SDK will be in TypeScript package called excitingsoda
. The class you would use to access the SDK would be called ExcitingSoda
:
import { ExcitingSoda } from 'excitingsoda';
const sdk = new ExcitingSoda();
The SDK will be in Python package called excitingsoda
. The class you would use to access the SDK would be called ExcitingSoda
:
from excitingsoda import ExcitingSoda
sdk = ExcitingSoda()
The SDK will be in Maven package with a artifact Id of ExcitingSoda
. The class you would use to access the SDK would be called ExcitingSoda
:
import soda.exciting.ExcitingSoda;
public class Main {
public static void main(String[] args) {
ExcitingSoda client = new ExcitingSoda();
}
}
If this is not set, the SDK name is taken from the title
field in your API spec.
{
"openapi": "3.1.0",
"info": {
"title": "ExcitingSoda",
...
}
...
}
If the title
is also not set, the liblab build
command will raise an error.
baseUrl
The baseUrl
is the URL for your API. If this is not set, the SDK defaults to using first value that is found in the servers
object of your API spec.
Java SDK group Id
For Java SDKs, the baseUrl
is also used as the group Id, unless you set the groupId
language customization option. For example if you have:
{
...
"baseUrl": "https://exciting.soda"
...
}
Then your Java group Id will be soda.exciting
:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>soda.exciting</groupId>
...
</project>
This can be accessed from the soda.exciting
package:
package soda.exciting;
public class ExcitingSoda {
}
You can read more about configuring URLs and setting these at run time in our URLs and environments guide.
specFilePath
The specFile
is the path or URL of your spec file. This can be a local file, or a remote URL. For remote URLs, the liblab CLI will need to be able to access this file, so it will need to be public.
The spec file can be in JSON or YAML format. See our supported API specifications document for more information on the supported spec formats.
languages
The languages
setting is an array of the languages you want to generate SDKs for. You can find a list of the supported languages in our SDK language support document.
{
...
"languages": [
"java",
"python",
"typescript"
]
...
}
Language specific customizations can be set in the languageOptions
section of the config file.
If this setting is not set, the SDKs will be generated for all supported languages.
auth
The auth
setting defines the type of authentication used by your API. This setting is optional, and if not set, the SDKs will not include any authentication.
{
...
"auth": [
"apikey"
]
...
}
Valid values are:
Value | Description |
---|---|
apikey | API key authentication |
basic | Basic authentication |
bearer | Bearer token authentication |
You can have multiple values if your API supports multiple authentication types.
You can read more on authentication in our authentication guide.
createDocs
The createDocs
setting is a boolean that determines whether or not to generate documentation for your SDKs. Set this true
to automatically generate docs, or false
(the default) to skip this step.
{
...
"createDocs": true
...
}
You can read more about documentation generation in our documentation generation guide.