Documentation
¶
Overview ¶
Package generatedapi turns bounded external API descriptions into ordinary workflow step kinds. Generated kinds expose exact schemas, effects, capabilities, and credential-reference inputs before execution, then route the actual request through the existing HTTP adapter.
The initial source family is a deliberately portable OpenAPI 3.0/3.1 subset. Unsupported or ambiguous source features fail generation instead of being ignored or implemented by a second runtime. HTTP Basic sources require x-hadron-basic-username as a fixed non-secret username; the generated input remains a SecretRef-only password and is resolved by http@v1. Custom apiKey schemes must use a dedicated non-cookie, non-Authorization request header; Authorization credentials use the explicit bearer or Basic mappings.
Index ¶
- Constants
- Variables
- type CredentialDescription
- type Family
- type Kind
- func (k *Kind) Description() OperationDescription
- func (k *Kind) Execute(ctx context.Context, prepared stepkind.PreparedInvocation) (stepkind.StepResult, error)
- func (k *Kind) Spec() stepkind.StepKindSpec
- func (k *Kind) ValidateConfig(ctx context.Context, config graph.Config) []diagnostic.Diagnostic
- type OperationDescription
- type Options
Constants ¶
const ( // SourceFamilyOpenAPI is the stable source-family identifier. SourceFamilyOpenAPI = "openapi" // DefaultMaxSpecBytes is the default source-document bound. DefaultMaxSpecBytes int64 = 2 << 20 )
Variables ¶
var ( // ErrInvalidOptions identifies an invalid generator dependency or bound. ErrInvalidOptions = errors.New("invalid generated API options") // ErrInvalidSource identifies an unsupported or malformed source document. ErrInvalidSource = errors.New("invalid generated API source") // ErrInvalidInvocation identifies input or runtime config that does not // satisfy the generated operation contract. ErrInvalidInvocation = errors.New("invalid generated API invocation") )
Functions ¶
This section is empty.
Types ¶
type CredentialDescription ¶
type CredentialDescription struct {
Input string `json:"input"`
Scheme string `json:"scheme"`
Kind string `json:"kind"`
Header string `json:"header,omitempty"`
Username string `json:"username,omitempty"`
}
CredentialDescription is the non-secret generated credential contract. Input names a typed secret_ref input; it never contains credential material or the reference selected by a workflow invocation.
type Family ¶
type Family struct {
// contains filtered or unexported fields
}
Family is one immutable generated catalog. Its step kinds are ordinary registry entries and do not introduce an alternate execution path.
func GenerateOpenAPI ¶
GenerateOpenAPI generates ordinary first-class step kinds from one bounded OpenAPI 3.0 or 3.1 JSON/YAML document.
func (*Family) Operations ¶
func (f *Family) Operations() []OperationDescription
Operations returns deterministic defensive catalog projections.
func (*Family) SourceDigest ¶
SourceDigest returns the digest of the canonical source document.
type Kind ¶
type Kind struct {
// contains filtered or unexported fields
}
Kind is one generated operation implemented through http@v1.
func (*Kind) Description ¶
func (k *Kind) Description() OperationDescription
Description returns a defensive non-secret operation projection.
func (*Kind) Execute ¶
func (k *Kind) Execute(ctx context.Context, prepared stepkind.PreparedInvocation) (stepkind.StepResult, error)
Execute maps typed operation inputs to a fixed HTTP declaration and invokes http@v1. Credential references remain opaque until that adapter resolves its auth configuration at the existing secret boundary.
func (*Kind) Spec ¶
func (k *Kind) Spec() stepkind.StepKindSpec
Spec returns fresh policy-visible metadata for this generated operation.
func (*Kind) ValidateConfig ¶
func (k *Kind) ValidateConfig(ctx context.Context, config graph.Config) []diagnostic.Diagnostic
ValidateConfig validates only bounded execution controls. Request identity, destination, method, auth, schemas, effects, and capabilities are generated constants and have no runtime override fields.
type OperationDescription ¶
type OperationDescription struct {
SourceFamily string `json:"source_family"`
SourceDigest string `json:"source_digest"`
SourceTitle string `json:"source_title"`
SourceVersion string `json:"source_version"`
Name string `json:"name"`
Version string `json:"version"`
OperationID string `json:"operation_id"`
Method string `json:"method"`
Origin string `json:"origin"`
PathTemplate string `json:"path_template"`
ConfigSchema graph.Schema `json:"config_schema"`
InputSchema graph.Schema `json:"input_schema"`
OutputSchema graph.Schema `json:"output_schema"`
Effects graph.EffectSet `json:"effects"`
RequiredCapabilities []string `json:"required_capabilities"`
Credentials []CredentialDescription `json:"credentials,omitempty"`
SuccessStatuses []int `json:"success_statuses"`
}
OperationDescription is the immutable generated catalog projection used by authoring and policy surfaces before an operation executes.