openapi

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package openapi validates JSON responses against OpenAPI 3 and Swagger 2 documents.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CachedSpec

func CachedSpec(manifest, protocol, cacheDir string) ([]byte, error)

CachedSpec reads a checksum-pinned API description. The file is populated by internal/conform/specs/fetch.sh; it is never fetched during an offline test.

func CachedSpecManifest

func CachedSpecManifest(b []byte, protocol, cacheDir string) ([]byte, error)

CachedSpecManifest reads a pinned spec using caller-supplied manifest bytes.

Types

type Document

type Document struct {
	// contains filtered or unexported fields
}

func Parse

func Parse(data []byte) (*Document, error)

func (*Document) ValidExtra

func (d *Document) ValidExtra(method, path string, status int, contentType string, body []byte, field string) bool

ValidExtra reports whether every actual occurrence of a collapsed JSON path is explicitly described by the matched response schema and validates there. Unknown schema constructs, absent paths and invalid JSON fail closed.

func (*Document) Validate

func (d *Document) Validate(method, requestPath string, status int, contentType string, body []byte) error

Validate checks status and JSON schema. HLS routes are deliberately excluded.

Jump to

Keyboard shortcuts

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