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 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 PublishOn
- type PublishWorkflow
- type PullRequestOn
- type Push
- type PushCodeSamplesOnly
- type SDKGenConfigField
- type SDKInitStyle
- type Schedule
- type Schemas
- type SetVersion
- type TagOn
- type TaggingWorkflow
- type Target
- type TestingOn
- type TestingWorkflow
- type Tests
- 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 Config ¶
type Config struct {
Config *Configuration
ConfigPath string
LockFile *LockFile
}
type Configuration ¶ added in v1.5.0
type Configuration struct {
ConfigVersion string `yaml:"configVersion"`
Generation Generation `yaml:"generation"`
Languages map[string]LanguageConfig `yaml:",inline"`
New map[string]bool `yaml:"-"`
}
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"`
// This can be a local path or a remote URL
SchemaPath string `yaml:"schemaPath"`
AdditionalProperties map[string]any `yaml:",inline"` // Captures any additional properties that are not explicitly defined for backwards/forwards compatibility
}
type Examples ¶ added in v1.20.0
type Examples = *sequencedmap.Map[string, *sequencedmap.Map[string, OperationExamples]]
type Fixes ¶ added in v1.4.0
type Fixes struct {
NameResolutionDec2023 bool `yaml:"nameResolutionDec2023,omitempty"`
NameResolutionFeb2025 bool `yaml:"nameResolutionFeb2025"`
ParameterOrderingFeb2024 bool `yaml:"parameterOrderingFeb2024"`
RequestResponseComponentNamesFeb2024 bool `yaml:"requestResponseComponentNamesFeb2024"`
SecurityFeb2025 bool `yaml:"securityFeb2025"`
AdditionalProperties map[string]any `yaml:",inline"` // Captures any additional properties that are not explicitly defined for backwards/forwards compatibility
}
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 = *sequencedmap.Map[string, string]
type Generation ¶
type Generation struct {
DevContainers *DevContainers `yaml:"devContainers,omitempty"`
BaseServerURL string `yaml:"baseServerUrl,omitempty"`
SDKClassName string `yaml:"sdkClassName,omitempty"`
MaintainOpenAPIOrder bool `yaml:"maintainOpenAPIOrder,omitempty"`
DeduplicateErrors bool `yaml:"deduplicateErrors,omitempty"`
UsageSnippets *UsageSnippets `yaml:"usageSnippets,omitempty"`
UseClassNamesForArrayFields bool `yaml:"useClassNamesForArrayFields,omitempty"`
Fixes *Fixes `yaml:"fixes,omitempty"`
Auth *Auth `yaml:"auth,omitempty"`
SkipErrorSuffix bool `yaml:"skipErrorSuffix,omitempty"`
InferSSEOverload bool `yaml:"inferSSEOverload,omitempty"`
SDKHooksConfigAccess bool `yaml:"sdkHooksConfigAccess,omitempty"`
Schemas Schemas `yaml:"schemas"`
RequestBodyFieldName string `yaml:"requestBodyFieldName,omitempty"`
// Mock server generation configuration.
MockServer *MockServer `yaml:"mockServer,omitempty"`
Tests Tests `yaml:"tests,omitempty"`
AdditionalProperties map[string]any `yaml:",inline"` // Captures any additional properties that are not explicitly defined for backwards/forwards compatibility
}
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
type LockFile struct {
LockVersion string `yaml:"lockVersion"`
ID string `yaml:"id"`
Management Management `yaml:"management"`
Features map[string]map[string]string `yaml:"features,omitempty"`
GeneratedFiles []string `yaml:"generatedFiles,omitempty"`
GeneratedFileHashes []string `yaml:"generatedFileHashes,omitempty"`
Examples Examples `yaml:"examples,omitempty"`
ExamplesVersion string `yaml:"examplesVersion,omitempty"`
GeneratedTests GeneratedTests `yaml:"generatedTests,omitempty"`
AdditionalProperties map[string]any `yaml:",inline"` // Captures any additional properties that are not explicitly defined for backwards/forwards compatibility
ReleaseNotes string `yaml:"releaseNotes,omitempty"`
}
func NewLockFile ¶ added in v1.5.0
func NewLockFile() *LockFile
type Management ¶
type Management struct {
DocChecksum string `yaml:"docChecksum,omitempty"`
DocVersion string `yaml:"docVersion,omitempty"`
SpeakeasyVersion string `yaml:"speakeasyVersion,omitempty"`
GenerationVersion string `yaml:"generationVersion,omitempty"`
ReleaseVersion string `yaml:"releaseVersion,omitempty"`
ConfigChecksum string `yaml:"configChecksum,omitempty"`
RepoURL string `yaml:"repoURL,omitempty"`
RepoSubDirectory string `yaml:"repoSubDirectory,omitempty"`
InstallationURL string `yaml:"installationURL,omitempty"`
Published bool `yaml:"published,omitempty"`
AdditionalProperties map[string]any `yaml:",inline"` // Captures any additional properties that are not explicitly defined for backwards/forwards compatibility
}
type MockServer ¶ added in v1.19.0
type MockServer struct {
// Disables the code generation of the mockserver target.
Disabled bool `yaml:"disabled"`
}
Generation configuration for the inter-templated mockserver target for test generation.
type OperationExamples ¶ added in v1.20.0
type OperationExamples struct {
Parameters *ParameterExamples `yaml:"parameters,omitempty"`
RequestBody *sequencedmap.Map[string, yaml.Node] `yaml:"requestBody,omitempty"`
Responses *sequencedmap.Map[string, *sequencedmap.Map[string, yaml.Node]] `yaml:"responses,omitempty"`
}
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 struct {
Path *sequencedmap.Map[string, yaml.Node] `yaml:"path,omitempty"`
Query *sequencedmap.Map[string, yaml.Node] `yaml:"query,omitempty"`
Header *sequencedmap.Map[string, yaml.Node] `yaml:"header,omitempty"`
}
type Permissions ¶ added in v0.4.2
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"`
}
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 TransformerFunc ¶ added in v0.8.4
type UpgradeFunc ¶
type UsageSnippets ¶ added in v1.2.0
type UsageSnippets struct {
OptionalPropertyRendering OptionalPropertyRenderingOption `yaml:"optionalPropertyRendering"`
SDKInitStyle SDKInitStyle `yaml:"sdkInitStyle"`
AdditionalProperties map[string]any `yaml:",inline"` // Captures any additional properties that are not explicitly defined for backwards/forwards compatibility
}
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.