openapi

package
v0.4.0-beta Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MPL-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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