openapi

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2026 License: Apache-2.0 Imports: 9 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 an OpenAPI document and checks that writgate can serve it: OpenAPI 3.0.x or 3.1.x, with remote $refs off unless asked for.

Index

Constants

This section is empty.

Variables

View Source
var ErrSwagger2 = errors.New("swagger 2.0 is not supported: convert the spec to OpenAPI 3.x first")

ErrSwagger2 is returned for a Swagger 2.0 document.

View Source
var ErrUnsupportedVersion = errors.New("unsupported OpenAPI version: writgate accepts 3.0.x and 3.1.x")

ErrUnsupportedVersion is returned for an OpenAPI version other than 3.0 or 3.1.

Functions

func Load

func Load(data []byte, opts Options) (*v3.Document, error)

Load parses a spec held in memory.

func LoadFile

func LoadFile(path string, opts Options) (*v3.Document, error)

LoadFile reads a spec from disk. Relative file $refs resolve against the spec's own directory.

Types

type Options

type Options struct {
	// BasePath is the directory that relative file $refs resolve against.
	// Empty means file $refs are not followed.
	BasePath string
	// AllowRemoteRefs lets the loader fetch $refs over HTTP(S). Off by
	// default, so loading a spec never makes a network call on its own.
	AllowRemoteRefs bool
	// Logger receives libopenapi's warnings. Nil means stderr. It must never
	// be stdout, which is the MCP channel in stdio mode.
	Logger *slog.Logger
}

Options controls how a spec is loaded.

Jump to

Keyboard shortcuts

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