Documentation
¶
Overview ¶
Package openapi imports immutable OpenAPI snapshots for the hosted wrapper. It does not generate MCP tools or make requests to the described API.
Index ¶
- Constants
- func Environment(result *Result, headers []types.MCPConfig, devMode bool) ([]string, error)
- func SnapshotEnvironment(config types.OpenAPIRuntimeConfig, headers []types.MCPConfig, devMode bool) ([]string, error)
- func ValidateDestination(ctx context.Context, baseURL string, options safehttp.Options, devMode bool) error
- func ValidateInput(config types.OpenAPIRuntimeConfig) error
- func ValidateSnapshotEnvironment(ctx context.Context, config types.OpenAPIRuntimeConfig, ...) ([]string, error)
- func ValidateSource(source types.OpenAPISource) error
- type Importer
- type Result
Constants ¶
const (
MaxSchemaBytes = 1024 * 1024
)
Variables ¶
This section is empty.
Functions ¶
func Environment ¶
Environment validates credential definitions and returns the wrapper's environment variables. Credential values and prefixes stay in Obot's per-request header handling. Definitions can change after schema import.
func SnapshotEnvironment ¶
func SnapshotEnvironment(config types.OpenAPIRuntimeConfig, headers []types.MCPConfig, devMode bool) ([]string, error)
SnapshotEnvironment constructs deployment settings from the saved snapshot, never Source. Revalidate the snapshot before launching the wrapper because callers can supply a snapshot directly instead of using Importer. Destination policy is checked during manifest validation and immediately before deployment.
func ValidateDestination ¶
func ValidateDestination(ctx context.Context, baseURL string, options safehttp.Options, devMode bool) error
ValidateDestination checks HTTPS and the configured address policy without requesting the API. The runtime must still enforce policy on API requests.
func ValidateInput ¶
func ValidateInput(config types.OpenAPIRuntimeConfig) error
ValidateInput checks user-supplied configuration before importing its source. Schema is output only; Obot always generates it from Source.
func ValidateSnapshotEnvironment ¶
func ValidateSnapshotEnvironment(ctx context.Context, config types.OpenAPIRuntimeConfig, headers []types.MCPConfig, options safehttp.Options, devMode bool) ([]string, error)
ValidateSnapshotEnvironment applies destination policy before producing the environment. It never fetches Source or requests the destination.
func ValidateSource ¶
func ValidateSource(source types.OpenAPISource) error
ValidateSource checks source metadata without fetching the document.
Types ¶
type Importer ¶
type Importer struct {
// contains filtered or unexported fields
}
Importer fetches schema sources. It never receives API credentials.
func NewImporter ¶
NewImporter applies the configured network policy to schema fetches. devMode permits HTTP schema sources and API destinations for local development. Redirects are not followed, including same-origin ones.
func (*Importer) Import ¶
Import always reads Source anew, ignoring any previous Schema snapshot. It returns no replacement snapshot on failure; callers retain the last good one. Destination failures are reported in Result, allowing import previews before an override is configured. Callers must validate destinations before saving or deploying the returned snapshot.
type Result ¶
type Result struct {
Schema json.RawMessage
BaseURL string
SuggestedHeaders []types.MCPConfig
SuggestedMetadata types.OpenAPIMetadata
DestinationValidation types.OpenAPIDestinationValidation
}
Result contains the stored schema, resolved API destination, and suggested credential inputs. MCP tools are generated and listed by the hosted wrapper.
func Parse ¶
func Parse(data []byte, config types.OpenAPIRuntimeConfig) (*Result, error)
Parse normalizes JSON/YAML and checks the wrapper's supported subset. It does not resolve remote references or claim to validate every OpenAPI constraint. The importer applies transport and network policies after parsing. SuggestedHeaders are editable definitions, not credential values.