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"
Name | Required | Default Value | Description |
---|---|---|---|
version | true | 0.0.1 | The current version of the SDK. |
packageName | true | openapi | The Go module package name. See Go Module Path Documentation (opens in a new tab). |
Additional Dependencies
go: additionalDependencies: dependencies: axios: "^0.21.0"
Name | Required | Default Value | Description |
---|---|---|---|
additionalDependencies | false | {} | Specify additional dependencies to include in the generated go.mod . |
Method and Paramater Management
go maxMethodParams: 4 methodArguments: "require-security-and-request"
Name | Required | Default Value | Description |
---|---|---|---|
maxMethodParams | false | 4 | The 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+$/ ." |
methodArguments | false | require-security-and-request | Determines how arguments for SDK methods are generated. Options: "infer-optional-args" or "require-security-and-request" . |
Security Configuratiaon
go envVarPrefix: SPEAKEASY flattenGlobalSecurity: true
Name | Required | Default Value | Description |
---|---|---|---|
clientServerStatusCodesAsErrors | false | true | Whether to treat 4xx and 5xx status codes as errors. |
flattenGlobalSecurity | false | newSDK | Flatten 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
Path | Default Value | Description |
---|---|---|
shared | models/components | The directory for shared components, such as reusable schemas and data models. |
operations | models/operations | The directory where operation models (i.e., API endpoints) will be imported from. |
errors | models/sdkerrors | The directory where error models will be imported from. |
callbacks | models/callbacks | The directory where callback models will be imported from. |
webhooks | models/webhooks | The directory where webhook models will be imported from. |
Error and Response Handling
go: responseFormat: "envelope-http"
Name | Required | Default Value | Description |
---|---|---|---|
responseFormat | false | envelope-http | Determines the shape of the response envelope that is returned from SDK methods. Must be envelope-http , envelope , or flat only.' |