openapi

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package openapi loads and provides access to the embedded OpenAPI specification for API v2.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Operation

type Operation struct {
	openapi3.Operation
	Path   string
	Method string
}

Operation represents an API operation from the OpenAPI specification, including its path and method.

type Schema

type Schema interface {
	Paths() *openapi3.Paths
	Operations() []*Operation
	OperationByID(operationID string) (*Operation, error)
	PathByPath(path string) (*openapi3.PathItem, error)
	AtomizePath(path string) (Schema, error)
	AtomizeOperation(operationID string) (Schema, error)
	MarshalJSON() ([]byte, error)
}

Schema provides access to the embedded OpenAPI specification for API v2.

func LoadEmbeddedSchema

func LoadEmbeddedSchema() Schema

LoadEmbeddedSchema loads the embedded OpenAPI specification and returns a Schema interface for accessing it. This function panics if the embedded spec cannot be loaded, which should never happen and indicates a bug in the code.

func NewFromData

func NewFromData(data []byte) (Schema, error)

NewFromData loads the OpenAPI specification from the given JSON data and returns a Schema interface for accessing it.

func SchemaFactory

func SchemaFactory(inv *cmd.Invocation) Schema

SchemaFactory attempts to fetch the OpenAPI specification from the profile host and returns a Schema interface for accessing it. If any step of this process fails, it falls back to loading the embedded specification and an error is logged. The result is cached for the duration of the process run to avoid repeated fetch attempts.

Jump to

Keyboard shortcuts

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