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 ¶
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 ¶
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.