specshield 3.4.6 → 3.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "specshield",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.7",
|
|
4
4
|
"description": "Contract compatibility testing for APIs — catch breaking OpenAPI changes before they reach your consumers, with can-i-deploy deploy gating and GitHub PR checks. (a.k.a. bidirectional contract testing.)",
|
|
5
5
|
"main": "src/cli.js",
|
|
6
6
|
"homepage": "https://specshield.io",
|
|
@@ -25,11 +25,6 @@ const BREAKING_TYPES = new Set([
|
|
|
25
25
|
// that relied on the removed shape / the old discriminator.
|
|
26
26
|
'SCHEMA_VARIANT_REMOVED',
|
|
27
27
|
'SCHEMA_DISCRIMINATOR_CHANGED',
|
|
28
|
-
// Constraint tightening: previously-valid values become invalid → breaking.
|
|
29
|
-
'CONSTRAINT_TIGHTENED',
|
|
30
|
-
// Pattern changes are treated as breaking (semantic safety: we can't
|
|
31
|
-
// tell whether the new pattern accepts a superset of the old).
|
|
32
|
-
'CONSTRAINT_PATTERN_CHANGED',
|
|
33
28
|
]);
|
|
34
29
|
|
|
35
30
|
const ADDITION_TYPES = new Set([
|
|
@@ -51,8 +46,29 @@ const MODIFICATION_TYPES = new Set([
|
|
|
51
46
|
'CONSTRAINT_RELAXED',
|
|
52
47
|
]);
|
|
53
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Reported, but never fail the build (see resolveExitCode — only
|
|
51
|
+
* breakingChanges affect the exit code).
|
|
52
|
+
*
|
|
53
|
+
* Constraint changes live here because whether they break depends on WHICH SIDE
|
|
54
|
+
* of the contract they sit on, and this engine does not track that. Tightening
|
|
55
|
+
* `maxLength` on a *request* rejects payloads that used to be accepted; the same
|
|
56
|
+
* change on a *response* is harmless. The hosted engine makes that distinction
|
|
57
|
+
* (REQUEST_CONSTRAINT_TIGHTENED vs RESPONSE_CONSTRAINT_TIGHTENED) and is the
|
|
58
|
+
* authority on the verdict.
|
|
59
|
+
*
|
|
60
|
+
* Classifying them as breaking here — which this engine used to do — meant the
|
|
61
|
+
* CLI could fail a build that the hosted gate passes. Two gates that disagree
|
|
62
|
+
* is precisely the failure mode this product exists to prevent, so the CLI
|
|
63
|
+
* reports the change and declines to rule on it.
|
|
64
|
+
*
|
|
65
|
+
* The governing rule for this file: the CLI may detect FEWER change types than
|
|
66
|
+
* the backend, but it must never classify a shared type DIFFERENTLY.
|
|
67
|
+
* Subset, not variant. See engineParity.test.js.
|
|
68
|
+
*/
|
|
54
69
|
const WARNING_TYPES = new Set([
|
|
55
|
-
|
|
70
|
+
'CONSTRAINT_TIGHTENED',
|
|
71
|
+
'CONSTRAINT_PATTERN_CHANGED',
|
|
56
72
|
]);
|
|
57
73
|
|
|
58
74
|
// Numeric order: higher = more severe
|
|
@@ -64,6 +64,18 @@ function formatHuman(result) {
|
|
|
64
64
|
for (const c of warnings) {
|
|
65
65
|
lines.push(` ${chalk.gray('!')} ${c.description}`);
|
|
66
66
|
}
|
|
67
|
+
// Whether a constraint change actually breaks depends on which side of the
|
|
68
|
+
// contract it sits on, which this engine does not track. Say so rather than
|
|
69
|
+
// let the reader assume these were judged and found safe.
|
|
70
|
+
lines.push(chalk.gray(' These depend on request/response direction — the hosted gate rules on them.'));
|
|
71
|
+
lines.push('');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// "0 breaking" from a deliberately smaller local engine is not the same claim
|
|
75
|
+
// as "0 breaking" from the full one. Don't let the two look identical.
|
|
76
|
+
if (breakingChanges.length === 0) {
|
|
77
|
+
lines.push(chalk.gray(' No breaking changes found by the local engine.'));
|
|
78
|
+
lines.push(chalk.gray(' Nullability, constraint and enum-addition checks run on the hosted gate.'));
|
|
67
79
|
lines.push('');
|
|
68
80
|
}
|
|
69
81
|
|