Documentation
¶
Overview ¶
Package barometer provides the public API for OpenAPI and Arazzo contract testing. It supports both synchronous Run and asynchronous Start returning a Job for IDE/LSP integration. RunWithIndex and StartWithIndex accept a pre-parsed Navigator OpenAPI index for direct Go integration.
Index ¶
- Constants
- Variables
- func ContractTestRule(baseURL string, opts *RunOpts) barrelman.Rule
- func WriteOpenAPIReport(w io.Writer, results []OpenAPIContractResult, format Format, ...) error
- func WriteReport(w io.Writer, result *Result, format Format, duration time.Duration) error
- type ArazzoConfig
- type ArazzoReport
- type ArazzoResult
- type Client
- type ClientConfig
- type Config
- type ContractInput
- type Format
- type JSONReport
- type Job
- type OpenAPIConfig
- type OpenAPIContractResult
- type OpenAPIReport
- type OpenAPIResult
- type Result
- type RunOpts
- type WorkflowResult
Constants ¶
const ( FormatHuman = reporter.FormatHuman FormatJUnit = reporter.FormatJUnit FormatJSON = reporter.FormatJSON JSONReportVersion = reporter.JSONReportVersion )
Variables ¶
var ( // ErrConfigRequired indicates that no config was supplied to a run. ErrConfigRequired = contract.ErrConfigRequired // ErrTargetRequired indicates that no OpenAPI or Arazzo target was supplied. ErrTargetRequired = errors.New("at least one OpenAPI spec or Arazzo document is required") )
var ReportSchemaJSON string
Functions ¶
func ContractTestRule ¶
ContractTestRule returns a barrelman Rule that runs contract tests against baseURL and reports failures as diagnostics. Can be used standalone with barrelman's engine, or wrapped by editor/CLI integrations.
func WriteOpenAPIReport ¶
func WriteOpenAPIReport(w io.Writer, results []OpenAPIContractResult, format Format, duration time.Duration) error
WriteOpenAPIReport writes OpenAPI-only runtime results in the requested format.
Types ¶
type ArazzoConfig ¶
type ArazzoConfig = contract.ArazzoConfig
ArazzoConfig configures an Arazzo workflow target.
type ArazzoReport ¶
type ArazzoReport = reporter.ArazzoReport
ArazzoReport is the Arazzo section of the machine-readable report.
type ArazzoResult ¶
type ArazzoResult = contract.ArazzoResult
ArazzoResult contains runtime results for Arazzo workflow execution.
type Client ¶
Client is the public runtime HTTP client type.
func NewClient ¶
func NewClient(cfg *ClientConfig) (*Client, error)
NewClient returns a public runtime HTTP client.
type ClientConfig ¶
ClientConfig configures the public runtime HTTP client.
type Config ¶
Config is the contract test configuration (same as contract.Config).
func LoadConfig ¶
LoadConfig reads a config file from disk.
type ContractInput ¶
type ContractInput struct {
BaseURL string
ProxyURL string
Output Format
OpenAPISpec string
OpenAPITags []string
ArazzoDoc string
ArazzoWorkflows []string
}
ContractInput is the flat integration input shape used by editor and orchestration callers that don't want to hand-build nested config structs.
func (ContractInput) ToConfig ¶
func (in ContractInput) ToConfig() (*Config, error)
ToConfig converts flat integration inputs into the canonical nested config shape.
type JSONReport ¶
type JSONReport = reporter.JSONReport
JSONReport is the versioned machine-readable report shape.
func BuildReport ¶
func BuildReport(result *Result, duration time.Duration) JSONReport
BuildReport returns the normalized JSON report model for a completed run.
type Job ¶
type Job struct {
// contains filtered or unexported fields
}
Job represents an asynchronous contract test run.
func StartInput ¶
StartInput converts flat integration inputs into config and starts an async run.
func StartWithIndex ¶
StartWithIndex is the async version of RunWithIndex, returning a Job handle.
func (*Job) Cancel ¶
func (j *Job) Cancel()
Cancel cancels the job's context. The job may not stop immediately.
func (*Job) Done ¶
func (j *Job) Done() <-chan struct{}
Done returns a channel that is closed when the job completes.
type OpenAPIConfig ¶
type OpenAPIConfig = contract.OpenAPIConfig
OpenAPIConfig configures an OpenAPI contract-test target.
type OpenAPIContractResult ¶
type OpenAPIContractResult = openapi.ContractResult
OpenAPIContractResult is the per-operation runtime contract result shape.
type OpenAPIReport ¶
type OpenAPIReport = reporter.OpenAPIReport
OpenAPIReport is the OpenAPI section of the machine-readable report.
type OpenAPIResult ¶
type OpenAPIResult = contract.OpenAPIResult
OpenAPIResult contains runtime results for OpenAPI contract tests.
type Result ¶
Result is the contract test result.
type RunOpts ¶
type RunOpts struct {
Client *Client
Tags []string
OperationID string
OpenAPISpec string
ProxyURL string
// Credentials maps OpenAPI security scheme names to secret values (API keys, bearer tokens, etc.).
Credentials map[string]string
}
RunOpts configures RunWithIndex / StartWithIndex (optional client and operation filters).
type WorkflowResult ¶
type WorkflowResult = contract.WorkflowResult
WorkflowResult contains runtime results for an individual Arazzo workflow.