Go Configuration Options

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

Version and General Configuration

go:
version: 1.2.3
packageName: "custom-sdk"
NameRequiredDefault ValueDescription
versiontrue0.0.1The current version of the SDK.
packageNametrueopenapiThe Go module package name. See Go Module Path Documentation (opens in a new tab).

Additional Dependencies

go:
additionalDependencies:
dependencies:
axios: "^0.21.0"
NameRequiredDefault ValueDescription
additionalDependenciesfalse{}Specify additional dependencies to include in the generated go.mod.

Method and Paramater Management

go
maxMethodParams: 4
methodArguments: "require-security-and-request"
NameRequiredDefault ValueDescription
maxMethodParamsfalse4The maximum number of parameters a method can have before the resulting SDK endpoint is no longer “flattened” and an input object is created. 0 will use input objects always. Must match the regex pattern /^\d+$/.”
methodArgumentsfalserequire-security-and-requestDetermines how arguments for SDK methods are generated. Options: "infer-optional-args" or "require-security-and-request".

Security Configuratiaon

go
envVarPrefix: SPEAKEASY
flattenGlobalSecurity: true
NameRequiredDefault ValueDescription
clientServerStatusCodesAsErrorsfalsetrueWhether to treat 4xx and 5xx status codes as errors.
flattenGlobalSecurityfalsenewSDKFlatten the global security configuration if there is only a single option in the spec.

Import Management

go
imports:
paths:
callbacks: models/callbacks
errors: models/errors
operations: models/operations
shared: models/components
webhooks: models/webhooks
PathDefault ValueDescription
sharedmodels/componentsThe directory for shared components, such as reusable schemas and data models.
operationsmodels/operationsThe directory where operation models (i.e., API endpoints) will be imported from.
errorsmodels/sdkerrorsThe directory where error models will be imported from.
callbacksmodels/callbacksThe directory where callback models will be imported from.
webhooksmodels/webhooksThe directory where webhook models will be imported from.

Error and Response Handling

go:
responseFormat: "envelope-http"
NameRequiredDefault ValueDescription
responseFormatfalseenvelope-httpDetermines the shape of the response envelope that is returned from SDK methods. Must be envelope-http, envelope, or flat only.’