Skip to main content

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.

OptionTypeRequiredDefaultDescription
sdkNamestring1N/AThe name of the SDK
apiNamestring2N/AThe name of the API. If this is not set, this value is populated from the API spec.
apiVersionstring3N/AThe version of the API. If this is not set, this value is populated from the API spec.
baseUrlstring""The base URL of the API
specFilePathstringN/AThe path to the API spec, either a local path or a URL
languagesarray
[
"csharp",
"go",
"python",
"typescript"
]
The list of languages to generate SDKs for
autharrayNoneThe type of authentication to use
createDocsboolfalseShould developer documentation be generated?
customizationsobjectN/ACustomizations to SDKs. See the SDK customization options documentation for more details
languageOptionsobjectN/ALanguage specific options for the SDKs. See the SDK language options documentation for more details
publishingobjectN/APublishing options for the SDKs. See the SDK publishing options documentation for more details
validationsToIgnorearrayN/AA 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 or name set, depending on the spec type. See the sdkName section for more information.

2 apiName is required if your spec file doesn't have the title or name set, depending on the spec type. See the apiName section for more information.

3 apiVersion is required if your spec file doesn't have the version set. See the apiVersion section for more information.

sdkName

Supported SDK languages and versions:

TypeScript v1TypeScript v2JavaPython v1Python v2C#GoPHP

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:

liblab.config.json
{
"sdkName": "Exciting-Soda"
...
}

You will get the following:

The SDK will be in TypeScript package called excitingsoda.

package.json
{
"name": "excitingsoda",
}

The class you would use to access the SDK would be called ExcitingSoda:

src/index.ts
import { ExcitingSoda } from 'excitingsoda';

const sdk = new ExcitingSoda();

If the sdkName is not set, the SDK name is taken from the title field in your API spec.

openapi.json
{
"openapi": "3.1.0",
"info": {
"title": "ExcitingSoda",
...
}
...
}

If the title is also not set, the liblab build command will raise an error.

apiName

Supported SDK languages and versions:

TypeScript v1TypeScript v2JavaPython v1Python v2C#GoPHP

The name of the API. This is used to identify the API in the liblab portal. If the apiName is not set, the API name is taken from the name in the API spec.

For Swagger and OpenAPI specs, this is the title field in the info object.

spec.json
{
"openapi": "3.1.0",
"info": {
"title": "ExcitingSoda",
...
}
...
}

For Postman Collections this is the name field in the info object.

postman-collection.json
{
"info": {
"name": "ExcitingSoda",
...
}
...
}

The API name is a required field for Swagger, OpenAPI and Postman Collections, so if this is not set in either the config file or the spec, an error will be raised.

apiVersion

Supported SDK languages and versions:

TypeScript v1TypeScript v2JavaPython v1Python v2C#GoPHP

The version of the API. This is used to identify the API in the liblab web portal. If the apiVersion is not set, the API version is taken from the version in the API spec.

For Swagger and OpenAPI specs, this is the version field in the info object.

spec.json
{
"openapi": "3.1.0",
"info": {
"title": "ExcitingSoda",
"version": "1.0.1"
...
}
...
}

For Postman Collections this is the version field in the info object.

postman-collection.json
{
"info": {
"name": "ExcitingSoda",
"version": "1.0.1"
...
}
...
}

The API name is a required field for Swagger and OpenAPI, but is not a required field for Postman Collections. Although this field is not required in the liblab config file, If this is not set in either the config file or the spec, an error will be raised as a value for the version is required to generate an SDK.

baseUrl

Supported SDK languages and versions:

TypeScript v1TypeScript v2JavaPython v1Python v2C#GoPHP

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:

liblab.config.json
{
...
"baseUrl": "https://exciting.soda"
...
}

Then your Java group Id will be soda.exciting:

pom.xml
<?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:

main/java/soda/exciting/ExcitingSoda.java
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

Supported SDK languages and versions:

TypeScript v1TypeScript v2JavaPython v1Python v2C#GoPHP

The specFilePath 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

Supported SDK languages and versions:

TypeScript v1TypeScript v2JavaPython v1Python v2C#GoPHP

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.

liblab.config.json
{
...
"languages": [
"java",
"python",
"typescript",
"csharp",
"go",
"terraform"
]
...
}

Language specific customizations can be set in the languageOptions section of the config file.

auth

Supported SDK languages and versions:

TypeScript v1TypeScript v2JavaPython v1Python v2C#GoPHP

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.

liblab.config.json
{
...
"auth": [
"apikey"
]
...
}

Valid values are:

ValueDescription
apikeyAPI key authentication, passing an API key as a header to all API calls.
basicBasic authentication, passing a username and password in the Authentication header to all API calls.
bearerBearer token authentication, passing a bearer token in the Authentication header to all API calls, with the value prefixed with bearer.
customCustom access token authentication, passing an access token in the Authentication header to all API calls, with the value prefixed with a custom prefix.

You can have multiple values if your API supports multiple authentication types, as long as they don't conflict with each other.

For example, both Basic authentication and Bearer token authentication both use the Authentication header in your API, so you can't have both of these set at the same time.

These auth options can be further customized using the authentication section of the customizations options, for example, setting the API key header, or the access token prefix.

You can read more on authentication in our authentication guide.

createDocs

Supported SDK languages and versions:

TypeScript v1TypeScript v2JavaPython v1Python v2C#GoPHP

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.

liblab.config.json
{
...
"createDocs": true
...
}

You can read more about documentation generation in our documentation generation guide.