oascheck

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package oascheck validates OpenAPI 3.1 documents and values against their schemas, for the tests of the generator and of the api module: a document must pass the schema of the specification, every schema in it must compile as JSON Schema 2020-12, and what the gateway answers must match the schema the document gives for it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSON

func JSON(doc []byte) (any, error)

JSON turns a YAML document into the values encoding/json would read from it.

func Validate

func Validate(doc []byte) error

Validate checks a document: the specification's schema with the OpenAPI dialect for the schemas inside, then every component schema compiled on its own, so a reference to a missing schema fails too.

Types

type Checker

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

Checker checks values against the component schemas of a document.

func NewChecker

func NewChecker(doc []byte) (*Checker, error)

NewChecker reads the component schemas of a document.

func (*Checker) Check

func (ch *Checker) Check(name string, body []byte) error

Check validates a JSON value against the component schema of a name.

Jump to

Keyboard shortcuts

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