contract

package
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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConfigRequired = errors.New("config is required")

Functions

This section is empty.

Types

type ArazzoConfig

type ArazzoConfig struct {
	Doc       string   `yaml:"doc" json:"doc"`
	Workflows []string `yaml:"workflows,omitempty" json:"workflows,omitempty"` // empty = all
}

ArazzoConfig specifies Arazzo workflow run.

type ArazzoResult

type ArazzoResult struct {
	Workflows []WorkflowResult `json:"workflows"`
	Passed    int              `json:"passed"`
	Total     int              `json:"total"`
}

ArazzoResult is the result of Arazzo workflow runs.

type Config

type Config struct {
	OpenAPI  *OpenAPIConfig `yaml:"openapi,omitempty" json:"openapi,omitempty"`
	Arazzo   *ArazzoConfig  `yaml:"arazzo,omitempty" json:"arazzo,omitempty"`
	BaseURL  string         `yaml:"baseUrl,omitempty" json:"baseUrl,omitempty"`
	ProxyURL string         `yaml:"proxyUrl,omitempty" json:"proxyUrl,omitempty"`
	Output   string         `yaml:"output,omitempty" json:"output,omitempty"` // human, junit, json
}

Config is the barometer config file (e.g. barometer.yaml).

func LoadConfig

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

LoadConfig reads a config file from path.

type OpenAPIConfig

type OpenAPIConfig struct {
	Spec string   `yaml:"spec" json:"spec"`
	Tags []string `yaml:"tags,omitempty" json:"tags,omitempty"`
}

OpenAPIConfig specifies OpenAPI contract test run.

type OpenAPIResult

type OpenAPIResult struct {
	Results []openapi.ContractResult `json:"results"`
	Passed  int                      `json:"passed"`
	Total   int                      `json:"total"`
}

OpenAPIResult is the result of OpenAPI contract tests.

type Result

type Result struct {
	OpenAPI *OpenAPIResult `json:"openapi,omitempty"`
	Arazzo  *ArazzoResult  `json:"arazzo,omitempty"`
	Pass    bool           `json:"pass"`
}

Result holds the combined result of a contract test run (OpenAPI + Arazzo).

func Run

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

Run executes contract tests and/or Arazzo workflows from config.

type WorkflowResult

type WorkflowResult struct {
	WorkflowID string         `json:"workflowId"`
	Pass       bool           `json:"pass"`
	Error      string         `json:"error,omitempty"`
	Outputs    map[string]any `json:"outputs,omitempty"`
}

WorkflowResult is the result of one workflow run.

Jump to

Keyboard shortcuts

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