bundle

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package bundle turns a spec split over files and URLs into one document.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLoad     = errors.New("load referenced file")
	ErrTarget   = errors.New("ref target not found")
	ErrFragment = errors.New("ref fragment is not a JSON pointer")
	ErrCycle    = errors.New("ref cycle")
	ErrInline   = errors.New("inlined ref target is not an object")
)

Functions

func IsURL

func IsURL(loc string) bool

IsURL reports whether a spec location is fetched over HTTP rather than read from disk.

func Run

func Run(ctx context.Context, in Input) (bool, []diag.Diagnostic, error)

Run lifts what the root's refs point at in other files into its components, in place, and inlines path items. It reports whether the document changed.

Types

type Input

type Input struct {
	Doc      *oasdoc.Doc
	Location string
	BaseDir  string
	Load     Loader
}

Input is the root spec. Its refs resolve against BaseDir when set, else next to Location.

type Loader

type Loader func(ctx context.Context, location string) ([]byte, error)

Loader reads a file path or URL.

Jump to

Keyboard shortcuts

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