spec

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package spec provides runtime loading of Swagger 2.0 and OpenAPI 3 specifications, converting Swagger 2.0 to OpenAPI 3 via openapi2conv.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectFormat

func DetectFormat(path string) string

DetectFormat returns "json" or "yaml" based on the file extension.

Types

type FileLoader

type FileLoader struct {
	Logger *log.Logger
}

FileLoader reads specs from the filesystem, detecting Swagger 2.0 and converting to OpenAPI 3 automatically.

func NewFileLoader

func NewFileLoader() *FileLoader

NewFileLoader creates a FileLoader with a stderr logger.

func (*FileLoader) Load

func (l *FileLoader) Load(path string) (*openapi3.T, error)

Load reads the file at path, detects the spec version, and returns a validated OpenAPI 3 document. Swagger 2.0 specs are converted via openapi2conv. YAML and JSON are both supported.

type Loader

type Loader interface {
	Load(path string) (*openapi3.T, error)
}

Loader loads an OpenAPI/Swagger spec from a file path and returns a normalized OpenAPI 3 document.

Jump to

Keyboard shortcuts

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