Documentation
¶
Index ¶
- Constants
- Variables
- func FindConfigFile(dir string, fileSystem FS) (*workspace.FindWorkspaceResult, error)
- func FormatGithubSecret(secret string) string
- func FormatGithubSecretName(name string) string
- func GetConfigChecksum(dir string, opts ...Option) (string, error)
- func GetTemplateVersion(dir, target string, opts ...Option) (string, error)
- func SaveConfig(dir string, cfg *Configuration, opts ...Option) error
- func SaveLockFile(dir string, lf *LockFile, opts ...Option) error
- type AllOfMergeStrategy
- type Auth
- type Config
- type Configuration
- type DevContainers
- type Examples
- type FS
- type Fixes
- type Force
- type GenerateOn
- type GenerateWorkflow
- type GeneratedTests
- type Generation
- type GetLanguageDefaultFunc
- type Inputs
- type InputsTesting
- type Job
- type Jobs
- type LanguageConfig
- type LockFile
- type LockfileOption
- type Management
- type MockServer
- type OperationExamples
- type Option
- func WithDontWrite() Option
- func WithFileSystem(fs FS) Option
- func WithLanguageDefaultFunc(f GetLanguageDefaultFunc) Option
- func WithLanguages(langs ...string) Option
- func WithTransformerFunc(f TransformerFunc) Option
- func WithUpgradeFunc(f UpgradeFunc) Option
- func WithValidateFunc(f ValidateFunc) Option
- type OptionalPropertyRenderingOption
- type ParameterExamples
- type Permissions
- type PersistentEdits
- type PersistentEditsEnabled
- type PublishOn
- type PublishWorkflow
- type PullRequestOn
- type Push
- type PushCodeSamplesOnly
- type SDKGenConfigField
- type SDKInitStyle
- type Schedule
- type Schemas
- type ServerIndex
- type SetVersion
- type TagOn
- type TaggingWorkflow
- type Target
- type TestingOn
- type TestingWorkflow
- type Tests
- type TrackedFile
- type TrackedFiles
- type TransformerFunc
- type UpgradeFunc
- type UsageSnippets
- type ValidateFunc
- type WorkflowDispatch
- type WorkflowDispatchEmpty
- type WorkflowDispatchTesting
Constants ¶
View Source
const ( Version = v2 GithubWritePermission = "write" // Constants to be used as keys in the config files Languages = "languages" Mode = "mode" GithubAccessToken = "github_access_token" SpeakeasyApiKey = "speakeasy_api_key" SpeakeasyServerURL = "speakeasy_server_url" OpenAPIDocAuthHeader = "openapi_doc_auth_header" OpenAPIDocAuthToken = "openapi_doc_auth_token" OpenAPIDocs = "openapi_docs" DefaultGithubTokenSecretName = "GITHUB_TOKEN" DefaultSpeakeasyAPIKeySecretName = "SPEAKEASY_API_KEY" )
Variables ¶
View Source
var ErrFailedUpgrade = errors.New("failed to upgrade config")
Functions ¶
func FindConfigFile ¶ added in v1.10.0
func FindConfigFile(dir string, fileSystem FS) (*workspace.FindWorkspaceResult, error)
func FormatGithubSecret ¶ added in v1.14.8
func FormatGithubSecretName ¶ added in v1.14.8
func GetConfigChecksum ¶ added in v1.5.0
func GetTemplateVersion ¶ added in v1.6.1
func SaveConfig ¶ added in v1.5.0
func SaveConfig(dir string, cfg *Configuration, opts ...Option) error
Types ¶
type AllOfMergeStrategy ¶ added in v1.36.0
type AllOfMergeStrategy string
const ( AllOfMergeStrategyDeepMerge AllOfMergeStrategy = "deepMerge" AllOfMergeStrategyShallowMerge AllOfMergeStrategy = "shallowMerge" )
type Auth ¶ added in v1.7.3
type Auth struct {
OAuth2ClientCredentialsEnabled bool `yaml:"oAuth2ClientCredentialsEnabled" description:"Enables support for OAuth2 client credentials grant type"`
OAuth2PasswordEnabled bool `yaml:"oAuth2PasswordEnabled" description:"Enables support for OAuth2 resource owner password credentials grant type"`
HoistGlobalSecurity bool `` /* 144-byte string literal not displayed */
// contains filtered or unexported fields
}
type Config ¶
type Config struct {
Config *Configuration
ConfigPath string
LockFile *LockFile
}
type Configuration ¶ added in v1.5.0
type Configuration struct {
ConfigVersion string `yaml:"configVersion" description:"The version of the configuration file" minLength:"1" required:"true"`
Generation Generation `yaml:"generation" required:"true"`
Languages map[string]LanguageConfig `yaml:",inline" jsonschema:"-"`
New map[string]bool `yaml:"-"`
// contains filtered or unexported fields
}
Ensure you update schema/gen.config.schema.json on changes
func GetDefaultConfig ¶
func GetDefaultConfig(newSDK bool, getLangDefaultFunc GetLanguageDefaultFunc, langs map[string]bool) (*Configuration, error)
func (*Configuration) GetGenerationFieldsMap ¶ added in v1.5.0
func (c *Configuration) GetGenerationFieldsMap() (map[string]any, error)
type DevContainers ¶ added in v0.8.2
type DevContainers struct {
Enabled bool `yaml:"enabled" description:"Whether dev containers are enabled"`
// This can be a local path or a remote URL
SchemaPath string `yaml:"schemaPath" description:"Path to the schema file for the dev container"`
AdditionalProperties map[string]any `yaml:",inline" jsonschema:"-"` // Captures any additional properties that are not explicitly defined for backwards/forwards compatibility
// contains filtered or unexported fields
}
type Fixes ¶ added in v1.4.0
type Fixes struct {
NameResolutionDec2023 bool `yaml:"nameResolutionDec2023,omitempty" description:"Enables name resolution fixes from December 2023"`
NameResolutionFeb2025 bool `yaml:"nameResolutionFeb2025" description:"Enables name resolution fixes from February 2025"`
ParameterOrderingFeb2024 bool `yaml:"parameterOrderingFeb2024" description:"Enables parameter ordering fixes from February 2024"`
RequestResponseComponentNamesFeb2024 bool `` /* 128-byte string literal not displayed */
SecurityFeb2025 bool `yaml:"securityFeb2025" description:"Enables fixes and refactoring for security that were introduced in February 2025"`
AdditionalProperties map[string]any `yaml:",inline" jsonschema:"-"` // Captures any additional properties that are not explicitly defined for backwards/forwards compatibility
// contains filtered or unexported fields
}
func (*Fixes) UnmarshalYAML ¶ added in v1.30.5
type GenerateOn ¶ added in v0.4.2
type GenerateOn struct {
WorkflowDispatch WorkflowDispatch `yaml:"workflow_dispatch"`
Schedule []Schedule `yaml:"schedule,omitempty"`
PullRequest PullRequestOn `yaml:"pull_request,omitempty"`
}
type GenerateWorkflow ¶ added in v0.4.2
type GenerateWorkflow struct {
Name string `yaml:"name"`
Permissions Permissions `yaml:"permissions,omitempty"`
On GenerateOn `yaml:"on"`
Jobs Jobs `yaml:"jobs"`
}
func DefaultGenerationFile ¶ added in v1.14.8
func DefaultGenerationFile() *GenerateWorkflow
type GeneratedTests ¶ added in v1.25.0
type GeneratedTests = lockfile.GeneratedTests
type Generation ¶
type Generation struct {
DevContainers *DevContainers `yaml:"devContainers,omitempty"`
BaseServerURL string `` /* 143-byte string literal not displayed */
SDKClassName string `yaml:"sdkClassName,omitempty" description:"Generated name of the root SDK class"`
MaintainOpenAPIOrder bool `yaml:"maintainOpenAPIOrder,omitempty" description:"Maintains the order of parameters and fields in the OpenAPI specification"`
DeduplicateErrors bool `yaml:"deduplicateErrors,omitempty" description:"Deduplicates errors that have the same schema"`
UsageSnippets *UsageSnippets `yaml:"usageSnippets,omitempty"`
UseClassNamesForArrayFields bool `` /* 126-byte string literal not displayed */
Fixes *Fixes `yaml:"fixes,omitempty"`
Auth *Auth `yaml:"auth,omitempty"`
SkipErrorSuffix bool `yaml:"skipErrorSuffix,omitempty" description:"Skips the automatic addition of an error suffix to error types"`
InferSSEOverload bool `` /* 199-byte string literal not displayed */
SDKHooksConfigAccess bool `yaml:"sdkHooksConfigAccess,omitempty" description:"Enables access to the SDK configuration from hooks"`
Schemas Schemas `yaml:"schemas"`
RequestBodyFieldName string `yaml:"requestBodyFieldName" description:"The name of the field to use for the request body in generated SDKs"`
// Mock server generation configuration.
MockServer *MockServer `yaml:"mockServer,omitempty"`
// PersistentEdits configures whether user edits persist across regenerations
PersistentEdits PersistentEdits `yaml:"persistentEdits"`
Tests Tests `yaml:"tests,omitempty"`
AdditionalProperties map[string]any `yaml:",inline" jsonschema:"-"` // Captures any additional properties that are not explicitly defined for backwards/forwards compatibility
// contains filtered or unexported fields
}
type GetLanguageDefaultFunc ¶
type GetLanguageDefaultFunc func(string, bool) (*LanguageConfig, error)
type Inputs ¶ added in v0.4.2
type Inputs struct {
Force Force `yaml:"force"`
PushCodeSamplesOnly *PushCodeSamplesOnly `yaml:"push_code_samples_only,omitempty"`
SetVersion *SetVersion `yaml:"set_version,omitempty"`
Target *Target `yaml:"target,omitempty"`
}
type InputsTesting ¶ added in v1.30.3
type InputsTesting struct {
Target Target `yaml:"target"`
}
type LanguageConfig ¶
type LockFile ¶ added in v1.5.0
func LoadLockfile ¶ added in v1.43.0
func NewLockFile ¶ added in v1.5.0
func NewLockFile() *LockFile
type LockfileOption ¶ added in v1.43.0
type LockfileOption = lockfile.LoadOption
func WithLockfileFileSystem ¶ added in v1.43.0
func WithLockfileFileSystem(fs FS) LockfileOption
type Management ¶
type Management = lockfile.Management
type MockServer ¶ added in v1.19.0
type MockServer struct {
// Disables the code generation of the mockserver target.
Disabled bool `yaml:"disabled" description:"Disables the code generation of the mock server target"`
// contains filtered or unexported fields
}
Generation configuration for the inter-templated mockserver target for test generation.
type OperationExamples ¶ added in v1.20.0
type OperationExamples = lockfile.OperationExamples
type Option ¶
type Option func(*options)
func WithDontWrite ¶ added in v1.10.0
func WithDontWrite() Option
func WithFileSystem ¶ added in v1.10.0
func WithLanguageDefaultFunc ¶
func WithLanguageDefaultFunc(f GetLanguageDefaultFunc) Option
func WithLanguages ¶ added in v0.0.4
func WithTransformerFunc ¶ added in v0.8.4
func WithTransformerFunc(f TransformerFunc) Option
func WithUpgradeFunc ¶ added in v0.0.2
func WithUpgradeFunc(f UpgradeFunc) Option
func WithValidateFunc ¶ added in v1.16.0
func WithValidateFunc(f ValidateFunc) Option
type OptionalPropertyRenderingOption ¶ added in v1.2.0
type OptionalPropertyRenderingOption string
const ( OptionalPropertyRenderingOptionAlways OptionalPropertyRenderingOption = "always" OptionalPropertyRenderingOptionNever OptionalPropertyRenderingOption = "never" OptionalPropertyRenderingOptionWithExample OptionalPropertyRenderingOption = "withExample" )
type ParameterExamples ¶ added in v1.20.0
type ParameterExamples = lockfile.ParameterExamples
type Permissions ¶ added in v0.4.2
type PersistentEdits ¶ added in v1.43.0
type PersistentEdits struct {
// Enabled controls preservation of user edits:
// - "true": enables persistent edits
// - omitted/empty: disabled but will prompt on dirty detection
// - "never": disabled and will never prompt
Enabled *PersistentEditsEnabled `` /* 152-byte string literal not displayed */
AdditionalProperties map[string]any `yaml:",inline" jsonschema:"-"` // Captures any additional properties
// contains filtered or unexported fields
}
PersistentEdits configures whether user edits to generated SDKs persist across regenerations When enabled, user changes are preserved via 3-way merge with Git tracking
func (*PersistentEdits) IsEnabled ¶ added in v1.43.0
func (p *PersistentEdits) IsEnabled() bool
IsEnabled returns true if persistent edits are enabled
func (*PersistentEdits) IsNever ¶ added in v1.43.0
func (p *PersistentEdits) IsNever() bool
IsNever returns true if persistent edits are explicitly set to never prompt
type PersistentEditsEnabled ¶ added in v1.43.0
type PersistentEditsEnabled string
PersistentEditsEnabled controls whether user edits persist across regenerations
const ( // PersistentEditsEnabledTrue enables persistent edits PersistentEditsEnabledTrue PersistentEditsEnabled = "true" // PersistentEditsEnabledNever disables persistent edits and prevents prompting PersistentEditsEnabledNever PersistentEditsEnabled = "never" )
type PublishOn ¶ added in v0.4.2
type PublishOn struct {
Push Push `yaml:"push"`
WorkflowDispatch *WorkflowDispatchEmpty `yaml:"workflow_dispatch,omitempty"`
}
type PublishWorkflow ¶ added in v0.4.2
type PublishWorkflow struct {
Name string `yaml:"name"`
Permissions Permissions `yaml:"permissions,omitempty"`
On PublishOn `yaml:"on"`
Jobs Jobs `yaml:"jobs"`
}
type PullRequestOn ¶ added in v1.30.20
type PullRequestOn struct {
Types []string `yaml:"types,omitempty"`
}
type PushCodeSamplesOnly ¶ added in v1.14.11
type SDKGenConfigField ¶ added in v1.0.0
type SDKGenConfigField struct {
Name string `yaml:"name" json:"name"`
Required bool `yaml:"required" json:"required"`
RequiredForPublishing *bool `yaml:"requiredForPublishing,omitempty" json:"required_for_publishing,omitempty"`
DefaultValue *any `yaml:"defaultValue,omitempty" json:"default_value,omitempty"`
Description *string `yaml:"description,omitempty" json:"description,omitempty"`
Language *string `yaml:"language,omitempty" json:"language,omitempty"`
SecretName *string `yaml:"secretName,omitempty" json:"secret_name,omitempty"`
ValidationRegex *string `yaml:"validationRegex,omitempty" json:"validation_regex,omitempty"`
ValidationMessage *string `yaml:"validationMessage,omitempty" json:"validation_message,omitempty"`
TestValue *any `yaml:"testValue,omitempty" json:"test_value,omitempty"`
}
func GetGenerationDefaults ¶ added in v1.0.0
func GetGenerationDefaults(newSDK bool) []SDKGenConfigField
type SDKInitStyle ¶ added in v1.30.21
type SDKInitStyle string
const ( SDKInitStyleConstructor SDKInitStyle = "constructor" SDKInitStyleBuilder SDKInitStyle = "builder" )
type Schemas ¶ added in v1.36.0
type Schemas struct {
AllOfMergeStrategy AllOfMergeStrategy `yaml:"allOfMergeStrategy" enum:"deepMerge,shallowMerge" description:"Controls how allOf schemas are merged"`
// contains filtered or unexported fields
}
type ServerIndex ¶ added in v1.43.0
type ServerIndex string
ServerIndex is a type that can be either a string (server ID) or an integer (server index)
func (ServerIndex) PrepareJSONSchema ¶ added in v1.43.0
func (ServerIndex) PrepareJSONSchema(schema *jsg.Schema) error
type SetVersion ¶ added in v1.14.12
type TagOn ¶ added in v1.14.11
type TagOn struct {
Push Push `yaml:"push"`
WorkflowDispatch WorkflowDispatchEmpty `yaml:"workflow_dispatch"`
}
type TaggingWorkflow ¶ added in v1.14.11
type TaggingWorkflow struct {
Name string `yaml:"name"`
Permissions Permissions `yaml:"permissions,omitempty"`
On TagOn `yaml:"on"`
Jobs Jobs `yaml:"jobs"`
}
type TestingOn ¶ added in v1.30.3
type TestingOn struct {
PullRequest Push `yaml:"pull_request"`
Push *Push `yaml:"push,omitempty"`
WorkflowDispatch WorkflowDispatchTesting `yaml:"workflow_dispatch"`
}
type TestingWorkflow ¶ added in v1.30.3
type TestingWorkflow struct {
Name string `yaml:"name"`
Permissions Permissions `yaml:"permissions,omitempty"`
On TestingOn `yaml:"on"`
Jobs Jobs `yaml:"jobs"`
}
type Tests ¶ added in v1.28.0
type Tests struct {
GenerateTests bool `yaml:"generateTests" description:"Enables generation of tests"`
GenerateNewTests bool `yaml:"generateNewTests" description:"Enables generation of new tests for any new operations in the OpenAPI specification"`
SkipResponseBodyAssertions bool `` /* 135-byte string literal not displayed */
AdditionalProperties map[string]any `yaml:",inline" jsonschema:"-"` // Captures any additional properties that are not explicitly defined for backwards/forwards compatibility
// contains filtered or unexported fields
}
type TrackedFile ¶ added in v1.43.0
type TrackedFile = lockfile.TrackedFile
type TrackedFiles ¶ added in v1.43.0
type TrackedFiles = lockfile.TrackedFiles
type TransformerFunc ¶ added in v0.8.4
type UpgradeFunc ¶
type UsageSnippets ¶ added in v1.2.0
type UsageSnippets struct {
OptionalPropertyRendering OptionalPropertyRenderingOption `` /* 142-byte string literal not displayed */
SDKInitStyle SDKInitStyle `` /* 126-byte string literal not displayed */
ServerToShowInSnippets ServerIndex `yaml:"serverToShowInSnippets,omitempty"` // If unset, no server will be shown, if an integer, use as server_idx, else look for a matching id
AdditionalProperties map[string]any `yaml:",inline" jsonschema:"-"` // Captures any additional properties that are not explicitly defined for backwards/forwards compatibility
// contains filtered or unexported fields
}
type ValidateFunc ¶ added in v1.16.0
type WorkflowDispatch ¶ added in v0.4.2
type WorkflowDispatch struct {
Inputs Inputs `yaml:"inputs"`
}
type WorkflowDispatchEmpty ¶ added in v1.23.4
type WorkflowDispatchEmpty struct{}
type WorkflowDispatchTesting ¶ added in v1.30.3
type WorkflowDispatchTesting struct {
Inputs InputsTesting `yaml:"inputs"`
}
Click to show internal directories.
Click to hide internal directories.