Speakeasy Logo
Skip to Content

Typescript Configuration Options

This section details the available configuration options for the TypeScript SDK. All configuration is managed in the gen.yaml file under the typescript section.

Version and general configuration

Name
version
Required
true
Default Value
0.0.1
Description
The current version of the SDK.
packageName
Required
true
Default Value
openapi
Description
The name of the npm package. See npm package guidelines .
author
Required
true
Default Value
Speakeasy
Description
The name of the author of the published package. See npm author field .

Additional JSON package

Name
additionalPackageJSON
Required
false
Default Value
{}
Description
Additional key/value pairs for the
file. Example: license, keywords, etc.

Additional dependencies

Name
dependencies
Required
false
Default Value
{}
Description
Additional production dependencies to include in the
.
devDependencies
Required
false
Default Value
{}
Description
Additional development dependencies to include in the
.
peerDependencies
Required
false
Default Value
{}
Description
Peer dependencies for compatibility.

Method and parameter management

Name
maxMethodParams
Required
false
Default Value
0
Description
Maximum number of parameters before an input object is created.
means input objects are always used.
flatteningOrder
Required
false
Default Value
parameters-first or body-first
Description
Determines the ordering of method arguments when flattening parameters and body fields.
methodArguments
Required
false
Default Value
require-security-and-request
Description
Determines how arguments for SDK methods are generated.

Security configuration

Property
flattenGlobalSecurity
Description
Enables inline security credentials during SDK instantiation. Recommended:
Type
boolean
Default
true
envVarPrefix
Description
Sets a prefix for environment variables that allows users to configure global parameters and security.
Type
string
Default
N/A

Module management

Name
useIndexModules
Required
false
Default Value
true
Description
Controls generation of index modules (
). Setting to
improves tree-shaking and build performance by avoiding barrel files.
moduleFormat
Required
false
Default Value
commonjs
Description
Sets the module format to use when compiling the SDK (
,
, or
). Using
provides optimal compatibility while enabling modern bundler optimizations.

Import management

Field
option
Required
false
Default Value
"openapi"
Description
Defines the type of import strategy. Typically set to
, indicating that the structure is based on the OpenAPI document.
paths
Required
false
Default Value
{}
Description
Customizes where different parts of the SDK (e.g., callbacks, errors, and operations) will be imported from.

Import paths

Component
callbacks
Default Value
models/callbacks
Description
The directory where callback models will be imported from.
errors
Default Value
models/errors
Description
The directory where error models will be imported from.
operations
Default Value
models/operations
Description
The directory where operation models (i.e., API endpoints) will be imported from.
shared
Default Value
models/components
Description
The directory for shared components, such as reusable schemas, and data models imported from the OpenAPI spec.
webhooks
Default Value
models/webhooks
Description
The directory for webhook models, if the SDK includes support for webhooks.

Error and response handling

Property
responseFormat
Description
Defines how responses are structured. Options:
,
, or
.
Type
string
Default
envelope-http
enumFormat
Description
Determines how enums are generated. Options:
(TypeScript enums) or
(union types).
Type
string
Default
union
clientServerStatusCodesAsErrors
Description
Treats
and
status codes as errors. Set to
to treat them as normal responses.
Type
boolean
Default
true

Last updated on