barometer

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 5 Imported by: 0

README

Barometer

Barometer is a Go package, CLI, and GitHub Action for contract testing and validation of APIs using OpenAPI (3.0.x, 3.1.x, 3.2) and Arazzo workflow documents. It runs requests against a live API and validates responses against the spec (status, headers, body schema) and executes multi-step Arazzo workflows. Swagger/OAS 2.0 inputs are detected and rejected until dedicated runtime support is added.

Features

  • OpenAPI contract tests: Load a spec, hit every (or filtered) operation, validate response status and body schema.
  • Arazzo workflows: Run multi-step API workflows with runtime expressions, success criteria, and outputs.
  • CLI: barometer openapi validate|test, barometer arazzo validate|run, barometer contract test.
  • Output: Human, JUnit XML, or versioned JSON with one shared report shape for CLI, action, and Go integrations.
  • Async API: barometer.Start(ctx, config) returns a Job for IDE/LSP integration without blocking.

Install

go install github.com/sailpoint-oss/barometer/cmd/barometer@latest

# Go library
go get github.com/sailpoint-oss/barometer

Quick start

# Validate an OpenAPI 3.x spec
barometer openapi validate openapi.yaml

# Run contract tests against a base URL
barometer openapi test openapi.yaml https://api.example.com

# Validate an Arazzo document
barometer arazzo validate arazzo.yaml

# Run Arazzo workflows
barometer arazzo run arazzo.yaml https://api.example.com

# Unified run from config
barometer contract test --config barometer.yaml

Config file

Create barometer.yaml:

baseUrl: https://api.example.com
openapi:
  spec: ./openapi.yaml
  tags: [pet, store]
arazzo:
  doc: ./arazzo.yaml
  workflows: []   # empty = all
output: json      # human, junit, json

GitHub Action

- uses: sailpoint-oss/barometer/.github/actions/barometer@v1
  with:
    openapi-spec: './openapi.yaml'
    openapi-tags: 'pet,store'
    base-url: 'https://api.example.com'
    arazzo-doc: './arazzo.yaml'
    arazzo-workflows: 'syncWidgets'
    output-format: 'json'

When config is omitted, the action now builds one temporary contract config from the flat OpenAPI/Arazzo inputs and still executes barometer contract test, so report shaping stays consistent across OpenAPI-only and mixed runs. The action exposes result, report-path, report-json, and report-junit outputs so downstream CI steps can consume the exact artifact they need.

Go integration

Import the module root package for the stable public API:

input := barometer.ContractInput{
    BaseURL:     "https://api.example.com",
    OpenAPISpec: "./openapi.yaml",
    ArazzoDoc:   "./arazzo.yaml",
    Output:      barometer.FormatJSON,
}

result, err := barometer.RunInput(ctx, input, barometer.NewClient(nil))
report := barometer.BuildReport(result, time.Second)

Local sibling development

When changing Barometer with other Go repos in the toolchain, prefer a workspace go.work file:

go work init .
go work use ../navigator ../barrelman ../telescope/server

This keeps Barometer pointed at sibling checkouts without editing go.mod.

Release coordination

  • .github/workflows/release.yml publishes Barometer from pushed v* tags after running go test -race -count=1 ./....
  • Run go test ./internal/openapi ./... locally before tagging, especially after Navigator resolver or document-model changes.
  • For shared compatibility and bump order, use navigator/TOOLCHAIN_BOUNDARIES.md.
  • For runtime smoke fixtures and parity anchors, use navigator/TOOLCHAIN_FIXTURE_MATRIX.md.

Toolchain role

Barometer is the runtime contract-testing layer in the shared OpenAPI toolchain:

  • navigator provides the canonical OpenAPI and Arazzo document-loading and validation layer.
  • barometer uses those static contracts to execute live HTTP validations and Arazzo workflows.
  • barometer does not own static parsing, semantic linting, or editor UX.

In other words: Navigator owns the static document contract; Barometer owns runtime execution against that contract. Telescope and Meridian may surface or compose Barometer runs, but Barometer remains the runtime engine.

License

See LICENSE.

Documentation

Overview

Package barometer exposes the stable module-root Go API for Barometer.

Index

Constants

View Source
const (
	FormatHuman       = pkgbarometer.FormatHuman
	FormatJUnit       = pkgbarometer.FormatJUnit
	FormatJSON        = pkgbarometer.FormatJSON
	JSONReportVersion = pkgbarometer.JSONReportVersion
)

Variables

View Source
var (
	ErrConfigRequired = pkgbarometer.ErrConfigRequired
	ErrTargetRequired = pkgbarometer.ErrTargetRequired
)
View Source
var ReportSchemaJSON = pkgbarometer.ReportSchemaJSON

Functions

func WriteOpenAPIReport

func WriteOpenAPIReport(w io.Writer, results []OpenAPIContractResult, format Format, duration time.Duration) error

func WriteReport

func WriteReport(w io.Writer, result *Result, format Format, duration time.Duration) error

Types

type ArazzoConfig

type ArazzoConfig = pkgbarometer.ArazzoConfig

type ArazzoReport

type ArazzoReport = pkgbarometer.ArazzoReport

type ArazzoResult

type ArazzoResult = pkgbarometer.ArazzoResult

type Client

type Client = pkgbarometer.Client

func NewClient

func NewClient(cfg *ClientConfig) (*Client, error)

type ClientConfig

type ClientConfig = pkgbarometer.ClientConfig

type Config

type Config = pkgbarometer.Config

func LoadConfig

func LoadConfig(path string) (*Config, error)

type ContractInput

type ContractInput = pkgbarometer.ContractInput

type Format

type Format = pkgbarometer.Format

type JSONReport

type JSONReport = pkgbarometer.JSONReport

func BuildReport

func BuildReport(result *Result, duration time.Duration) JSONReport

type Job

type Job = pkgbarometer.Job

func Start

func Start(ctx context.Context, cfg *Config, client *Client) (*Job, error)

func StartInput

func StartInput(ctx context.Context, input ContractInput, client *Client) (*Job, error)

func StartWithIndex

func StartWithIndex(ctx context.Context, idx *navigator.Index, baseURL string, opts *RunOpts) *Job

type OpenAPIConfig

type OpenAPIConfig = pkgbarometer.OpenAPIConfig

type OpenAPIContractResult

type OpenAPIContractResult = pkgbarometer.OpenAPIContractResult

type OpenAPIReport

type OpenAPIReport = pkgbarometer.OpenAPIReport

type OpenAPIResult

type OpenAPIResult = pkgbarometer.OpenAPIResult

type Result

type Result = pkgbarometer.Result

func Run

func Run(ctx context.Context, cfg *Config, client *Client) (*Result, error)

func RunInput

func RunInput(ctx context.Context, input ContractInput, client *Client) (*Result, error)

func RunWithIndex

func RunWithIndex(ctx context.Context, idx *navigator.Index, baseURL string, opts *RunOpts) (*Result, error)

type RunOpts

type RunOpts = pkgbarometer.RunOpts

type WorkflowResult

type WorkflowResult = pkgbarometer.WorkflowResult

Directories

Path Synopsis
cmd
barometer command
Command barometer is the CLI for OpenAPI and Arazzo contract testing.
Command barometer is the CLI for OpenAPI and Arazzo contract testing.
internal
arazzo
Package arazzo parses and executes Arazzo workflow documents (OpenAPI Initiative).
Package arazzo parses and executes Arazzo workflow documents (OpenAPI Initiative).
openapi
Package openapi provides loading, validation, and contract testing for OpenAPI 3.0.x, 3.1.x, and 3.2 documents using Navigator's shared index model.
Package openapi provides loading, validation, and contract testing for OpenAPI 3.0.x, 3.1.x, and 3.2 documents using Navigator's shared index model.
runner
Package runner provides HTTP client and execution for contract tests and Arazzo workflows.
Package runner provides HTTP client and execution for contract tests and Arazzo workflows.
testserver
Package testserver provides a comprehensive Huma-based HTTP server that serves an auto-generated OpenAPI spec and implements operations for E2E contract testing.
Package testserver provides a comprehensive Huma-based HTTP server that serves an auto-generated OpenAPI spec and implements operations for E2E contract testing.
pkg
barometer
Package barometer provides the public API for OpenAPI and Arazzo contract testing.
Package barometer provides the public API for OpenAPI and Arazzo contract testing.

Jump to

Keyboard shortcuts

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