workflow

package
v1.43.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 18 Imported by: 6

Documentation

Index

Constants

View Source
const (
	WorkflowVersion = "1.0.0"
)

Variables

View Source
var SupportedLanguagesUsageSnippets = []string{
	"go",
	"typescript",
	"python",
	"java",
	"php",
	"swift",
	"ruby",
	"csharp",
	"unity",
}

Functions

func GetTempDir

func GetTempDir() string

func SanitizeFilePath added in v1.7.2

func SanitizeFilePath(path string) string

func Save

func Save(dir string, workflow *Workflow) error

Save the workflow to the given directory, dir should generally be the root of the project, and the workflow will be saved to ${projectRoot}/.speakeasy/workflow.yaml

func SaveLockfile added in v1.11.0

func SaveLockfile(dir string, lockfile *LockFile) error

Save the workflow lockfile to the given directory, dir should generally be the root of the project, and the lockfile will be saved to ${projectRoot}/.speakeasy/workflow.lock

Types

type Auth

type Auth struct {
	Header string `yaml:"authHeader" description:"A HTTP Header Name" required:"true"`
	Secret string `yaml:"authSecret" description:"A HTTP Header Value" required:"true"`
	// contains filtered or unexported fields
}

type CodeSamples added in v1.9.0

type CodeSamples struct {
	Output   string          `yaml:"output,omitempty" description:"The output file name"`
	Registry *SourceRegistry `yaml:"registry,omitempty" description:"The output registry location."`
	Style    *string         `` // Oneof "standard", "readme" (default: standard) (see codesamples.go)
	/* 126-byte string literal not displayed */
	LangOverride *string `` // The value to use for the "lang" field of each codeSample (default: auto-detect)
	/* 127-byte string literal not displayed */
	LabelOverride *CodeSamplesLabelOverride `yaml:"labelOverride,omitempty" description:"Optional label override for the code sample. Default is to use the operationId."` // The value to use for the "label" field of each codeSample (default: operationId)
	Blocking      *bool                     ``                                                                                                                             // Default: true. If false, code samples failures will not consider the workflow as failed
	/* 130-byte string literal not displayed */
	Disabled *bool `yaml:"disabled,omitempty" description:"Optional flag to disable code samples."` // Default: false. If true, code samples will not be generated
	// contains filtered or unexported fields
}

func (CodeSamples) Enabled added in v1.34.0

func (c CodeSamples) Enabled() bool

type CodeSamplesLabelOverride added in v1.23.0

type CodeSamplesLabelOverride struct {
	FixedValue *string `yaml:"fixedValue,omitempty" description:"Optional fixed value for the label."`
	Omit       *bool   `yaml:"omit,omitempty" description:"Optional flag to omit the label."`
}

type Dependent added in v1.33.0

type Dependent struct {
	Location     string `yaml:"location" description:"The local path to the repository" required:"true"`
	CloneCommand string `yaml:"cloneCommand,omitempty" description:"Optional command to clone the repository"`
	// contains filtered or unexported fields
}

Ensure you update schema/workflow.schema.json on changes

func (Dependent) Validate added in v1.33.0

func (r Dependent) Validate() error

type Document

type Document struct {
	Location LocationString `` /* 151-byte string literal not displayed */
	Auth     *Auth          `yaml:",inline"`
	// contains filtered or unexported fields
}

func (Document) GetTempDownloadPath

func (d Document) GetTempDownloadPath(tempDir string) string

func (Document) GetTempRegistryDir added in v1.11.3

func (d Document) GetTempRegistryDir(tempDir string) string

func (Document) IsRemote

func (d Document) IsRemote() bool

func (Document) IsSpeakeasyRegistry added in v1.11.3

func (d Document) IsSpeakeasyRegistry() bool

func (Document) PrepareJSONSchema added in v1.41.0

func (Document) PrepareJSONSchema(schema *jsg.Schema) error

func (Document) Validate

func (d Document) Validate() error

type FallbackCodeSamples added in v1.15.1

type FallbackCodeSamples struct {
	FallbackCodeSamplesLanguage string `yaml:"fallbackCodeSamplesLanguage,omitempty" required:"true"`
}

func (FallbackCodeSamples) Validate added in v1.15.4

func (f FallbackCodeSamples) Validate() error

type FilterOperationsOptions added in v1.27.0

type FilterOperationsOptions struct {
	Operations string `yaml:"operations" description:"Comma-separated list of operations to filter" required:"true"` // Comma-separated list of operations to filter
	Include    *bool  `yaml:"include,omitempty" description:"Include the specified operations (mutually exclusive with exclude)"`
	Exclude    *bool  `yaml:"exclude,omitempty" description:"Exclude the specified operations (mutually exclusive with include)"`
}

func (FilterOperationsOptions) ParseOperations added in v1.27.0

func (f FilterOperationsOptions) ParseOperations() []string

type Java

type Java struct {
	OSSRHUsername     string `yaml:"ossrhUsername" required:"true"`
	OSSHRPassword     string `yaml:"ossrhPassword" required:"true"`
	GPGSecretKey      string `yaml:"gpgSecretKey" required:"true"`
	GPGPassPhrase     string `yaml:"gpgPassPhrase" required:"true"`
	UseSonatypeLegacy bool   `yaml:"useSonatypeLegacy,omitempty" required:"true"`
	// contains filtered or unexported fields
}

type LocationString added in v1.22.0

type LocationString string

func (LocationString) Reference added in v1.22.0

func (l LocationString) Reference() string

func (LocationString) Resolve added in v1.22.0

func (l LocationString) Resolve() string

type LockFile added in v1.11.0

type LockFile struct {
	SpeakeasyVersion string                `yaml:"speakeasyVersion"`
	Sources          map[string]SourceLock `yaml:"sources"`
	Targets          map[string]TargetLock `yaml:"targets"`

	Workflow Workflow `yaml:"workflow"`
}

func LoadLockfile added in v1.11.0

func LoadLockfile(dir string) (*LockFile, error)

type MockServer added in v1.28.1

type MockServer struct {

	// When enabled, the mockserver will be started during testing.
	Enabled *bool `yaml:"enabled,omitempty" description:"Defaults to true. If false, the mock API server will not be started."`
	// contains filtered or unexported fields
}

Configuration for mockserver handling during testing.

type NPM

type NPM struct {
	Token string `yaml:"token" required:"true"`
	// contains filtered or unexported fields
}

type NormalizeOptions added in v1.29.2

type NormalizeOptions struct {
	PrefixItems *bool `yaml:"prefixItems,omitempty"`
}

type Nuget

type Nuget struct {
	APIKey string `yaml:"apiKey" required:"true"`
	// contains filtered or unexported fields
}

type Overlay added in v1.15.1

type Overlay struct {
	FallbackCodeSamples *FallbackCodeSamples `yaml:"fallbackCodeSamples,omitempty"`
	Document            *Document            `yaml:"document,omitempty"`
}

Either FallBackCodeSamples or Document

func (Overlay) MarshalYAML added in v1.15.3

func (o Overlay) MarshalYAML() (interface{}, error)

func (Overlay) PrepareJSONSchema added in v1.36.2

func (Overlay) PrepareJSONSchema(schema *jsg.Schema) error

func (*Overlay) UnmarshalYAML added in v1.15.3

func (o *Overlay) UnmarshalYAML(unmarshal func(interface{}) error) error

func (Overlay) Validate added in v1.15.4

func (o Overlay) Validate() error

type Packagist

type Packagist struct {
	Username string `yaml:"username" required:"true"`
	Token    string `yaml:"token" required:"true"`
	// contains filtered or unexported fields
}

type Publishing

type Publishing struct {
	NPM       *NPM       `yaml:"npm,omitempty" description:"NPM (Typescript) publishing configuration."`
	PyPi      *PyPi      `yaml:"pypi,omitempty" description:"PyPI (Python)publishing configuration."`
	Packagist *Packagist `yaml:"packagist,omitempty" description:"Packagist (PHP) publishing configuration."`
	Java      *Java      `yaml:"java,omitempty" description:"Maven (Java) publishing configuration."`
	RubyGems  *RubyGems  `yaml:"rubygems,omitempty" description:"Rubygems (Ruby) publishing configuration."`
	Nuget     *Nuget     `yaml:"nuget,omitempty" description:"NuGet (C#) publishing configuration."`
	Terraform *Terraform `yaml:"terraform,omitempty"`
	// contains filtered or unexported fields
}

func (Publishing) IsPublished

func (p Publishing) IsPublished(target string) bool

func (Publishing) Validate

func (p Publishing) Validate(target string) error

type PyPi

type PyPi struct {
	Token string `yaml:"token" required:"true"`
	// contains filtered or unexported fields
}

type RubyGems

type RubyGems struct {
	Token string `yaml:"token" required:"true"`
	// contains filtered or unexported fields
}

type Source

type Source struct {
	Inputs          []Document       `` /* 138-byte string literal not displayed */
	Overlays        []Overlay        `yaml:"overlays,omitempty" description:"A list of overlay files (OpenAPI Overlay Specification)"`
	Transformations []Transformation `yaml:"transformations,omitempty" description:"A list of transformations to apply to the OpenAPI document"`
	Output          *string          `yaml:"output,omitempty" description:"The output file name (optional)"`
	Ruleset         *string          `yaml:"ruleset,omitempty" description:"The linting ruleset to use (optional)"`
	Registry        *SourceRegistry  `yaml:"registry,omitempty" description:"The openapi registry configuration"`
	// contains filtered or unexported fields
}

Ensure you update schema/workflow.schema.json on changes

func (Source) GetOutputLocation

func (s Source) GetOutputLocation() (string, error)

func (Source) GetTempMergeLocation

func (s Source) GetTempMergeLocation() string

func (Source) GetTempOverlayLocation

func (s Source) GetTempOverlayLocation() string

func (Source) GetTempTransformLocation added in v1.27.1

func (s Source) GetTempTransformLocation() string

func (Source) IsSingleInput added in v1.27.2

func (s Source) IsSingleInput() bool

func (Source) Validate

func (s Source) Validate() error

type SourceLock added in v1.11.0

type SourceLock struct {
	SourceNamespace      string   `yaml:"sourceNamespace,omitempty"`
	SourceRevisionDigest string   `yaml:"sourceRevisionDigest,omitempty"`
	SourceBlobDigest     string   `yaml:"sourceBlobDigest,omitempty"`
	Tags                 []string `yaml:"tags,omitempty"`
}

type SourceRegistry added in v1.13.0

type SourceRegistry struct {
	Location SourceRegistryLocation `yaml:"location" description:"The registry location to use (for snapshotting/change tracking)" required:"true"`
	Tags     []string               `yaml:"tags,omitempty" description:"The list of tags to use for the registry"`
	// contains filtered or unexported fields
}

func (*SourceRegistry) ParseRegistryLocation added in v1.13.0

func (p *SourceRegistry) ParseRegistryLocation() (string, string, string, string, error)

func (*SourceRegistry) SetNamespace added in v1.13.0

func (p *SourceRegistry) SetNamespace(namespace string) error

func (SourceRegistry) Validate added in v1.13.0

func (p SourceRegistry) Validate() error

type SourceRegistryLocation added in v1.13.0

type SourceRegistryLocation string

func (SourceRegistryLocation) Namespace added in v1.13.0

func (n SourceRegistryLocation) Namespace() string

@<org>/<workspace>/<namespace_name> => <org>/<workspace>/<namespace_name>

func (SourceRegistryLocation) NamespaceName added in v1.13.0

func (n SourceRegistryLocation) NamespaceName() string

@<org>/<workspace>/<namespace_name> => <namespace_name>

func (SourceRegistryLocation) String added in v1.13.0

func (n SourceRegistryLocation) String() string

type SpeakeasyRegistryDocument added in v1.11.3

type SpeakeasyRegistryDocument struct {
	OrganizationSlug string
	WorkspaceSlug    string
	NamespaceID      string
	NamespaceName    string
	// Reference could be tag or revision hash sha256:...
	Reference string
}

func ParseSpeakeasyRegistryReference added in v1.11.3

func ParseSpeakeasyRegistryReference(location string) *SpeakeasyRegistryDocument

Parse the location to extract the namespace ID, namespace name, and reference The location should be in the format registry.speakeasyapi.dev/org/workspace/name[:tag|@sha256:digest]

type Target

type Target struct {
	Target      string       `yaml:"target" enum:"csharp,go,java,mcp-typescript,php,python,ruby,swift,terraform,typescript,unity,postman" required:"true"`
	Source      string       `yaml:"source" required:"true"`
	Output      *string      `yaml:"output,omitempty"`
	Publishing  *Publishing  `yaml:"publish,omitempty"`
	CodeSamples *CodeSamples `yaml:"codeSamples,omitempty"`

	// Configuration for target testing. By default, target testing is disabled.
	Testing *Testing `yaml:"testing,omitempty"`
	// contains filtered or unexported fields
}

Ensure you update schema/workflow.schema.json on changes

func (Target) CodeSamplesEnabled added in v1.34.0

func (t Target) CodeSamplesEnabled() bool

func (Target) IsPublished added in v1.6.5

func (t Target) IsPublished() bool

func (Target) Validate

func (t Target) Validate(supportedLangs []string, sources map[string]Source) error

type TargetLock added in v1.11.0

type TargetLock struct {
	Source                    string `yaml:"source"`
	SourceNamespace           string `yaml:"sourceNamespace,omitempty"`
	SourceRevisionDigest      string `yaml:"sourceRevisionDigest,omitempty"`
	SourceBlobDigest          string `yaml:"sourceBlobDigest,omitempty"`
	CodeSamplesNamespace      string `yaml:"codeSamplesNamespace,omitempty"`
	CodeSamplesRevisionDigest string `yaml:"codeSamplesRevisionDigest,omitempty"`
	CodeSamplesBlobDigest     string `yaml:"codeSamplesBlobDigest,omitempty"`
}

type Terraform added in v1.14.4

type Terraform struct {
	GPGPrivateKey string `yaml:"gpgPrivateKey" required:"true"`
	GPGPassPhrase string `yaml:"gpgPassPhrase" required:"true"`
}

type Testing added in v1.28.1

type Testing struct {

	// When enabled, the target will be tested as part of the workflow.
	Enabled *bool `yaml:"enabled,omitempty" description:"Defaults to false. If true, the target will be tested as part of the workflow."`

	// Configuration for mockserver handling during testing. By default, the
	// mockserver is enabled.
	MockServer *MockServer `` /* 169-byte string literal not displayed */
	// contains filtered or unexported fields
}

Configuration for target testing, such as `go test` for Go targets.

type Transformation added in v1.27.0

type Transformation struct {
	RemoveUnused        *bool                    `yaml:"removeUnused,omitempty" description:"Remove unused components from the OpenAPI document"`
	FilterOperations    *FilterOperationsOptions `yaml:"filterOperations,omitempty" description:"Filter operations from the OpenAPI document"`
	Cleanup             *bool                    `yaml:"cleanup,omitempty" description:"Clean up the OpenAPI document"`
	Format              *bool                    `yaml:"format,omitempty"`
	JQSymbolicExecution *bool                    `yaml:"jqSymbolicExecution,omitempty"`
	Normalize           *NormalizeOptions        `yaml:"normalize,omitempty"`
	// contains filtered or unexported fields
}

func (Transformation) Validate added in v1.27.0

func (t Transformation) Validate() error

type Version added in v1.10.1

type Version string

func (Version) PrepareJSONSchema added in v1.36.2

func (Version) PrepareJSONSchema(schema *jsg.Schema) error

func (Version) String added in v1.10.1

func (v Version) String() string

type Workflow

type Workflow struct {
	Version          string               `yaml:"workflowVersion" description:"The version of the workflow schema" const:"1.0.0" required:"true"`
	SpeakeasyVersion Version              `yaml:"speakeasyVersion,omitempty" description:"The version of the speakeasy CLI"`
	Sources          map[string]Source    `yaml:"sources" description:"A map of source names to source configurations, where the output is an OpenAPI document"`
	Targets          map[string]Target    `` /* 126-byte string literal not displayed */
	Dependents       map[string]Dependent `` // Currently only used by one customer. Used to make rebuilding dependent SDKs that live elsewhere easier.
	/* 152-byte string literal not displayed */
	// contains filtered or unexported fields
}

Ensure you update schema/workflow.schema.json on changes

func Load

func Load(dir string) (*Workflow, string, error)

func (Workflow) GetTargetSource

func (w Workflow) GetTargetSource(target string) (*Source, string, error)

func (*Workflow) Merge added in v1.35.0

func (w *Workflow) Merge(other *Workflow)

Merge merges another workflow into this workflow

func (Workflow) Migrate added in v1.23.7

func (w Workflow) Migrate() Workflow

func (Workflow) MigrateNoTelemetry added in v1.23.7

func (w Workflow) MigrateNoTelemetry() Workflow

func (Workflow) Validate

func (w Workflow) Validate(supportLangs []string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL