oracle

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package oracle validates HTTP responses against an OpenAPI operation and reports contract violations.

Oracles are intentionally conservative: a finding means the response deviates from the declared contract in a way that may indicate a bug. 4xx responses to invalid input are not treated as failures unless the status code itself is undocumented.

Index

Constants

View Source
const (
	ClassServerError         = "server_error"
	ClassRequestError        = "request_error"
	ClassUndocumentedStatus  = "undocumented_status"
	ClassInvalidContentType  = "invalid_content_type"
	ClassMalformedResponse   = "malformed_response"
	ClassInvalidResponseBody = "invalid_response_body"
)

Finding classes.

Variables

This section is empty.

Functions

func ValidateValue

func ValidateValue(v any, s *schema.Schema) []string

ValidateValue checks a JSON-decoded value against a normalized schema and returns a list of human-readable validation errors. An empty slice means the value is valid.

Types

type Finding

type Finding struct {
	// Class is a machine-readable category.
	Class string
	// Message is a human-readable explanation.
	Message string
}

Finding is a single oracle finding.

func Validate

func Validate(op *openapi.Operation, outcome *execute.Outcome) []Finding

Validate runs all oracles against an executed operation and returns the findings. An empty slice means the response is consistent with the spec.

Jump to

Keyboard shortcuts

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