Go Configuration
You can customize the behavior of the Go SDK generator in generators.yml
:
SDK Configuration Options
alwaysSendRequiredProperties
clientConstructorName
clientName
exportedClientName
importPath
Use this option if you plan to depend on the generated Go SDK from within your project, and not depend on it as a separate, published Go module.
module
configuration option instead.You can generate the Go SDK code into a gen/go/api
package with the following generators.yml
configuration:
<YOUR_ORGANIZATION>
and <YOUR_REPOSITORY>
placeholders
with the relevant elements in your go.mod
path. In this case, the generated Go SDK uses the same go.mod
path used by the rest of your Go module.includeLegacyClientOptions
inlineFileProperties
inlinePathParameters
module
Use this option if you plan to distribute the generated Go SDK as a separate, published Go module.
importPath
configuration option instead.You can generate the Go SDK code into a separate module (defined with its own go.mod
)
with the following generators.yml
configuration:
This configuration will generate a go.mod
alongside the rest of the Go SDK code at the target output
location. With this, import
statements within the generated Go SDK are all resolved from the configured
module path.
By default, the generated go.mod
will be set to 1.13
. You can override this behavior by specifying
the version
key:
If you want to depend on the generated Go SDK locally (without distributing it as a separate Go module),
and you use the module
configuration option, you will need to modify your project’s top-level go.mod
to include a replace
statement: