Pre-release. Parity is not publicly available yet: the CLI, the GitHub Action and the hosted workspace open at launch. The demo runs on example data.

Skip to content

Configuration

Complete reference for parity.yaml — every key, its type and default — plus environment interpolation, per-source rules and the flags that override the file.

Parity reads parity.yaml from the working directory, or the file given with --config (or PARITY_CONFIG). Relative paths inside the file resolve against the file's own directory.

The file is strict: an unknown key anywhere is an error, reported with its line and column.

error: bad.yaml:7:1: unknown field `comparision`, expected one of `version`, `environments`, `sources`, `comparison`, `generation`, `execution`, `policy`, `redaction`, `report`

parity init writes a commented starting point, and parity validate checks a file without sending any request.

#A complete example

yaml
version: 1

environments:
  baseline:
    url: http://localhost:8080
    auth:
      bearer: ${API_TOKEN:-local-dev-token}
  candidate:
    url: http://localhost:8081
    auth:
      bearer: ${API_TOKEN:-local-dev-token}

sources:
  - openapi: ./openapi.yaml
    compare:
      ignore: [$.id]
    exclude: ["GET /admin/*"]
  - workflows: ./tests/parity/
  - requests: ./tests/requests.yaml

comparison:
  status: exact
  body: semantic
  headers: [content-type]
  ignore:
    - $.requestId
    - $..created_at
  arrays: ordered
  null_vs_missing: distinct
  numeric_tolerance: 0

generation:
  seed: 42
  max_scenarios: 500

execution:
  concurrency: 8
  timeout_ms: 5000

policy:
  unexpected_changes: fail
  environment_errors: fail
  inconclusive: warn

#version

Required. Must be 1.

#environments

Two environments, baseline (the version you trust) and candidate (the version under review). Each accepts:

KeyTypeDefaultMeaning
urlstring—Base URL, http or https. Request paths are appended to it. May be left out of the file and supplied with --baseline / --candidate.
headersmap of strings{}Headers sent with every request to this environment.
querymap of strings{}Query parameters appended to every request to this environment.
authobjectnoneExactly one of bearer, basic or header (below).
variablesmap{}Initial variables for this environment's context. A variable can be used by scenarios only if both environments define it.
allow_mutationsbooleantrue for local hosts, otherwise falseWhether POST, PUT, PATCH and DELETE may be sent here. See the mutation guard.
revisionstringnoneSource revision deployed here (commit SHA, tag). Recorded in the report.
timeout_msintegerexecution.timeout_msPer-request timeout for this environment only.

#auth

yaml
environments:
  baseline:
    url: https://staging.example.test
    auth:
      bearer: ${STAGING_TOKEN}
  candidate:
    url: https://preview.example.test
    auth:
      basic:
        username: ci
        password: ${PREVIEW_PASSWORD}
FormSends
bearer: <token>Authorization: Bearer <token>
basic: { username, password }Authorization: Basic …
header: { name, value }The named header with the given value

Credentials embedded in a URL (https://user:pass@host) are used as Basic authentication when no auth block is present. Every credential found in auth or in a URL is treated as a secret and scrubbed from all output.

#sources

A list. Each entry defines exactly one of openapi, workflows, requests or postman, plus optional filters and rules.

KeyTypeMeaning
openapipathAn OpenAPI 3.x document (YAML or JSON). See OpenAPI generation.
workflowspathA workflow file, or a directory searched recursively for .yaml / .yml. See Workflows.
requestspath or listA requests file, or requests written inline. See manual requests.
postmanpathA Postman Collection v2.0 / v2.1 export. See Postman import.
includelist of globsKeep only matching scenarios.
excludelist of globsDrop matching scenarios.
tagslist of stringsTags added to every scenario from this source.
compareobjectComparison rules for every scenario from this source.

include and exclude are globs where * matches any run of characters, case-insensitively. For an OpenAPI source they match the operation, written METHOD /path/template (GET /orders*, * /admin/*). For the other sources they match the scenario name; include also matches the scenario id.

compare takes the same keys as comparison and is layered on top of it: scalar keys (status, body, arrays, null_vs_missing, numeric_tolerance) replace the global value, and list keys (headers, ignore, array_rules, tolerances) are added to the global lists. A workflow's own compare, and a step's, are layered on top again, most specific last.

yaml
sources:
  - openapi: ./openapi.yaml
    include: ["GET *"]
    exclude: ["GET /admin/*"]
    tags: [generated]
    compare:
      ignore: [$.id]
      status: class

#comparison

How two responses are compared. The semantics of each rule are described in Comparison rules.

KeyTypeDefaultMeaning
statusexact | class | ignoreexactCompare status codes exactly, by class (2xx, 4xx, …) or not at all.
bodysemantic | exact | ignoresemanticCompare JSON structurally, require identical serialisation, or skip bodies.
headerslist of names[]Response headers to compare, case-insensitive. No header is compared unless listed.
ignorelist of JSONPaths[]Body locations excluded from comparison, with their whole subtree.
arraysordered | unorderedorderedDefault array semantics.
array_ruleslist[]Per-path array semantics: { path, order, key }.
null_vs_missingdistinct | equivalentdistinctWhether {"a": null} and {} differ.
numeric_tolerancenumber ≥ 00Absolute tolerance for every number without a matching rule in tolerances.
toleranceslist[]Per-path tolerances: { path, absolute, relative }, at least one of the two.
yaml
comparison:
  ignore:
    - $.requestId
    - $..updated_at
  array_rules:
    - path: $.tags
      order: unordered
    - path: $.items
      key: sku
  tolerances:
    - path: $..price
      absolute: 0.005
    - path: $.metrics.latency_p50
      relative: 0.1

#generation

Controls scenario generation from OpenAPI sources.

KeyTypeDefaultMeaning
seedinteger1Seed for every random choice. The same document and seed produce the same scenarios. parity init writes 42.
max_scenariosinteger ≥ 1500Upper bound on generated scenarios across all OpenAPI sources.
max_per_operationinteger40Upper bound per operation.
max_depthinteger4How deep into nested objects variations are applied.
variationslistall eightAny of valid, missing_required, null, numeric_boundary, invalid_enum, empty, string_length, invalid_type.
random_validinteger1Additional valid requests per operation built from seeded random choices.
methodslistallRestrict generation to these HTTP methods, e.g. [GET, HEAD].

#execution

KeyTypeDefaultMeaning
concurrencyinteger 1–2568Scenarios executed at once. Steps inside a scenario always run in order.
timeout_msinteger > 010000Per-request timeout.
retriesinteger0Retries for requests that never reached the server (connection and DNS failures only). A request that was answered is never retried.
max_response_bytesinteger10485760 (10 MiB)Larger responses make the scenario inconclusive.
nondeterminism_checkauto | offautoRe-run the baseline for changed, read-only scenarios to find fields that vary on their own.
infrastructure_statuseslist of integers[502, 503, 504]Statuses treated as environment errors rather than behaviour.
max_duration_sintegernoneCancel the run after this many seconds.

#policy

What each kind of result does to the verdict. Each key takes fail, warn or ignore.

KeyDefaultExit code when it fails
unexpected_changesfail1
environment_errorsfail2
inconclusivewarn4

When several policies fail, the exit code names the most actionable one: changes before environment errors before inconclusive results. A run that compared nothing at all exits 4 unless inconclusive is ignore. See exit codes.

#redaction

Additions to the built-in redaction. The built-in lists always apply; see Security and data handling.

KeyTypeMeaning
headerslist of namesAdditional header names whose values are redacted.
fieldslist of namesAdditional JSON member names redacted wherever they appear. Matched as a suffix, ignoring case, - and _.
pathslist of JSONPathsLocations redacted in request and response bodies.
yaml
redaction:
  headers: [x-internal-trace]
  fields: [iban, date_of_birth]
  paths: [$.customer.address]

#report

KeyTypeDefaultMeaning
outputpath.parity/report.jsonWhere compare writes the JSON report. --output overrides it.
max_body_bytesinteger262144 (256 KiB)Bodies larger than this are compared in full but left out of the report.
include_unchanged_bodiesbooleanfalseKeep response bodies for unchanged scenarios too.

#Environment interpolation

Any string value in parity.yaml may reference the process environment:

SyntaxResult
${NAME}The value of NAME. An error if it is unset or empty.
${NAME:-default}The value of NAME, or default if it is unset or empty.
$${A literal ${.
error: env.yaml: environment variable not set: API_TOKEN
  hint: export the variable, or give it a default with ${NAME:-default}

Every value substituted from the environment is treated as a secret: if it appears anywhere in a request, a response or a message, it is replaced with [REDACTED] before anything is printed or written (values shorter than six characters are too short to scrub safely and are skipped). Defaults written in the file are not secrets.

Interpolation applies to parity.yaml only. Workflow files use {{$env.NAME}} instead; see Workflows.

#Flags that override the configuration

FlagOverrides
--baseline <URL>, --candidate <URL>environments.*.url
--baseline-revision, --candidate-revisionenvironments.*.revision
--openapi, --workflows, --requests, --postmanAdd a source (repeatable). Paths are relative to the working directory.
--seed <N>generation.seed
--max-scenarios <N>generation.max_scenarios
--concurrency <N>execution.concurrency
--timeout-ms <MS>execution.timeout_ms
--policy <NAME=ACTION>One policy, e.g. --policy inconclusive=fail (repeatable)
--allow-mutationsAuthorises mutating requests for both environments for this run
-o, --output <FILE>report.output

--filter and --tag do not change the configuration; they select which of the loaded scenarios run. --filter is a glob over scenario names and ids (a pattern without * matches as a substring); --tag keeps scenarios with that tag. Both are repeatable.

#Running without a file

If there is no parity.yaml and you pass at least one source flag, Parity runs with the defaults:

bash
parity compare --baseline http://localhost:8080 --candidate http://localhost:8081 --openapi openapi.yaml

#Configuration fingerprint

parity validate and every report carry a fingerprint such as sha256:ebc8d505a4c8…. It is the SHA-256 of the configuration version together with the comparison and generation sections — the settings that decide which scenarios exist and what counts as a difference. Environment URLs, credentials, execution settings and policy are not part of it.

Two runs with the same fingerprint compared the same way. The hosted workspace uses it to decide whether a review made on one run still applies to another.

    Loading the index…