Documentation
¶
Index ¶
- Constants
- Variables
- func ComputePaginationDotNotation(config *Pagination)
- type BackoffStrategy
- type CLICommand
- type CLICommandArtifact
- type CLICommandArtifactSegment
- type CLICommandAsync
- type CLICommandAsyncID
- type CLICommandAsyncParameter
- type CLICommandAsyncPathSegment
- type CLICommandAsyncResolvedParameter
- type CLICommandBind
- type CLICommandDispatchKey
- type CLICommandExample
- type CLICommandHelp
- type CLICommandInput
- type CLICommandManifest
- type CLICommandOutput
- type CLICommandPreset
- type CLICommandProjection
- type CLICommandRoute
- type CLICommandSource
- type CLICommandStreamProjection
- type CLIErrorManifest
- type CLIErrorPointerSegment
- type CLIErrorProbe
- type CLIErrorRule
- type CLIErrorTypeHints
- type CLIOperation
- type CLIVariantSelectors
- type Comment
- type Comments
- type CoreCustomSecurityConfig
- type CoreGlobals
- type CustomSecurityConfig
- type Entity
- type EntityDescription
- type EntityMissingCodes
- type EntityOperationV1
- type EntityOperationV1Config
- type EntityOperationV1Options
- type EntityOperationV1Patch
- type EntityOperationV1Polling
- type EntityVersion
- type Errors
- type Extension
- type ExtensionScope
- type Extensions
- func (e *Extensions) Base64InputMode(schema *oas3.Schema) (string, error)
- func (e *Extensions) CollectCLIBodySchemas(ctx context.Context, docInfo *document.DocumentInfo) (map[string]string, error)
- func (e *Extensions) DoesParamAllowReserved(param *openapi.Parameter) (allowed bool, unsupported bool)
- func (e *Extensions) GetCustomDocs(extensions OAExtensions) (Comments, error)
- func (e *Extensions) GetDeprecationMessage(extensions OAExtensions) (string, error)
- func (e *Extensions) GetDeprecationReplacement(extensions OAExtensions) (string, error)
- func (e *Extensions) GetDiscriminatorNameOverrides(schema *oas3.Schema) (map[string]string, error)
- func (e *Extensions) GetEnumDescriptions(schema *oas3.Schema) ([]string, map[any]string, error)
- func (e *Extensions) GetEnumFormat(schema *oas3.Schema) (string, error)
- func (e *Extensions) GetEnumNames(schema *oas3.Schema) ([]string, map[any]string, error)
- func (e *Extensions) GetFlattenRequest(extensions OAExtensions) (*bool, error)
- func (e *Extensions) GetGoOptionalMethodArguments(extensions OAExtensions) (*GoOptionalMethodArguments, error)
- func (e *Extensions) GetGroups(operation *openapi.Operation) ([]string, error)
- func (e *Extensions) GetGroupsWithNode(operation *openapi.Operation) ([]string, *yaml.Node, error)
- func (e *Extensions) GetMaxMethodParams(extensions OAExtensions) (*int, error)
- func (e *Extensions) GetModelNamespace(extensions OAExtensions) (string, error)
- func (e *Extensions) GetOverridableOAuth2Scopes(flow *openapi.OAuthFlow) (bool, error)
- func (e *Extensions) GetPropertyName(s *oas3.JSONSchema[oas3.Referenceable], ...) (string, error)
- func (e *Extensions) GetResolvedName(ext Extension) string
- func (e *Extensions) GetResolvedSchemaName(extensions OAExtensions, originalName string) (string, error)
- func (e *Extensions) GetSSEOverload(extensions OAExtensions) (bool, error)
- func (e *Extensions) GetSecuritySchemeExample(scheme *openapi.SecurityScheme) *yaml.Node
- func (e *Extensions) GetServerID(server *openapi.Server) (string, error)
- func (e *Extensions) GetTestDirectives(extensions OAExtensions) ([]string, error)
- func (e *Extensions) GetTestID(operation *openapi.Operation) (string, error)
- func (e *Extensions) GetTokenServerAuthentication(securityScheme *openapi.OAuthFlow) (string, error)
- func (e *Extensions) GetUsageConfig(extensions OAExtensions) (*UsageExampleConfig, error)
- func (e *Extensions) HandleAllowEmptyQueryParameterValueExtension(param *openapi.Parameter) (bool, error)
- func (e *Extensions) HandleCLICommandsExtension(ctx context.Context, docInfo *document.DocumentInfo) (*CLICommandManifest, error)
- func (e *Extensions) HandleCLIErrorsExtension(_ context.Context, docInfo *document.DocumentInfo) (*CLIErrorManifest, error)
- func (e *Extensions) HandleClassNameExtension(extensions OAExtensions) (*NameOverride, error)
- func (e *Extensions) HandleCustomSecurityConfig(ctx context.Context, exts OAExtensions) (*CustomSecurityConfig, error)
- func (e *Extensions) HandleDocsRateLimitExtension(operation *openapi.Operation) ([]RateLimit, error)
- func (e *Extensions) HandleEntityDescriptionExtension(extensions OAExtensions) (*EntityDescription, error)
- func (e *Extensions) HandleEntityExtension(extensions OAExtensions) (*Entity, error)
- func (e *Extensions) HandleEntityMissingCodesExtension(extensions OAExtensions) (EntityMissingCodes, error)
- func (e *Extensions) HandleEntityOperationExtension(operation *openapi.Operation) (*EntityOperationV1, error)
- func (e *Extensions) HandleEntityVersionExtension(extensions OAExtensions) (*EntityVersion, error)
- func (e *Extensions) HandleErrors(extensions OAExtensions) (*Errors, error)
- func (e *Extensions) HandleExampleUnsetExtension(extensions OAExtensions) (*bool, error)
- func (e *Extensions) HandleGlobalNameOverrideExtensions(doc *openapi.OpenAPI) ([]*NameOverride, error)
- func (e *Extensions) HandleGlobalRetryExtension(doc *openapi.OpenAPI, defaultEnabledRetries bool) (*Retries, error)
- func (e *Extensions) HandleGlobalTimeoutExtension(doc *openapi.OpenAPI) (*int64, error)
- func (e *Extensions) HandleGlobalsExtension(ctx context.Context, doc *openapi.OpenAPI) (*Globals, error)
- func (e *Extensions) HandleIgnoreExtension(extensions OAExtensions) (*bool, error)
- func (e *Extensions) HandleMCPExtension(operation *openapi.Operation) (*MCP, error)
- func (e *Extensions) HandleMatchExtension(extensions OAExtensions) (*MatchConfig, error)
- func (e *Extensions) HandleOperationMethodNameExtension(operation *openapi.Operation) (*NameOverride, bool, error)
- func (e *Extensions) HandleOperationPaginationExtension(ctx context.Context, operation *openapi.Operation, ...) (*Pagination, error)
- func (e *Extensions) HandleOperationParameterNameExtension(param *openapi.Parameter) (*NameOverride, bool, error)
- func (e *Extensions) HandleOperationRetryExtension(operation *openapi.Operation) (*Retries, bool, error)
- func (e *Extensions) HandleOperationTimeoutExtension(operation *openapi.Operation) (*int64, bool, error)
- func (e *Extensions) HandlePollingExtension(extensions OAExtensions) (*Polling, error)
- func (e *Extensions) HandlePublicExportsExtension(extensions OAExtensions) ([]PublicExport, error)
- func (e *Extensions) HandleReactHookExtension(operation *openapi.Operation) (*ReactHook, error)
- func (e *Extensions) HandleResponseFilterExtension(extensions OAExtensions) (*bool, error)
- func (e *Extensions) HandleRewriteExtension(opts ...HandleRewriteExtensionOption) error
- func (e *Extensions) HandleSSESentinelExtension(extensions OAExtensions) (*SSESentinel, error)
- func (e *Extensions) HandleSSESentinelExtensionString(extensions OAExtensions) string
- func (e *Extensions) HandleTerraformAliasToExtension(extensions OAExtensions) (*string, error)
- func (e *Extensions) HandleTerraformCustomDefaultExtension(extensions OAExtensions) (*TerraformCustomDefault, error)
- func (e *Extensions) HandleTerraformIgnoreExtension(extensions OAExtensions) (*TerraformIgnore, error)
- func (e *Extensions) HandleTerraformWriteOnlyExtension(extensions OAExtensions) (*bool, error)
- func (e *Extensions) HandleTransformExtension(ext OAExtensions, transformExt Extension) (*TransformerConfig, error)
- func (e *Extensions) HandleWebhooksExtension(extensions OAExtensions) (*Webhooks, error)
- func (e *Extensions) HandleWrappedAttributeExtension(extensions OAExtensions) (*string, error)
- func (e *Extensions) Ignore(extensions OAExtensions) (bool, error)
- func (e *Extensions) IncludeSchema(schema *oas3.JSONSchema[oas3.Concrete]) (bool, error)
- func (e *Extensions) IsErrorMessage(extensions OAExtensions) (bool, error)
- func (e *Extensions) IsExtensionIdentifying(extName string) bool
- func (e *Extensions) IsExtensionMergable(extName string) bool
- func (e *Extensions) IsGlobalHidden(ctx context.Context, parameter *openapi.Parameter) bool
- func (e *Extensions) IsOpenEnum(schema *oas3.Schema) (bool, error)
- func (e *Extensions) IsTestIgnored(extensions OAExtensions) (bool, error)
- func (e *Extensions) IsTestingEnabled(extensions OAExtensions) (*bool, error)
- func (e *Extensions) IsUsageExample(extensions OAExtensions) (bool, error)
- func (e *Extensions) OperationCanHaveSSEOverload(ctx context.Context, op *openapi.Operation, docInfo *document.DocumentInfo) (*SSEOverloadConfig, error)
- func (e *Extensions) OperationCanInferSSEOverload(ctx context.Context, op *openapi.Operation, docInfo *document.DocumentInfo) (*SSEOverloadConfig, error)
- func (e *Extensions) ParseGlobalNameOverrideExtension(nameOverrideExtension *yaml.Node) ([]*NameOverride, error)
- func (e *Extensions) TypeOverride(extensions OAExtensions) (string, error)
- type Globals
- type GoOptionalMethodArguments
- type HandleRewriteExtensionOption
- type HandleRewriteExtensionOptions
- type MCP
- type MatchConfig
- type NameOverride
- type OAExtensions
- type Pagination
- type PaginationInputInType
- type PaginationInputType
- type PaginationInputs
- type PaginationOutputs
- type PaginationType
- type Polling
- type PollingCriteria
- type PollingCriterion
- type PollingOption
- type PollingOptions
- type PublicExport
- type PublicExportRepresentation
- type RateLimit
- type ReactHook
- type ReactHookQueryKey
- type Retries
- type SSEOverloadConfig
- type SSESentinel
- type TerraformCustomDefault
- type TerraformIgnore
- type TransformerConfig
- type TransformerType
- type UsageExampleConfig
- type WebhookSecurity
- type Webhooks
- type WindowStrategy
Constants ¶
const Base64InputModeFile = "file"
Base64InputModeFile is the only currently-supported value for the x-speakeasy-base64-input-mode extension.
const (
ErrUnmarshal = errors.Error("failed to unmarshal extension")
)
Variables ¶
var CLIErrorTypes = []string{
"authentication_error",
"authorization_error",
"service_disabled",
"billing_disabled",
"not_found",
"validation_error",
"rate_limit_error",
"server_error",
"connection_error",
"protocol_error",
"api_error",
"runtime_error",
"unsupported_error",
"async_failed",
"async_timeout",
"async_unknown_state",
}
CLIErrorTypes is the closed error_type namespace emitted by generated CLIs.
var CLIRuntimeHintReasons = []string{
"CLI_VALIDATION",
"CLI_CONNECTION",
"CLI_PROTOCOL",
"CLI_RUNTIME",
"CLI_UNAVAILABLE",
"CLI_AUTHENTICATION",
"CLI_ASYNC_FAILED",
"CLI_ASYNC_TIMEOUT",
"CLI_ASYNC_UNKNOWN_STATE",
}
CLIRuntimeHintReasons is the closed namespace of CLI_*-prefixed error reasons the generated runtime can emit; hints keyed by any other CLI_* reason would never fire and are therefore decode errors. The generated agent-mode error envelope mirrors this list.
var ValidEntityOperationV1ConfigOperationTypes = []string{
"close",
"create",
"delete",
"invoke",
"open",
"read",
"update",
}
Collection of valid entity operations types across targets and entity types. This currently includes Terraform data, ephemeral, and managed resource operation types.
Functions ¶
func ComputePaginationDotNotation ¶
func ComputePaginationDotNotation(config *Pagination)
Types ¶
type BackoffStrategy ¶
type BackoffStrategy struct {
InitialInterval *int `json:"initialInterval" yaml:"initialInterval,omitempty"`
MaxInterval *int `json:"maxInterval" yaml:"maxInterval,omitempty"`
Exponent *float32 `json:"exponent" yaml:"exponent,omitempty"`
MaxElapsedTime *int `json:"maxElapsedTime" yaml:"maxElapsedTime,omitempty"`
}
type CLICommand ¶ added in v2.936.0
type CLICommand struct {
ID string `json:"id" yaml:"id"`
Path []string `json:"path" yaml:"path"`
Category string `json:"category" yaml:"category"`
Summary string `json:"summary" yaml:"summary"`
Tagline string `json:"tagline" yaml:"tagline"`
Description string `json:"description" yaml:"description"`
Source CLICommandSource `json:"source" yaml:"source"`
Args []CLICommandInput `json:"args" yaml:"args"`
Flags []CLICommandInput `json:"flags" yaml:"flags"`
Presets []CLICommandPreset `json:"presets" yaml:"presets"`
Async *CLICommandAsync `json:"async,omitempty" yaml:"async,omitempty"`
Output *CLICommandOutput `json:"output" yaml:"output"`
Examples []CLICommandExample `json:"examples" yaml:"examples"`
Help *CLICommandHelp `json:"help,omitempty" yaml:"help,omitempty"`
Override bool `json:"override,omitempty" yaml:"override,omitempty"`
DispatchKeys []CLICommandDispatchKey `json:"dispatchKeys,omitempty" yaml:"dispatchKeys,omitempty"`
// Hints maps an error reason to agent-mode hint lines that are merged
// into the reason-first error envelope. CLI_* reasons are the closed
// namespace the generated runtime itself produces; external (server)
// reasons pass through verbatim.
Hints map[string][]string `json:"hints,omitempty" yaml:"hints,omitempty"`
}
CLICommand is one declared intent command.
type CLICommandArtifact ¶ added in v2.936.0
type CLICommandArtifact struct {
ContentPointer string `json:"contentPointer" yaml:"contentPointer"`
Segments []CLICommandArtifactSegment `json:"segments" yaml:"segments"`
Kind string `json:"kind" yaml:"kind"` // image | audio | video
DefaultPath string `json:"defaultPath" yaml:"defaultPath"`
// Content-block field bindings (block:). Defaults are the v1 shape.
TypeField string `json:"typeField" yaml:"typeField"` // default "type"
DataField string `json:"dataField" yaml:"dataField"` // default "data"
MimeTypeField string `json:"mimeTypeField" yaml:"mimeTypeField"` // default "mime_type"
URIField string `json:"uriField" yaml:"uriField"` // default "uri"
// Response-root identity bindings (identity:). Defaults are the v1 shape.
IDField string `json:"idField" yaml:"idField"` // default "id"
StatusField string `json:"statusField" yaml:"statusField"` // default "status"
TerminalStatus string `json:"terminalStatus" yaml:"terminalStatus"` // default "completed"
// ResponseCode is the 2xx status code whose application/json schema the
// content pointer was validated against (set during linking).
ResponseCode string `json:"responseCode" yaml:"responseCode"`
// contains filtered or unexported fields
}
CLICommandArtifact declares that the command's semantic result is a media file: the renderer generates --out/--raw-response flags and a runtime that extracts the first matching content block from the response, writes it to disk, and reports the path. The content-block shape is declaration-driven: block: binds the member names the runtime reads (discriminating kind, base64 payload, MIME type, URI), and identity: binds the response-root members used to enrich the reported envelope and not-ready diagnostics. Both default to the v1 shape ({type, data, mime_type, uri} blocks and {id, status} roots with terminal status "completed") so declarations that spell nothing keep their existing linked shape and runtime behavior. v1 handles inline base64 content only; URI-delivered content is a targeted runtime error naming the missing download capability.
type CLICommandArtifactSegment ¶ added in v2.936.0
type CLICommandArtifactSegment struct {
Field string `json:"field,omitempty" yaml:"field,omitempty"`
Wild bool `json:"wild,omitempty" yaml:"wild,omitempty"`
}
CLICommandArtifactSegment is one step of an artifact content-pointer walk: either a named object field or a [*] fan-out over every array item.
type CLICommandAsync ¶ added in v2.936.0
type CLICommandAsync struct {
OperationID string `json:"operationId" yaml:"operationId"`
ID CLICommandAsyncID `json:"id" yaml:"id"`
Params map[string]any `json:"params,omitempty" yaml:"params,omitempty"`
ResolvedParams []CLICommandAsyncResolvedParameter `json:"resolvedParams,omitempty" yaml:"resolvedParams,omitempty"`
StateFrom string `json:"stateFrom" yaml:"stateFrom"`
StatePointer string `json:"statePointer" yaml:"statePointer"`
StateSegments []CLICommandAsyncPathSegment `json:"stateSegments" yaml:"stateSegments"`
States map[string]string `json:"states" yaml:"states"`
Interval string `json:"interval" yaml:"interval"`
Backoff float64 `json:"backoff" yaml:"backoff"`
MaxInterval string `json:"maxInterval" yaml:"maxInterval"`
Timeout string `json:"timeout" yaml:"timeout"`
ErrorField string `json:"errorField" yaml:"errorField"` // default "error"
ErrorMessageField string `json:"errorMessageField" yaml:"errorMessageField"` // default "message"
CreateResponseCode string `json:"createResponseCode" yaml:"createResponseCode"`
ResponseCode string `json:"responseCode" yaml:"responseCode"`
// contains filtered or unexported fields
}
CLICommandAsync declares a foreground polling recipe. States is keyed by the API's enum value so overlays replace classifications instead of appending duplicate set members. The failure-detail shape is declaration-driven: ErrorField binds the poll-response root member holding the failure detail object and ErrorMessageField the string member inside it that carries the human message. Both default to the v1 shape ("error"/"message"), and only declaring either opts the pair into strict linking against the poll response schema (a defaulted pair keeps the v1 best-effort runtime reads, so existing recipes cannot start failing generation).
type CLICommandAsyncID ¶ added in v2.936.0
type CLICommandAsyncID struct {
From string `json:"from" yaml:"from"`
Pointer string `json:"pointer" yaml:"pointer"`
Segments []CLICommandAsyncPathSegment `json:"segments" yaml:"segments"`
To CLICommandAsyncParameter `json:"to" yaml:"to"`
}
CLICommandAsyncID connects the create response to the poll request. From is retained for diagnostics; Pointer is its RFC 6901 lowering for the runtime.
type CLICommandAsyncParameter ¶ added in v2.936.0
type CLICommandAsyncParameter struct {
In string `json:"in" yaml:"in"` // path | query
Name string `json:"name" yaml:"name"`
}
CLICommandAsyncParameter identifies the poll-operation parameter that receives the handle returned by the create operation.
type CLICommandAsyncPathSegment ¶ added in v2.936.0
type CLICommandAsyncPathSegment struct {
Field string `json:"field,omitempty" yaml:"field,omitempty"`
Index int `json:"index,omitempty" yaml:"index,omitempty"`
IsIndex bool `json:"isIndex,omitempty" yaml:"isIndex,omitempty"`
}
CLICommandAsyncPathSegment preserves the unambiguous shape of an authored singular JSONPath for downstream renderers. Pointer remains the runtime form.
type CLICommandAsyncResolvedParameter ¶ added in v2.936.0
type CLICommandAsyncResolvedParameter struct {
In string `json:"in" yaml:"in"` // query | header
Name string `json:"name" yaml:"name"`
Value any `json:"value" yaml:"value"`
}
CLICommandAsyncResolvedParameter is a poll-operation parameter pinned by async.params after its location and schema have been linked.
type CLICommandBind ¶ added in v2.936.0
type CLICommandBind struct {
In string `json:"in" yaml:"in"` // "body" (v1)
Pointer string `json:"pointer" yaml:"pointer"` // e.g. "/input"
Mode string `json:"mode" yaml:"mode"` // "set" (v1)
}
CLICommandBind describes where a CLI input value lands in the request. v1 renders body bindings addressed by RFC 6901 JSON Pointer.
type CLICommandDispatchKey ¶ added in v2.936.0
type CLICommandDispatchKey struct {
Pointer string `json:"pointer" yaml:"pointer"`
RouteIDs []string `json:"routeIds,omitempty" yaml:"routeIds,omitempty"`
UnroutedVariants []string `json:"unroutedVariants,omitempty" yaml:"unroutedVariants,omitempty"`
}
CLICommandDispatchKey records body-key membership across the complete request union. Empty RouteIDs means that only unrouted variants declare the key, which lets the runtime return a typed escape-path error rather than silently selecting a routed variant.
type CLICommandExample ¶ added in v2.936.0
type CLICommandExample struct {
Summary string `json:"summary" yaml:"summary"`
Command string `json:"command" yaml:"command"`
}
CLICommandExample is a labeled runnable invocation. The authoring-side slug (the map key, used as overlay-patchable identity) is dropped at normalization; document order is preserved.
type CLICommandHelp ¶ added in v2.936.0
type CLICommandHelp struct {
Defaults string `json:"defaults,omitempty" yaml:"defaults,omitempty"`
Learn string `json:"learn,omitempty" yaml:"learn,omitempty"`
Escalate string `json:"escalate,omitempty" yaml:"escalate,omitempty"`
}
CLICommandHelp carries concise human-facing help prose. Values are the text after their respective labels and are deliberately limited to one line so a manifest value cannot inject or impersonate another help section.
type CLICommandInput ¶ added in v2.936.0
type CLICommandInput struct {
ID string `json:"id" yaml:"id"`
Name string `json:"name" yaml:"name"`
Summary string `json:"summary" yaml:"summary"`
Type string `json:"type" yaml:"type"` // string | int | float | bool
Required bool `json:"required" yaml:"required"`
Variadic bool `json:"variadic" yaml:"variadic"`
Shorthand string `json:"shorthand" yaml:"shorthand"`
Default any `json:"default" yaml:"default"`
DefaultFrom string `json:"defaultFrom" yaml:"defaultFrom"` // "schema"
Bind *CLICommandBind `json:"bind" yaml:"bind"`
// Enum carries schema enum values as agent/user suggestions only. They are
// never enforced locally: upstream registries evolve faster than specs, so
// enum drift must not brick otherwise-valid invocations.
Enum []any `json:"enum,omitempty" yaml:"enum,omitempty"`
// RouteIDs lists the dispatch routes whose request variant declares this
// input's bound property. RequiredRouteIDs is the subset on which the
// property remains required after schema defaults and effective presets.
// Both are nil for ordinary single-route commands.
RouteIDs []string `json:"routeIds,omitempty" yaml:"routeIds,omitempty"`
RequiredRouteIDs []string `json:"requiredRouteIds,omitempty" yaml:"requiredRouteIds,omitempty"`
// contains filtered or unexported fields
}
CLICommandInput is a positional argument or flag on a declared command.
type CLICommandManifest ¶ added in v2.936.0
type CLICommandManifest struct {
Version int `json:"version" yaml:"version"`
Categories []string `json:"categories,omitempty" yaml:"categories,omitempty"`
Commands []CLICommand `json:"commands" yaml:"commands"`
Operations []CLIOperation `json:"operations,omitempty" yaml:"operations,omitempty"`
}
CLICommandManifest is the decoded x-speakeasy-cli-commands document extension. Commands preserve document order; Categories preserve the declared help-section order.
func DecodeCLICommandsManifest ¶ added in v2.936.0
func DecodeCLICommandsManifest(ctx context.Context, docInfo *document.DocumentInfo, node *yaml.Node) (*CLICommandManifest, []string, error)
DecodeCLICommandsManifest performs the full strict decode, schema link, and lowering of the extension node. It is exported for focused testing; use HandleCLICommandsExtension during generation.
type CLICommandOutput ¶ added in v2.936.0
type CLICommandOutput struct {
Projection *CLICommandProjection `json:"projection" yaml:"projection"`
Artifact *CLICommandArtifact `json:"artifact,omitempty" yaml:"artifact,omitempty"`
Stream *CLICommandStreamProjection `json:"stream,omitempty" yaml:"stream,omitempty"`
}
CLICommandOutput groups output behavior for a declared command.
type CLICommandPreset ¶ added in v2.936.0
type CLICommandPreset struct {
Bind CLICommandBind `json:"bind" yaml:"bind"`
Value any `json:"value" yaml:"value"`
}
CLICommandPreset is a fixed request value applied before user inputs.
type CLICommandProjection ¶ added in v2.936.0
type CLICommandProjection struct {
JQ string `json:"jq" yaml:"jq"`
Format string `json:"format" yaml:"format"`
}
CLICommandProjection is the default output projection for a command.
type CLICommandRoute ¶ added in v2.936.0
type CLICommandRoute struct {
ID string `json:"id,omitempty" yaml:"id,omitempty"`
Label string `json:"label,omitempty" yaml:"label,omitempty"`
Default bool `json:"default,omitempty" yaml:"default,omitempty"`
OperationID string `json:"operationId" yaml:"operationId"`
RequestVariant string `json:"requestVariant" yaml:"requestVariant"`
// Selector is the declared or inferred flag that identifies this route.
Selector string `json:"selector,omitempty" yaml:"selector,omitempty"`
// Presets contains route-local presets after decoding and the effective
// command-then-route preset set after linking.
Presets []CLICommandPreset `json:"presets,omitempty" yaml:"presets,omitempty"`
// Selectors describes how the pinned request variant is told apart from
// the other members of a union request body. The generated runtime uses
// it when a caller supplies a partial body (--body/--body-param) to an
// intent command: presets fill the gaps of a body that stays inside the
// pinned variant, and a body that names another variant's selector is a
// usage error instead of a silently re-targeted request. Nil when the
// request body is not a union.
Selectors *CLIVariantSelectors `json:"selectors,omitempty" yaml:"selectors,omitempty"`
}
CLICommandRoute binds a command to an operation.
type CLICommandSource ¶ added in v2.936.0
type CLICommandSource struct {
Type string `json:"type" yaml:"type"` // "operation" | "group" | "planned"
Routes []CLICommandRoute `json:"routes" yaml:"routes"`
Note string `json:"note" yaml:"note"` // planned: message explaining availability
}
CLICommandSource discriminates what a declared command does.
type CLICommandStreamProjection ¶ added in v2.936.0
type CLICommandStreamProjection struct {
Select string `json:"select" yaml:"select"`
Pointer string `json:"pointer" yaml:"pointer"`
}
CLICommandStreamProjection selects the field of each streamed event whose string value is written raw to stdout as the event arrives (stream mode only). Select is the authored singular JSONPath from the event root as the CLI sees each event (the same root a per-event --jq filter sees); Pointer is its RFC 6901 lowering, which the generated runtime evaluates.
type CLIErrorManifest ¶ added in v2.936.0
type CLIErrorManifest struct {
Version int `json:"version" yaml:"version"`
// ReasonPointer is the declared primary reason carrier: the restricted
// JSONPath, relative to the response body's error object, whose string
// values are the structured reason codes the top-level reason rules
// match. Empty means the default carrier $.reason. Declaring the pointer
// also opts the carrier into promoting an unmatched reason code verbatim
// as error_reason.
ReasonPointer string `json:"reasonPointer,omitempty" yaml:"reasonPointer,omitempty"`
ReasonSegments []CLIErrorPointerSegment `json:"-" yaml:"-"` // parsed ReasonPointer; generation-only
Reasons []CLIErrorRule `json:"reasons,omitempty" yaml:"reasons,omitempty"`
// Probes are additional reason carriers consulted after the primary
// carrier, in declaration order. Each probe declares its pointer
// explicitly, so each probe promotes an unmatched reason code verbatim.
Probes []CLIErrorProbe `json:"probes,omitempty" yaml:"probes,omitempty"`
Types []CLIErrorTypeHints `json:"types,omitempty" yaml:"types,omitempty"`
// UnwrapErrorArray opts into normalizing the single-element
// array-wrapped error body shape ([{"error": {...}}]) to its sole
// element before classification. Default off.
UnwrapErrorArray bool `json:"unwrapErrorArray,omitempty" yaml:"unwrapErrorArray,omitempty"`
}
CLIErrorManifest is the decoded x-speakeasy-cli-errors document extension. Slices preserve authoring order so generated Go tables are deterministic.
func DecodeCLIErrorsManifest ¶ added in v2.936.0
func DecodeCLIErrorsManifest(node *yaml.Node) (*CLIErrorManifest, error)
DecodeCLIErrorsManifest performs the strict v1 decode. It is exported for focused decoder tests; generation should call HandleCLIErrorsExtension.
type CLIErrorPointerSegment ¶ added in v2.936.0
type CLIErrorPointerSegment struct {
Field string `json:"field,omitempty" yaml:"field,omitempty"`
IsWild bool `json:"isWild,omitempty" yaml:"isWild,omitempty"`
}
CLIErrorPointerSegment is one step of a parsed carrier pointer path: a named member, or a [*] fan-out over every item of an array member.
type CLIErrorProbe ¶ added in v2.936.0
type CLIErrorProbe struct {
Pointer string `json:"pointer" yaml:"pointer"`
Segments []CLIErrorPointerSegment `json:"-" yaml:"-"` // parsed Pointer; generation-only
Reasons []CLIErrorRule `json:"reasons,omitempty" yaml:"reasons,omitempty"`
}
CLIErrorProbe is one additional declared reason carrier: a pointer into the response body's error object plus the reason rules matched against the values found there. Probes are consulted after the primary carrier, in declaration order.
type CLIErrorRule ¶ added in v2.936.0
type CLIErrorRule struct {
Reason string `json:"reason" yaml:"reason"`
Type string `json:"type,omitempty" yaml:"type,omitempty"`
Hints []string `json:"hints,omitempty" yaml:"hints,omitempty"`
HasHints bool `json:"-" yaml:"-"` // generation-only presence bit; not extension shape
// contains filtered or unexported fields
}
CLIErrorRule is one exact reason-code rule declared by x-speakeasy-cli-errors. Type and Hints are independently optional: an author may declare either part of a rule, or attach hints to a reason whose type still falls back to HTTP status.
type CLIErrorTypeHints ¶ added in v2.936.0
type CLIErrorTypeHints struct {
Type string `json:"type" yaml:"type"`
Hints []string `json:"hints" yaml:"hints"`
}
CLIErrorTypeHints replaces the generated fallback hints for one closed error type.
type CLIOperation ¶ added in v2.936.0
type CLIOperation struct {
OperationID string `json:"operationId" yaml:"operationId"`
Output *CLICommandOutput `json:"output,omitempty" yaml:"output,omitempty"`
Flags []CLICommandInput `json:"flags,omitempty" yaml:"flags,omitempty"`
BodyRequired bool `json:"bodyRequired,omitempty" yaml:"bodyRequired,omitempty"`
}
CLIOperation augments the generated command for one operation. Unlike an intent it does not create a command or choose a request variant: it adds an opt-in streamed projection and, when necessary, scalar flags that merge into a body property shared by every request-body union member.
type CLIVariantSelectors ¶ added in v2.936.0
type CLIVariantSelectors struct {
// Own lists distinguishing keys (required or defaulted in some members,
// absent from at least one) that the pinned variant declares.
Own []string `json:"own,omitempty" yaml:"own,omitempty"`
// Foreign lists distinguishing keys the pinned variant does not declare:
// their presence in a body selects a different variant.
Foreign []string `json:"foreign,omitempty" yaml:"foreign,omitempty"`
// DiscriminatorKey/DiscriminatorValue name the pinned variant's
// discriminator when the union declares one; DiscriminatorValue is the
// value filled into a body that omits it (explicit mapping entry, then
// the pinned schema's const/single-enum property, then the implicit
// mapping — the component name), DiscriminatorAliases every value that
// selects the pinned variant (mapping aliases included).
DiscriminatorKey string `json:"discriminatorKey,omitempty" yaml:"discriminatorKey,omitempty"`
DiscriminatorValue any `json:"discriminatorValue,omitempty" yaml:"discriminatorValue,omitempty"`
DiscriminatorAliases []any `json:"discriminatorAliases,omitempty" yaml:"discriminatorAliases,omitempty"`
}
CLIVariantSelectors is the generation-time knowledge needed to keep a partial user body inside a pinned union variant.
type CoreCustomSecurityConfig ¶
type CoreCustomSecurityConfig struct {
marshaller.CoreModel `model:"customSecurityConfig"`
UsesScopes marshaller.Node[*bool] `key:"usesScopes"`
Schema marshaller.Node[core.JSONSchema] `key:"schema" required:"true"`
}
type CoreGlobals ¶
type CoreGlobals struct {
marshaller.CoreModel `model:"globals"`
Parameters marshaller.Node[[]marshaller.Node[*core.Reference[*core.Parameter]]] `key:"parameters"`
}
type CustomSecurityConfig ¶
type CustomSecurityConfig struct {
marshaller.Model[CoreCustomSecurityConfig]
UsesScopes *bool
Schema *oas3.JSONSchema[oas3.Referenceable]
}
type Entity ¶
type Entity struct {
// All entity names described by the x-speakeasy-entity extension configuration.
Names []string `json:"names" yaml:"names"`
}
Describes the parsed x-speakeasy-entity extension configuration.
type EntityDescription ¶
type EntityDescription struct {
// Entity description for Terraform action.
TerraformAction string `json:"terraform_action" yaml:"terraform_action"`
// Entity description for Terraform data resource.
TerraformDataResource string `json:"terraform_data_resource" yaml:"terraform_data_resource"`
// Entity description for Terraform ephemeral resource.
TerraformEphemeralResource string `json:"terraform_ephemeral_resource" yaml:"terraform_ephemeral_resource"`
// Entity description for Terraform managed resource.
TerraformManagedResource string `json:"terraform_managed_resource" yaml:"terraform_managed_resource"`
}
Describes the parsed x-speakeasy-entity-description extension configuration. The data is normalized into values for target-specific entities.
func (*EntityDescription) Clone ¶
func (e *EntityDescription) Clone() *EntityDescription
Clone creates a deep copy of the EntityDescription
func (*EntityDescription) Merge ¶
func (e *EntityDescription) Merge(other *EntityDescription)
Merges the given EntityDescription into this EntityDescription. The algorithm adds data from the given EntityDescription to this EntityDescription where it is undefined. Where there is conflicting data, this EntityDescription's data is preserved or otherwise delegated to data-specific merge functionality. It does not remove any data from this EntityDescription.
type EntityMissingCodes ¶
type EntityMissingCodes []int
EntityMissingCodes describes HTTP status codes that indicate an entity is missing/deleted in the API. Used by Terraform target to call RemoveResource() during Read operations.
type EntityOperationV1 ¶
type EntityOperationV1 struct {
TerraformActions []EntityOperationV1Config `json:"terraform_actions" yaml:"terraform_actions"`
TerraformDataResources []EntityOperationV1Config `json:"terraform_data_resources" yaml:"terraform_data_resources"`
TerraformEphemeralResources []EntityOperationV1Config `json:"terraform_ephemeral_resources" yaml:"terraform_ephemeral_resources"`
TerraformManagedResources []EntityOperationV1Config `json:"terraform_managed_resources" yaml:"terraform_managed_resources"`
}
Describes the parsed x-speakeasy-entity-operation extension configuration. The data is normalized into collections of target-specific entity operations.
type EntityOperationV1Config ¶
type EntityOperationV1Config struct {
// Name of the entity for this operation.
Entity string `json:"entity" yaml:"entity"`
// Types of the entity operation.
OperationTypes []string `json:"operation_types" yaml:"operation_types"`
// Optional ordering of the operation compared to other definitions of the
// same entity and operation type.
Order *int `json:"order,omitempty" yaml:"order,omitempty"`
// Optional SDK options for this entity operation.
Options *EntityOperationV1Options `json:"options,omitempty" yaml:"options,omitempty"`
}
Describes an individual entity operation parsed from Entity#OperationType[,OperationType...][#Order] string.
func ParseEntityOperationV1ConfigString ¶
func ParseEntityOperationV1ConfigString(input string) (*EntityOperationV1Config, error)
Parses given Entity#OperationType[,OperationType...][#Order] string into an EntityOperationV1Config.
func (EntityOperationV1Config) String ¶
func (c EntityOperationV1Config) String() string
Returns a string representation of the EntityOperationV1Config in the Entity#OperationType[,OperationType...][#Order] format.
type EntityOperationV1Options ¶
type EntityOperationV1Options struct {
// Polling configuration for this entity operation.
Polling *EntityOperationV1Polling `json:"polling,omitempty" yaml:"polling,omitempty"`
// Patch configuration for update operations.
Patch *EntityOperationV1Patch `json:"patch,omitempty" yaml:"patch,omitempty"`
}
Describes SDK options for entity operations.
type EntityOperationV1Patch ¶
type EntityOperationV1Patch struct {
// Style of patch semantics to use for updates.
// Valid values: "only-send-changed-attributes"
Style string `json:"style" yaml:"style"`
}
Describes patch configuration for update operations.
type EntityOperationV1Polling ¶
type EntityOperationV1Polling struct {
// Overrides the number of seconds before the first request.
DelaySeconds *int `json:"delaySeconds,omitempty" yaml:"delaySeconds,omitempty"`
// Overrides the number of seconds between requests.
IntervalSeconds *int `json:"intervalSeconds,omitempty" yaml:"intervalSeconds,omitempty"`
// Overrides the number of requests to limit polling.
LimitCount *int `json:"limitCount,omitempty" yaml:"limitCount,omitempty"`
// Name of the polling option to use.
Name string `json:"name" yaml:"name"`
}
Describes polling configuration for entity operations.
type EntityVersion ¶
type EntityVersion struct {
// Entity version for Terraform managed resource.
TerraformManagedResource int64 `json:"terraform_managed_resource" yaml:"terraform_managed_resource"`
}
Describes the parsed x-speakeasy-entity-version extension configuration. The data is normalized into values for target-specific entities.
func (*EntityVersion) Clone ¶
func (e *EntityVersion) Clone() *EntityVersion
Clone creates a deep copy of the EntityVersion
func (*EntityVersion) Merge ¶
func (e *EntityVersion) Merge(other *EntityVersion)
Merges the given EntityVersion into this EntityVersion. The algorithm adds data from the given EntityVersion to this EntityVersion where it is undefined. Where there is conflicting data, this EntityVersion's data is preserved or otherwise delegated to data-specific merge functionality. It does not remove any data from this EntityVersion.
type Extension ¶
type Extension int
const ( ExtUsageExample Extension = iota ExtRetries ExtServerID ExtNameOverride ExtInclude ExtIgnore ExtGlobals ExtGlobalsHidden ExtExample ExtGroup ExtEnums ExtEnumDescriptions ExtEnumFormat ExtDeprecationReplacement ExtDeprecationMessage ExtPagination ExtTypeOverride ExtErrors ExtErrorMessage ExtExtensionRewrite ExtDocs ExtTest ExtTestInternalDirectives ExtTestID ExtTestIgnore ExtTestServer ExtDocsRateLimits ExtMaxMethodParams ExtExampleUnset ExtUnknownValues ExtFlattenRequest ExtTimeout ExtSSESentinel ExtTransformFromAPI ExtTransformToAPI ExtCustomSecurityScheme ExtParamEncodingOverride ExtWebhooks ExtReactHook ExtMCP ExtTokenEndpointAuth ExtEntity ExtEntityDescription ExtEntityOperation ExtEntityOperations ExtEntityVersion ExtMatch ExtTerraformAliasTo ExtTerraformCustomDefault ExtTerraformIgnore ExtTerraformWriteOnly ExtResponseFilter ExtTokenEndpointAdditionalPropertiess ExtWrappedAttribute ExtSSEOverload ExtOverridableOAuth2Scopes ExtPolling ExtEntityMissingCodes ExtAllowEmptyValue ExtModelNamespace ExtDiscriminator ExtBase64InputMode ExtPublicExports ExtGoOptionalMethodArguments ExtCLICommands ExtCLIErrors )
type ExtensionScope ¶
type ExtensionScope int
const ( Global ExtensionScope = iota Operation Parameter )
type Extensions ¶
type Extensions struct {
// contains filtered or unexported fields
}
func New ¶
func New(target types.Target) *Extensions
func (*Extensions) Base64InputMode ¶
func (e *Extensions) Base64InputMode(schema *oas3.Schema) (string, error)
Base64InputMode returns the value of the x-speakeasy-base64-input-mode extension on a schema. Any value other than "file" is treated as unset (returns "").
func (*Extensions) CollectCLIBodySchemas ¶ added in v2.936.0
func (e *Extensions) CollectCLIBodySchemas(ctx context.Context, docInfo *document.DocumentInfo) (map[string]string, error)
CollectCLIBodySchemas extracts a self-contained JSON Schema for every operation's application/json request body, keyed by operationId. Each schema bundles its transitive component dependencies under $defs with rewritten references, so a CLI can print an exact, machine-readable request-body schema (e.g. behind a --schema flag) with zero hand-authoring.
func (*Extensions) DoesParamAllowReserved ¶
func (e *Extensions) DoesParamAllowReserved(param *openapi.Parameter) (allowed bool, unsupported bool)
DoesParamAllowReserved reports whether the parameter requests reserved characters to pass through unencoded. Query parameters opt in via the spec's allowReserved keyword; Path parameters only support the extension.
func (*Extensions) GetCustomDocs ¶
func (e *Extensions) GetCustomDocs(extensions OAExtensions) (Comments, error)
func (*Extensions) GetDeprecationMessage ¶
func (e *Extensions) GetDeprecationMessage(extensions OAExtensions) (string, error)
func (*Extensions) GetDeprecationReplacement ¶
func (e *Extensions) GetDeprecationReplacement(extensions OAExtensions) (string, error)
func (*Extensions) GetDiscriminatorNameOverrides ¶
func (*Extensions) GetEnumDescriptions ¶
func (*Extensions) GetEnumFormat ¶
func (e *Extensions) GetEnumFormat(schema *oas3.Schema) (string, error)
func (*Extensions) GetEnumNames ¶
func (*Extensions) GetFlattenRequest ¶
func (e *Extensions) GetFlattenRequest(extensions OAExtensions) (*bool, error)
func (*Extensions) GetGoOptionalMethodArguments ¶
func (e *Extensions) GetGoOptionalMethodArguments(extensions OAExtensions) (*GoOptionalMethodArguments, error)
func (*Extensions) GetGroups ¶
func (e *Extensions) GetGroups(operation *openapi.Operation) ([]string, error)
func (*Extensions) GetGroupsWithNode ¶
GetGroupsWithNode returns the groups for an operation along with the yaml node for error reporting
func (*Extensions) GetMaxMethodParams ¶
func (e *Extensions) GetMaxMethodParams(extensions OAExtensions) (*int, error)
func (*Extensions) GetModelNamespace ¶
func (e *Extensions) GetModelNamespace(extensions OAExtensions) (string, error)
GetModelNamespace returns the namespace for a schema, used to organize component schemas into namespace folders. This enables multiple components with the same name to exist in different namespaces without conflict.
The namespace value must contain only alphanumeric characters, underscores, hyphens, and dots. Nested namespaces (containing forward slashes) are not currently supported.
func (*Extensions) GetOverridableOAuth2Scopes ¶
func (e *Extensions) GetOverridableOAuth2Scopes(flow *openapi.OAuthFlow) (bool, error)
func (*Extensions) GetPropertyName ¶
func (e *Extensions) GetPropertyName(s *oas3.JSONSchema[oas3.Referenceable], resolvedSchema *oas3.JSONSchema[oas3.Concrete], originalName string, ignoreResolvedNameOverride bool) (string, error)
func (*Extensions) GetResolvedName ¶
func (e *Extensions) GetResolvedName(ext Extension) string
func (*Extensions) GetResolvedSchemaName ¶
func (e *Extensions) GetResolvedSchemaName(extensions OAExtensions, originalName string) (string, error)
func (*Extensions) GetSSEOverload ¶
func (e *Extensions) GetSSEOverload(extensions OAExtensions) (bool, error)
func (*Extensions) GetSecuritySchemeExample ¶
func (e *Extensions) GetSecuritySchemeExample(scheme *openapi.SecurityScheme) *yaml.Node
func (*Extensions) GetServerID ¶
func (e *Extensions) GetServerID(server *openapi.Server) (string, error)
func (*Extensions) GetTestDirectives ¶
func (e *Extensions) GetTestDirectives(extensions OAExtensions) ([]string, error)
func (*Extensions) GetTestID ¶
func (e *Extensions) GetTestID(operation *openapi.Operation) (string, error)
func (*Extensions) GetTokenServerAuthentication ¶
func (e *Extensions) GetTokenServerAuthentication(securityScheme *openapi.OAuthFlow) (string, error)
func (*Extensions) GetUsageConfig ¶
func (e *Extensions) GetUsageConfig(extensions OAExtensions) (*UsageExampleConfig, error)
func (*Extensions) HandleAllowEmptyQueryParameterValueExtension ¶
func (e *Extensions) HandleAllowEmptyQueryParameterValueExtension(param *openapi.Parameter) (bool, error)
func (*Extensions) HandleCLICommandsExtension ¶ added in v2.936.0
func (e *Extensions) HandleCLICommandsExtension(ctx context.Context, docInfo *document.DocumentInfo) (*CLICommandManifest, error)
HandleCLICommandsExtension decodes the document-level x-speakeasy-cli-commands extension. Returns nil when the extension is absent. Warnings are reported through the generation logger; errors abort generation with the offending node attached.
func (*Extensions) HandleCLIErrorsExtension ¶ added in v2.936.0
func (e *Extensions) HandleCLIErrorsExtension(_ context.Context, docInfo *document.DocumentInfo) (*CLIErrorManifest, error)
HandleCLIErrorsExtension decodes the document-level x-speakeasy-cli-errors extension. Returns nil when the extension is absent.
func (*Extensions) HandleClassNameExtension ¶
func (e *Extensions) HandleClassNameExtension(extensions OAExtensions) (*NameOverride, error)
func (*Extensions) HandleCustomSecurityConfig ¶
func (e *Extensions) HandleCustomSecurityConfig(ctx context.Context, exts OAExtensions) (*CustomSecurityConfig, error)
func (*Extensions) HandleDocsRateLimitExtension ¶
func (e *Extensions) HandleDocsRateLimitExtension(operation *openapi.Operation) ([]RateLimit, error)
func (*Extensions) HandleEntityDescriptionExtension ¶
func (e *Extensions) HandleEntityDescriptionExtension(extensions OAExtensions) (*EntityDescription, error)
Handles parsing of the x-speakeasy-entity-description extension from the given OpenAPI extensions map.
func (*Extensions) HandleEntityExtension ¶
func (e *Extensions) HandleEntityExtension(extensions OAExtensions) (*Entity, error)
Handles parsing of the x-speakeasy-entity extension from the given OpenAPI extensions map.
func (*Extensions) HandleEntityMissingCodesExtension ¶
func (e *Extensions) HandleEntityMissingCodesExtension(extensions OAExtensions) (EntityMissingCodes, error)
HandleEntityMissingCodesExtension handles parsing of the x-speakeasy-entity-missing-codes extension from the given OpenAPI extensions map.
func (*Extensions) HandleEntityOperationExtension ¶
func (e *Extensions) HandleEntityOperationExtension(operation *openapi.Operation) (*EntityOperationV1, error)
Handles parsing of the x-speakeasy-entity-operation extension from the given OpenAPI operation.
func (*Extensions) HandleEntityVersionExtension ¶
func (e *Extensions) HandleEntityVersionExtension(extensions OAExtensions) (*EntityVersion, error)
Handles parsing of the x-speakeasy-entity-version extension from the given OpenAPI extensions map.
func (*Extensions) HandleErrors ¶
func (e *Extensions) HandleErrors(extensions OAExtensions) (*Errors, error)
func (*Extensions) HandleExampleUnsetExtension ¶
func (e *Extensions) HandleExampleUnsetExtension(extensions OAExtensions) (*bool, error)
Handles parsing of the x-speakeasy-example-unset extension from the given OpenAPI extensions map.
func (*Extensions) HandleGlobalNameOverrideExtensions ¶
func (e *Extensions) HandleGlobalNameOverrideExtensions(doc *openapi.OpenAPI) ([]*NameOverride, error)
func (*Extensions) HandleGlobalRetryExtension ¶
func (*Extensions) HandleGlobalTimeoutExtension ¶
func (e *Extensions) HandleGlobalTimeoutExtension(doc *openapi.OpenAPI) (*int64, error)
func (*Extensions) HandleGlobalsExtension ¶
func (*Extensions) HandleIgnoreExtension ¶
func (e *Extensions) HandleIgnoreExtension(extensions OAExtensions) (*bool, error)
Handles parsing of the x-speakeasy-ignore extension from the given OpenAPI extensions map.
func (*Extensions) HandleMCPExtension ¶
func (e *Extensions) HandleMCPExtension(operation *openapi.Operation) (*MCP, error)
func (*Extensions) HandleMatchExtension ¶
func (e *Extensions) HandleMatchExtension(extensions OAExtensions) (*MatchConfig, error)
Handles parsing of the x-speakeasy-match extension from the given OpenAPI extensions map.
func (*Extensions) HandleOperationMethodNameExtension ¶
func (e *Extensions) HandleOperationMethodNameExtension(operation *openapi.Operation) (*NameOverride, bool, error)
func (*Extensions) HandleOperationPaginationExtension ¶
func (e *Extensions) HandleOperationPaginationExtension(ctx context.Context, operation *openapi.Operation, docInfo *document.DocumentInfo) (*Pagination, error)
func (*Extensions) HandleOperationParameterNameExtension ¶
func (e *Extensions) HandleOperationParameterNameExtension(param *openapi.Parameter) (*NameOverride, bool, error)
func (*Extensions) HandleOperationRetryExtension ¶
func (*Extensions) HandleOperationTimeoutExtension ¶
func (*Extensions) HandlePollingExtension ¶
func (e *Extensions) HandlePollingExtension(extensions OAExtensions) (*Polling, error)
Handles parsing of the x-speakeasy-polling extension from the given OpenAPI extensions map.
func (*Extensions) HandlePublicExportsExtension ¶
func (e *Extensions) HandlePublicExportsExtension(extensions OAExtensions) ([]PublicExport, error)
func (*Extensions) HandleReactHookExtension ¶
func (e *Extensions) HandleReactHookExtension(operation *openapi.Operation) (*ReactHook, error)
func (*Extensions) HandleResponseFilterExtension ¶
func (e *Extensions) HandleResponseFilterExtension(extensions OAExtensions) (*bool, error)
Handles parsing of the x-speakeasy-response-filter extension from the given OpenAPI extensions map.
func (*Extensions) HandleRewriteExtension ¶
func (e *Extensions) HandleRewriteExtension(opts ...HandleRewriteExtensionOption) error
func (*Extensions) HandleSSESentinelExtension ¶
func (e *Extensions) HandleSSESentinelExtension(extensions OAExtensions) (*SSESentinel, error)
func (*Extensions) HandleSSESentinelExtensionString ¶
func (e *Extensions) HandleSSESentinelExtensionString(extensions OAExtensions) string
func (*Extensions) HandleTerraformAliasToExtension ¶
func (e *Extensions) HandleTerraformAliasToExtension(extensions OAExtensions) (*string, error)
Handles parsing of the x-speakeasy-terraform-alias-to extension from the given OpenAPI extensions map.
func (*Extensions) HandleTerraformCustomDefaultExtension ¶
func (e *Extensions) HandleTerraformCustomDefaultExtension(extensions OAExtensions) (*TerraformCustomDefault, error)
Handles parsing of the x-speakeasy-terraform-custom-default extension from the given OpenAPI extensions map.
func (*Extensions) HandleTerraformIgnoreExtension ¶
func (e *Extensions) HandleTerraformIgnoreExtension(extensions OAExtensions) (*TerraformIgnore, error)
Handles parsing of the x-speakeasy-terraform-ignore extension from the given OpenAPI extensions map.
func (*Extensions) HandleTerraformWriteOnlyExtension ¶
func (e *Extensions) HandleTerraformWriteOnlyExtension(extensions OAExtensions) (*bool, error)
Handles parsing of the x-speakeasy-terraform-write-only extension from the given OpenAPI extensions map.
func (*Extensions) HandleTransformExtension ¶
func (e *Extensions) HandleTransformExtension(ext OAExtensions, transformExt Extension) (*TransformerConfig, error)
func (*Extensions) HandleWebhooksExtension ¶
func (e *Extensions) HandleWebhooksExtension(extensions OAExtensions) (*Webhooks, error)
func (*Extensions) HandleWrappedAttributeExtension ¶
func (e *Extensions) HandleWrappedAttributeExtension(extensions OAExtensions) (*string, error)
Handles parsing of the x-speakeasy-wrapped-attribute extension from the given OpenAPI extensions map.
func (*Extensions) Ignore ¶
func (e *Extensions) Ignore(extensions OAExtensions) (bool, error)
func (*Extensions) IncludeSchema ¶
func (e *Extensions) IncludeSchema(schema *oas3.JSONSchema[oas3.Concrete]) (bool, error)
func (*Extensions) IsErrorMessage ¶
func (e *Extensions) IsErrorMessage(extensions OAExtensions) (bool, error)
func (*Extensions) IsExtensionIdentifying ¶
func (e *Extensions) IsExtensionIdentifying(extName string) bool
IsExtensionIdentifying returns true if the extension affects schema identity and should prevent a schema from being considered "empty" during allOf processing. This is different from IsExtensionMergable - some extensions like x-speakeasy-name-override should not be merged into child schemas during oneOf processing, but DO affect identity when building unique references for allOf schemas.
func (*Extensions) IsExtensionMergable ¶
func (e *Extensions) IsExtensionMergable(extName string) bool
func (*Extensions) IsGlobalHidden ¶
func (*Extensions) IsOpenEnum ¶
func (e *Extensions) IsOpenEnum(schema *oas3.Schema) (bool, error)
func (*Extensions) IsTestIgnored ¶
func (e *Extensions) IsTestIgnored(extensions OAExtensions) (bool, error)
func (*Extensions) IsTestingEnabled ¶
func (e *Extensions) IsTestingEnabled(extensions OAExtensions) (*bool, error)
func (*Extensions) IsUsageExample ¶
func (e *Extensions) IsUsageExample(extensions OAExtensions) (bool, error)
func (*Extensions) OperationCanHaveSSEOverload ¶
func (e *Extensions) OperationCanHaveSSEOverload(ctx context.Context, op *openapi.Operation, docInfo *document.DocumentInfo) (*SSEOverloadConfig, error)
OperationCanHaveSSEOverload validates that an operation is compatible with the x-speakeasy-sse-overload extension. The operation must have a boolean `stream` discriminator either in the request body or as a query parameter, and exactly two successful response content types: 1 text/event-stream and 1 application/json. Returns the resolved stream-field ref on success.
func (*Extensions) OperationCanInferSSEOverload ¶
func (e *Extensions) OperationCanInferSSEOverload(ctx context.Context, op *openapi.Operation, docInfo *document.DocumentInfo) (*SSEOverloadConfig, error)
OperationCanInferSSEOverload validates body-stream eligibility for generation.inferSSEOverload. Inference intentionally remains body-only; query-stream operations must opt in explicitly. Returns (nil, nil) when the operation is simply not a candidate (no body, no stream field, etc.). Fatal failures (e.g. broken $ref) are surfaced as errors.
func (*Extensions) ParseGlobalNameOverrideExtension ¶
func (e *Extensions) ParseGlobalNameOverrideExtension(nameOverrideExtension *yaml.Node) ([]*NameOverride, error)
func (*Extensions) TypeOverride ¶
func (e *Extensions) TypeOverride(extensions OAExtensions) (string, error)
type Globals ¶
type Globals struct {
marshaller.Model[CoreGlobals]
Parameters []*openapi.ReferencedParameter
}
type GoOptionalMethodArguments ¶
type GoOptionalMethodArguments string
const ( GoOptionalMethodArgumentsPointers GoOptionalMethodArguments = "pointers" GoOptionalMethodArgumentsMethodOptions GoOptionalMethodArguments = "method-options" )
type HandleRewriteExtensionOption ¶
type HandleRewriteExtensionOption func(*HandleRewriteExtensionOptions)
func WithDocumentExtensions ¶
func WithDocumentExtensions(extensions OAExtensions) HandleRewriteExtensionOption
func WithRewritesExtensionNode ¶
func WithRewritesExtensionNode(node *yaml.Node) HandleRewriteExtensionOption
type HandleRewriteExtensionOptions ¶
type HandleRewriteExtensionOptions struct {
Extensions OAExtensions
Node *yaml.Node
}
type MCP ¶
type MCP struct {
Disabled bool `json:"disabled" yaml:"disabled"`
Name string `json:"name" yaml:"name"`
Scopes []string `json:"scopes" yaml:"scopes"`
Description string `json:"description" yaml:"description"`
Title string `json:"title" yaml:"title"`
DestructiveHint bool `json:"destructiveHint" yaml:"destructiveHint"`
IdempotentHint bool `json:"idempotentHint" yaml:"idempotentHint"`
OpenWorldHint bool `json:"openWorldHint" yaml:"openWorldHint"`
ReadOnlyHint bool `json:"readOnlyHint" yaml:"readOnlyHint"`
}
type MatchConfig ¶
type MatchConfig struct {
// Path to match in the entity (e.g., "id", "object.id")
// When specified as a scalar string, this field is populated.
Path *string `json:"path,omitempty" yaml:"path,omitempty"`
// Whether to use the prior state value for this parameter in update operations.
UsePriorState bool `json:"usePriorState,omitempty" yaml:"usePriorState,omitempty"`
}
MatchConfig describes the x-speakeasy-match extension configuration. It can be used to alias/map parameters to entity fields or to specify that prior state values should be used for parameters in update operations.
type NameOverride ¶
type NameOverride struct {
OperationId string `json:"operationId" yaml:"operationId"`
GlobalMethodNameOverride string `json:"methodNameOverride" yaml:"methodNameOverride"`
ParameterName string `json:"parameterName" yaml:"parameterName"`
GlobalParameterNameOverride string `json:"parameterNameOverride" yaml:"parameterNameOverride"`
Name string
Node *yaml.Node // The yaml node where this extension is defined (for error reporting)
}
type OAExtensions ¶
type OAExtensions = *extensions.Extensions
type Pagination ¶
type Pagination struct {
Type PaginationType `json:"type" yaml:"type"`
Inputs []PaginationInputs `json:"inputs" yaml:"inputs"`
Outputs PaginationOutputs `json:"outputs" yaml:"outputs"`
}
func (*Pagination) Clone ¶
func (p *Pagination) Clone() *Pagination
Clone creates a deep copy of the Pagination
type PaginationInputInType ¶
type PaginationInputInType string
const ( PaginationInputInTypeParameters PaginationInputInType = "parameters" PaginationInputInTypeRequestBody PaginationInputInType = "requestBody" )
type PaginationInputType ¶
type PaginationInputType string
const ( PaginationInputTypeLimit PaginationInputType = "limit" PaginationInputTypeOffset PaginationInputType = "offset" PaginationInputTypePage PaginationInputType = "page" PaginationInputTypeCursor PaginationInputType = "cursor" )
type PaginationInputs ¶
type PaginationInputs struct {
Name string `json:"name" yaml:"name"`
In PaginationInputInType `json:"in" yaml:"in"`
Type PaginationInputType `json:"type" yaml:"type"`
Optional bool
}
func (PaginationInputs) Clone ¶
func (i PaginationInputs) Clone() PaginationInputs
Clone creates a deep copy of the PaginationInputs
type PaginationOutputs ¶
type PaginationOutputs struct {
// CanUseDotNotation indicates that the JSONPath expressions in this
// pagination config are simple enough and it is possible to use a
// lightweight and more performant object-drilling library instead of a
// JSONPath library.
CanUseDotNotation bool `json:"-" yaml:"-"`
Results string `json:"results" yaml:"results"`
ResultsDot string `json:"-" yaml:"-"`
NumPages string `json:"numPages" yaml:"numPages"`
NumPagesDot string `json:"-" yaml:"-"`
NextCursor string `json:"nextCursor" yaml:"nextCursor"`
NextCursorDot string `json:"-" yaml:"-"`
NextURL string `json:"nextUrl" yaml:"nextUrl"`
NextURLDot string `json:"-" yaml:"-"`
}
func (PaginationOutputs) Clone ¶
func (o PaginationOutputs) Clone() PaginationOutputs
Clone creates a deep copy of the PaginationOutputs
type PaginationType ¶
type PaginationType string
const ( PaginationTypeOffsetLimit PaginationType = "offsetLimit" PaginationTypeCursor PaginationType = "cursor" PaginationTypeURL PaginationType = "url" )
type Polling ¶
type Polling struct {
// Collection of polling options.
Options PollingOptions `json:"options" yaml:"options"`
}
Describes parsed and normalized x-speakeasy-polling extension configuration.
type PollingCriteria ¶
type PollingCriteria []*PollingCriterion
Collection of polling criterion.
func (PollingCriteria) Clone ¶
func (c PollingCriteria) Clone() PollingCriteria
Clone creates a deep copy of the PollingCriteria.
type PollingCriterion ¶
type PollingCriterion struct {
// Condition for the polling criterion. For simple type criterion, this is
// typically a full expression such as `$statusCode == 200`. For regex type
// criterion, this is the regular expression pattern.
Condition *criterion.Condition `json:"condition,omitempty" yaml:"condition,omitempty"`
// Context is the expression to the value to be evaluated. Required for
// regex type criterion.
Context *expression.Expression `json:"context,omitempty" yaml:"context,omitempty"`
// Type is the type of criterion. Defaults to CriterionTypeSimple.
Type criterion.CriterionType `json:"type,omitempty" yaml:"type,omitempty"`
}
Describes a single polling criterion, such as a target condition.
func (*PollingCriterion) Clone ¶
func (c *PollingCriterion) Clone() *PollingCriterion
Clone creates a deep copy of the PollingCriterion.
func (*PollingCriterion) UnmarshalYAML ¶
func (c *PollingCriterion) UnmarshalYAML(node *yaml.Node) error
UnmarshalYAML implements the yaml.Unmarshaler interface for PollingCriterion.
type PollingOption ¶
type PollingOption struct {
// Delay in seconds before polling calls begin. Defaults to 1.
DelaySeconds *int64 `json:"delaySeconds,omitempty" yaml:"delaySeconds,omitempty"`
// Descibes immediate failure criteria for the polling option. When all
// matching criteria are met (AND boolean), the operation will immediately
// return an error.
FailureCriteria PollingCriteria `json:"failureCriteria,omitempty" yaml:"failureCriteria,omitempty"`
// Interval between polling calls in seconds. Defaults to 1.
IntervalSeconds *int64 `json:"intervalSeconds,omitempty" yaml:"intervalSeconds,omitempty"`
// Name of the polling option.
Name string `json:"name" yaml:"name"`
// Number of polling calls not matching the FailureCriteria or
// SuccessCriteria before returning a timeout error. Defaults to 60.
LimitCount *int64 `json:"limitCount,omitempty" yaml:"limitCount,omitempty"`
// Descibes success criteria for the polling option. When all matching
// criteria are met (AND boolean), the operation will return successfully.
SuccessCriteria PollingCriteria `json:"successCriteria,omitempty" yaml:"successCriteria,omitempty"`
}
Describes a single polling option.
func (*PollingOption) Clone ¶
func (o *PollingOption) Clone() *PollingOption
Clone creates a deep copy of the PollingOption.
func (*PollingOption) UnmarshalYAML ¶
func (o *PollingOption) UnmarshalYAML(node *yaml.Node) error
UnmarshalYAML implements the yaml.Unmarshaler interface for PollingOption.
type PollingOptions ¶
type PollingOptions []*PollingOption
Collection of PollingOption.
func (PollingOptions) Clone ¶
func (o PollingOptions) Clone() PollingOptions
Clone creates a deep copy of the PollingOptions.
type PublicExport ¶
type PublicExport struct {
Group string `json:"group" yaml:"group"`
Name string `json:"name" yaml:"name"`
// Representation selects the rendering the alias refers to: "model"
// (default) or "input". See PublicExportRepresentation.
Representation PublicExportRepresentation `json:"representation,omitempty" yaml:"representation,omitempty"`
}
func (PublicExport) Input ¶
func (p PublicExport) Input() bool
Input reports whether the export aliases the request-input rendering.
func (PublicExport) IsZero ¶
func (p PublicExport) IsZero() bool
func (PublicExport) Key ¶
func (p PublicExport) Key() string
func (PublicExport) Normalize ¶
func (p PublicExport) Normalize() PublicExport
type PublicExportRepresentation ¶
type PublicExportRepresentation string
PublicExportRepresentation selects which rendering of the target type an export alias refers to in languages that generate more than one.
const ( // PublicExportRepresentationModel aliases the type's primary rendering // (e.g. the Pydantic model class in Python). This is the default. PublicExportRepresentationModel PublicExportRepresentation = "model" // PublicExportRepresentationInput aliases the type's request-input // rendering where the language generates a separate one — e.g. the // TypedDict companion in Python, used when callers pass plain dicts. // Languages without a separate input rendering, and targets without an // input companion (enums, errors), fall back to the model rendering. PublicExportRepresentationInput PublicExportRepresentation = "input" )
type RateLimit ¶
type RateLimit struct {
Strategy string `json:"strategy" yaml:"strategy"`
SlidingWindow *WindowStrategy `json:"sliding_window" yaml:"sliding_window"`
Identifier string `json:"identifier" yaml:"identifier"`
Description string `json:"description" yaml:"description"`
}
type ReactHook ¶
type ReactHook struct {
Disabled bool `json:"disabled" yaml:"disabled"`
Name string `json:"name" yaml:"name"`
Type string `json:"type" yaml:"type"`
QueryKey *ReactHookQueryKey `json:"queryKey" yaml:"queryKey"`
}
type ReactHookQueryKey ¶
type ReactHookQueryKey struct {
IncludeRequestBody bool `json:"includeRequestBody" yaml:"includeRequestBody"`
}
type Retries ¶
type Retries struct {
Strategy string `json:"strategy" yaml:"strategy,omitempty"`
DefaultApplied bool `json:"defaultApplied,omitempty" yaml:"defaultApplied,omitempty"`
Disabled *bool `json:"disabled,omitempty" yaml:"disabled,omitempty"`
Backoff *BackoffStrategy `json:"backoff" yaml:"backoff,omitempty"`
StatusCodes []string `json:"statusCodes" yaml:"statusCodes,omitempty"`
RetryConnectionErrors *bool `json:"retryConnectionErrors" yaml:"retryConnectionErrors,omitempty"`
MaxRetries *int `json:"maxRetries" yaml:"maxRetries,omitempty"`
}
type SSEOverloadConfig ¶
SSEOverloadConfig identifies the boolean field that toggles SSE overload for an operation. Name is not user-configurable today: always falls back to defaultSSEOverloadSelectorName.
type SSESentinel ¶
type SSESentinel struct {
DataValue string
}
type TerraformCustomDefault ¶
type TerraformCustomDefault struct {
// Go package imports required for the custom default.
Imports []string `json:"imports" yaml:"imports"`
// Code rendered into the schema to instantiate the custom default
// implementation.
SchemaDefinition string `json:"schemaDefinition" yaml:"schemaDefinition"`
}
Describes the parsed x-speakeasy-terraform-custom-default extension configuration.
func (*TerraformCustomDefault) Clone ¶
func (t *TerraformCustomDefault) Clone() *TerraformCustomDefault
Clone creates a deep copy of the TerraformCustomDefault
type TerraformIgnore ¶
type TerraformIgnore struct {
// When enabled, the field will be ignored in Terraform data models.
// Enabled when the ignore extension is set to true.
DataModel bool `json:"dataModel" yaml:"dataModel"`
// When enabled, the field will be ignored in Terraform schema definitions.
// Enabled when the ignore extension is set to true.
Schema bool `json:"schema" yaml:"schema"`
}
Describes the parsed x-speakeasy-terraform-ignore extension configuration.
When the extension is set to true, all values will be ignored.
func (*TerraformIgnore) Clone ¶
func (t *TerraformIgnore) Clone() *TerraformIgnore
Clone creates a deep copy of the TerraformIgnore
type TransformerConfig ¶
type TransformerConfig struct {
Type TransformerType
Config string
}
type TransformerType ¶
type TransformerType string
TransformerType is a string enum that can right now only be "jq"
const (
Jq TransformerType = "jq"
)
type UsageExampleConfig ¶
type WebhookSecurity ¶
type WebhookSecurity struct {
// Valid values for this field are:
//
// * "signature" a configurable signature which respects header name, text encoding and algorithm
//
// * "custom" a custom signature down to the API producer to complete the implementation
//
// * "signatureStandardWebhooks" a preset which conforms to "Standard Webhooks" naming / guidance
//
// * "apiKey" an API key - no signing is performed
Type string `json:"type" yaml:"type"`
// Applicable when Type is "signature"
HeaderName string `json:"headerName" yaml:"headerName,omitempty"`
// Applicable when Type is "signature"
SignatureTextEncoding string `json:"signatureTextEncoding" yaml:"signatureTextEncoding,omitempty"`
// Applicable when Type is "signature"
SignatureAlgorithm string `json:"algorithm" yaml:"algorithm,omitempty"`
// ConsumerShouldProvideSecret is true if the webhook consumer should provide the secret - allows for "custom" type to override the default behavior
ConsumerShouldProvideSecret *bool `json:"consumerShouldProvideSecret" yaml:"consumerShouldProvideSecret,omitempty"`
}
type Webhooks ¶
type Webhooks struct {
// A WebhookSecurity object is used to configure the security for a webhook.
Security *WebhookSecurity `json:"security" yaml:"security,omitempty"`
}
A Webhooks extension is used to configure webhooks for an API.
type WindowStrategy ¶
Source Files
¶
- base64.go
- classnames.go
- cli_body_schemas.go
- cli_commands.go
- cli_commands_link.go
- cli_commands_yaml.go
- cli_errors.go
- cli_jq_lint.go
- comments.go
- discriminator.go
- entity.go
- entity_description.go
- entity_missing_codes.go
- entity_operation_v1.go
- entity_version.go
- enums.go
- errors.go
- eventstream.go
- example_unset.go
- extensions.go
- globals.go
- go_optional_method_arguments.go
- ignore.go
- match.go
- mcp.go
- methodnames.go
- pagination.go
- parameters.go
- pointer.go
- polling.go
- public_exports.go
- ratelimits.go
- reacthook.go
- response_filter.go
- retries.go
- security.go
- sse_overload.go
- terraform_alias_to.go
- terraform_custom_default.go
- terraform_ignore.go
- terraform_write_only.go
- tests.go
- timeouts.go
- transform.go
- usageexample.go
- webhooks.go
- wrapped_attribute.go