Documentation
¶
Overview ¶
Package sdk prepares language-neutral client contracts from OpenAPI documents. Language emitters consume those contracts without requiring generated clients to depend on libopenapi at runtime.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Contract ¶
type Contract struct {
Servers []string
Operations []*Operation
SecuritySchemes []*SecurityScheme
Schemas *orderedmap.Map[string, *highbase.SchemaProxy]
}
Contract is a borrowed effective view over one OpenAPI document. It retains the document's schema proxies so emitters can reuse libopenapi's model generators without introducing a second schema representation. Callers must keep the source document alive for the Contract's lifetime and should release both together. Schema traversal may warm caches on the source document.
type Diagnostic ¶
Diagnostic reports a notable model-generation decision.
type Operation ¶
type Operation struct {
ID string
Method string
Path string
Resource string
Name string
Named bool
Summary string
Description string
Servers []string
Parameters []*Parameter
RequestBody *RequestBody
Responses []*Response
Security []*SecurityRequirement
}
Operation is one effective OpenAPI operation after path-level inheritance. Resource and Name are the public resource and method names. Named reports that the caller chose the method name through PrepareOptions.Names, so emitters may name generated types after it instead of the operationId.
type OperationName ¶
OperationName overrides the public resource and method name for an operation.
type Parameter ¶
type Parameter struct {
Name string
In string
Description string
Required bool
Style string
Explode bool
AllowReserved bool
Schema *highbase.SchemaProxy
}
Parameter is an effective operation parameter.
type ParameterBinding ¶
ParameterBinding maps one OpenAPI operation parameter to one Arazzo workflow input.
type PayloadBinding ¶
PayloadBinding maps one JSON request property to one Arazzo workflow input.
type PrepareOptions ¶
type PrepareOptions struct {
Operations []string
Names map[string]OperationName
}
PrepareOptions selects operations and controls their public names. An empty Operations slice selects every operation with an operationId.
type RequestBody ¶
type RequestBody struct {
Required bool
Description string
Content *orderedmap.Map[string, *highv3.MediaType]
}
RequestBody is an operation request body.
type RequiredSecurityScheme ¶
RequiredSecurityScheme is one named scheme and its required OAuth/OpenID scopes.
type Response ¶
type Response struct {
Status string
Description string
Content *orderedmap.Map[string, *highv3.MediaType]
}
Response is one declared operation response.
type Result ¶
type Result struct {
Files []File
Diagnostics []Diagnostic
}
Result contains generated files and non-fatal model-generation diagnostics.
type SecurityRequirement ¶
type SecurityRequirement struct {
Schemes []*RequiredSecurityScheme
}
SecurityRequirement is one OR alternative. All schemes inside an alternative are required together.
type SecurityScheme ¶
type SecurityScheme struct {
Name string
Type string
In string
ParameterName string
Scheme string
OpenIDConnectURL string
}
SecurityScheme describes how a named OpenAPI security scheme reaches a request.
type Workflow ¶
type Workflow struct {
ID string
Summary string
Description string
Operation *Operation
Inputs *yaml.Node
ParameterBindings []*ParameterBinding
PayloadBindings []*PayloadBinding
SuccessStatuses []string
}
Workflow is a finite Arazzo composition supported by a language emitter. Inputs borrows the workflow's JSON Schema node from the source Arazzo document. The initial compiler deliberately accepts one typed operation step; unsupported control flow is reported instead of being omitted.
func PrepareArazzo ¶
func PrepareArazzo(document *higharazzo.Arazzo, contract *Contract, workflowIDs ...string) ([]*Workflow, error)
PrepareArazzo selects finite Arazzo workflows and binds their operationIds to a prepared OpenAPI contract. The current compiler supports one operation step with an object payload sourced from workflow inputs and status-code criteria.