-
Notifications
You must be signed in to change notification settings - Fork 0
Comparison Model
The first populated environment in fixed Dev, QA, Prod order is the baseline.
| Inputs | Baseline | Targets |
|---|---|---|
| Dev, QA | Dev | QA |
| Dev, Prod | Dev | Prod |
| QA, Prod | QA | Prod |
| Dev, QA, Prod | Dev | QA and Prod |
Blank environments are inactive and cannot create false removals.
Objects use dot paths (user.profile.name) and arrays use indexed paths
(orders[0].items[2].price). Arrays compare by index, not identifier or set
membership, so reordering can create many changes. Empty arrays and objects stay
comparable; object property order does not affect flattened path comparison.
| Type | Baseline | Target |
|---|---|---|
ADDED |
Absent | Present |
REMOVED |
Present | Absent |
CHANGED |
Present | Present, same JSON type, unequal value |
TYPE_CHANGE |
Present | Present, different JSON type |
null changing to or from another value is CHANGED. Equality uses JSON
serialization after parsing.
Rows with the same path and type combine. Different outcomes stay separate.
Dev: 100 QA: "100" Prod: 200
amount | TYPE_CHANGE | 100 | "100" | -
amount | CHANGED | 100 | - | 200
interface DiffEntry {
path: string;
type: 'ADDED' | 'REMOVED' | 'CHANGED' | 'TYPE_CHANGE';
devValue?: unknown;
qaValue?: unknown;
prodValue?: unknown;
}Output is sorted by path. Value properties appear only where a value exists.
ADDED, REMOVED, and TYPE_CHANGE trigger a possible contract-change warning;
that warning is a review signal, not a schema-compatibility proof.
API Response Comparator · Source · Issues · MIT License