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
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:
| Key | Type | Default | Meaning |
|---|---|---|---|
url | string | — | Base URL, http or https. Request paths are appended to it. May be left out of the file and supplied with --baseline / --candidate. |
headers | map of strings | {} | Headers sent with every request to this environment. |
query | map of strings | {} | Query parameters appended to every request to this environment. |
auth | object | none | Exactly one of bearer, basic or header (below). |
variables | map | {} | Initial variables for this environment's context. A variable can be used by scenarios only if both environments define it. |
allow_mutations | boolean | true for local hosts, otherwise false | Whether POST, PUT, PATCH and DELETE may be sent here. See the mutation guard. |
revision | string | none | Source revision deployed here (commit SHA, tag). Recorded in the report. |
timeout_ms | integer | execution.timeout_ms | Per-request timeout for this environment only. |
#auth
environments:
baseline:
url: https://staging.example.test
auth:
bearer: ${STAGING_TOKEN}
candidate:
url: https://preview.example.test
auth:
basic:
username: ci
password: ${PREVIEW_PASSWORD}| Form | Sends |
|---|---|
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.
| Key | Type | Meaning |
|---|---|---|
openapi | path | An OpenAPI 3.x document (YAML or JSON). See OpenAPI generation. |
workflows | path | A workflow file, or a directory searched recursively for .yaml / .yml. See Workflows. |
requests | path or list | A requests file, or requests written inline. See manual requests. |
postman | path | A Postman Collection v2.0 / v2.1 export. See Postman import. |
include | list of globs | Keep only matching scenarios. |
exclude | list of globs | Drop matching scenarios. |
tags | list of strings | Tags added to every scenario from this source. |
compare | object | Comparison 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.
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.
| Key | Type | Default | Meaning |
|---|---|---|---|
status | exact | class | ignore | exact | Compare status codes exactly, by class (2xx, 4xx, …) or not at all. |
body | semantic | exact | ignore | semantic | Compare JSON structurally, require identical serialisation, or skip bodies. |
headers | list of names | [] | Response headers to compare, case-insensitive. No header is compared unless listed. |
ignore | list of JSONPaths | [] | Body locations excluded from comparison, with their whole subtree. |
arrays | ordered | unordered | ordered | Default array semantics. |
array_rules | list | [] | Per-path array semantics: { path, order, key }. |
null_vs_missing | distinct | equivalent | distinct | Whether {"a": null} and {} differ. |
numeric_tolerance | number ≥ 0 | 0 | Absolute tolerance for every number without a matching rule in tolerances. |
tolerances | list | [] | Per-path tolerances: { path, absolute, relative }, at least one of the two. |
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.
| Key | Type | Default | Meaning |
|---|---|---|---|
seed | integer | 1 | Seed for every random choice. The same document and seed produce the same scenarios. parity init writes 42. |
max_scenarios | integer ≥ 1 | 500 | Upper bound on generated scenarios across all OpenAPI sources. |
max_per_operation | integer | 40 | Upper bound per operation. |
max_depth | integer | 4 | How deep into nested objects variations are applied. |
variations | list | all eight | Any of valid, missing_required, null, numeric_boundary, invalid_enum, empty, string_length, invalid_type. |
random_valid | integer | 1 | Additional valid requests per operation built from seeded random choices. |
methods | list | all | Restrict generation to these HTTP methods, e.g. [GET, HEAD]. |
#execution
| Key | Type | Default | Meaning |
|---|---|---|---|
concurrency | integer 1–256 | 8 | Scenarios executed at once. Steps inside a scenario always run in order. |
timeout_ms | integer > 0 | 10000 | Per-request timeout. |
retries | integer | 0 | Retries for requests that never reached the server (connection and DNS failures only). A request that was answered is never retried. |
max_response_bytes | integer | 10485760 (10 MiB) | Larger responses make the scenario inconclusive. |
nondeterminism_check | auto | off | auto | Re-run the baseline for changed, read-only scenarios to find fields that vary on their own. |
infrastructure_statuses | list of integers | [502, 503, 504] | Statuses treated as environment errors rather than behaviour. |
max_duration_s | integer | none | Cancel the run after this many seconds. |
#policy
What each kind of result does to the verdict. Each key takes fail, warn or ignore.
| Key | Default | Exit code when it fails |
|---|---|---|
unexpected_changes | fail | 1 |
environment_errors | fail | 2 |
inconclusive | warn | 4 |
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.
| Key | Type | Meaning |
|---|---|---|
headers | list of names | Additional header names whose values are redacted. |
fields | list of names | Additional JSON member names redacted wherever they appear. Matched as a suffix, ignoring case, - and _. |
paths | list of JSONPaths | Locations redacted in request and response bodies. |
redaction:
headers: [x-internal-trace]
fields: [iban, date_of_birth]
paths: [$.customer.address]#report
| Key | Type | Default | Meaning |
|---|---|---|---|
output | path | .parity/report.json | Where compare writes the JSON report. --output overrides it. |
max_body_bytes | integer | 262144 (256 KiB) | Bodies larger than this are compared in full but left out of the report. |
include_unchanged_bodies | boolean | false | Keep response bodies for unchanged scenarios too. |
#Environment interpolation
Any string value in parity.yaml may reference the process environment:
| Syntax | Result |
|---|---|
${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
| Flag | Overrides |
|---|---|
--baseline <URL>, --candidate <URL> | environments.*.url |
--baseline-revision, --candidate-revision | environments.*.revision |
--openapi, --workflows, --requests, --postman | Add 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-mutations | Authorises 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:
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.