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
Additional dependencies
Method and parameter management
Security configuration
Import management
Error and response handling
Nullable and optional field handling
When it applies
The wrapper is generated only for fields that are:
- Optional (the property is not listed in the parent schema’s
required
array) - Nullable (the property
type
includes"null"
in OpenAPI 3.1)
For example, the following JSON Schema (OpenAPI 3.1) defines an optional, nullable nickname
:
Generated code
With nullableOptionalWrapper: true
, the corresponding Go model uses a wrapper type:
Without the wrapper (when disabled for existing SDKs), the same field may be generated as a pointer type.
Using the wrapper
Set values using helper constructors on OptionalNullable
and retrieve values via Get()
, which returns (*T, bool)
— ok
indicates presence, and a nil
pointer indicates an explicit null value:
Enabling this flag changes the generated field type and how values are set and read. This is a breaking change for existing SDKs and requires migrating code that accessed those fields directly or through pointer checks to use optionalnullable.From(...)
and .Get()
.
Last updated on