oas

package
v1.25.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(path string) (string, error)

Generate reads an OpenAPI spec file and generates a probe Workflow YAML string.

func GenerateFromBytes

func GenerateFromBytes(data []byte) (string, error)

GenerateFromBytes generates a probe Workflow YAML from OpenAPI spec bytes.

func ReadReport added in v1.20.0

func ReadReport(path string) (*report.Report, error)

ReadReport reads a report written by --report json.

Types

type Coverage added in v1.20.0

type Coverage struct {
	Spec       string
	Operations []OperationCoverage
	// OperationsOnly is set for a contract that declares no responses, such
	// as a .proto file, whose methods do not say which statuses they end
	// with, so that its coverage is told by operations alone.
	OperationsOnly bool
}

Coverage is how much of an OpenAPI document the steps of a run checked: each operation the document declares, and each response the operation declares, with the steps whose response was matched to it.

func CountCoverage added in v1.20.0

func CountCoverage(spec string, declared []Declared, r *report.Report) (*Coverage, error)

CountCoverage counts the steps of r whose response was matched to each operation and response declared in the contract spec names, such as an OpenAPI document or a .proto file. A step counts for the contract when it names the same path, as the step gave it. It is an error when no step of r was checked against spec.

func NewCoverage added in v1.20.0

func NewCoverage(spec string, r *report.Report) (*Coverage, error)

NewCoverage counts the steps of r whose response was matched to each operation and response of the OpenAPI document at spec. A step counts for the document when it names the same path, as the step gave it.

func (*Coverage) Counts added in v1.20.0

func (c *Coverage) Counts() (operations, checkedOperations, responses, checkedResponses int)

Counts returns how many operations and responses the document declares, and how many of each at least one step checked.

func (*Coverage) Write added in v1.20.0

func (c *Coverage) Write(w io.Writer) error

Write writes the coverage as text: each operation with its responses, marked with ✓ when a step checked it and - when none did, then the totals.

type Declared added in v1.20.0

type Declared struct {
	Operation string
	Responses []string
}

Declared is an operation a contract declares, with the responses it declares for it, in the order it declares them.

type OperationCoverage added in v1.20.0

type OperationCoverage struct {
	Operation string
	Steps     int // the steps whose response was matched to the operation
	Responses []ResponseCoverage
}

OperationCoverage is one operation of a document, such as GET /users/{id}.

type ResponseCoverage added in v1.20.0

type ResponseCoverage struct {
	Response string
	Steps    int // the steps whose response was matched to it
}

ResponseCoverage is one response an operation declares, such as 200, 2XX or default.

Jump to

Keyboard shortcuts

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