@contractual/differs.json-schema 0.1.0-dev.0
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/LICENSE +21 -0
- package/README.md +180 -0
- package/dist/classifiers.d.ts +87 -0
- package/dist/classifiers.d.ts.map +1 -0
- package/dist/classifiers.js +357 -0
- package/dist/classifiers.js.map +1 -0
- package/dist/compare.d.ts +37 -0
- package/dist/compare.d.ts.map +1 -0
- package/dist/compare.js +232 -0
- package/dist/compare.js.map +1 -0
- package/dist/differ.d.ts +57 -0
- package/dist/differ.d.ts.map +1 -0
- package/dist/differ.js +304 -0
- package/dist/differ.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +60 -0
- package/dist/index.js.map +1 -0
- package/dist/ref-resolver.d.ts +73 -0
- package/dist/ref-resolver.d.ts.map +1 -0
- package/dist/ref-resolver.js +345 -0
- package/dist/ref-resolver.js.map +1 -0
- package/dist/types.d.ts +276 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +210 -0
- package/dist/types.js.map +1 -0
- package/dist/walker.d.ts +17 -0
- package/dist/walker.d.ts.map +1 -0
- package/dist/walker.js +1195 -0
- package/dist/walker.js.map +1 -0
- package/package.json +59 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal types for JSON Schema structural differ
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Strands compatibility classification for a trace
|
|
6
|
+
*/
|
|
7
|
+
export type StrandsCompatibility = 'incompatible' | 'compatible' | 'unknown';
|
|
8
|
+
/**
|
|
9
|
+
* Strands version bump level
|
|
10
|
+
*/
|
|
11
|
+
export type StrandsVersion = 'equal' | 'patch' | 'minor' | 'major' | null;
|
|
12
|
+
/**
|
|
13
|
+
* A single trace showing where schemas differ (Strands format)
|
|
14
|
+
*/
|
|
15
|
+
export interface StrandsTrace {
|
|
16
|
+
/** Compatibility status of this change */
|
|
17
|
+
readonly compatibility: StrandsCompatibility;
|
|
18
|
+
/** JSON Pointer path in the source (left) schema, null if added */
|
|
19
|
+
readonly left: string | null;
|
|
20
|
+
/** JSON Pointer path in the target (right) schema, null if removed */
|
|
21
|
+
readonly right: string | null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Semantic version object
|
|
25
|
+
*/
|
|
26
|
+
export interface SemanticVersion {
|
|
27
|
+
readonly major: number;
|
|
28
|
+
readonly minor: number;
|
|
29
|
+
readonly patch: number;
|
|
30
|
+
readonly version: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Strands API response format
|
|
34
|
+
*/
|
|
35
|
+
export interface CompareResult {
|
|
36
|
+
/** Version bump level, null if unknown/error */
|
|
37
|
+
readonly version: StrandsVersion;
|
|
38
|
+
/** List of traces showing where schemas differ */
|
|
39
|
+
readonly traces: StrandsTrace[];
|
|
40
|
+
/** Computed new version based on current version + bump */
|
|
41
|
+
readonly newVersion: SemanticVersion | null;
|
|
42
|
+
/** Error or warning message */
|
|
43
|
+
readonly message?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Options for schema comparison
|
|
47
|
+
*/
|
|
48
|
+
export interface CompareOptions {
|
|
49
|
+
/** Current version to compute newVersion from (e.g., "1.0.0") */
|
|
50
|
+
readonly currentVersion?: string;
|
|
51
|
+
/** Draft version for validation rules */
|
|
52
|
+
readonly draft?: JsonSchemaDraft;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Supported JSON Schema drafts
|
|
56
|
+
*/
|
|
57
|
+
export type JsonSchemaDraft = 'draft-07' | 'draft-2019-09' | 'draft-2020-12';
|
|
58
|
+
/**
|
|
59
|
+
* JSON Schema type values
|
|
60
|
+
*/
|
|
61
|
+
export type JSONSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
|
|
62
|
+
/**
|
|
63
|
+
* Normalized type representation (always an array for comparison)
|
|
64
|
+
*/
|
|
65
|
+
export type NormalizedType = JSONSchemaType[];
|
|
66
|
+
/**
|
|
67
|
+
* JSON Schema constraint keys that can be tightened or loosened
|
|
68
|
+
*/
|
|
69
|
+
export type ConstraintKey = 'minimum' | 'maximum' | 'exclusiveMinimum' | 'exclusiveMaximum' | 'minLength' | 'maxLength' | 'minItems' | 'maxItems' | 'minProperties' | 'maxProperties' | 'minContains' | 'maxContains' | 'pattern' | 'multipleOf' | 'uniqueItems';
|
|
70
|
+
/**
|
|
71
|
+
* Constraint comparison direction
|
|
72
|
+
*/
|
|
73
|
+
export type ConstraintDirection = 'min' | 'max' | 'exact';
|
|
74
|
+
/**
|
|
75
|
+
* Constraint metadata for determining tightened vs loosened
|
|
76
|
+
*/
|
|
77
|
+
export interface ConstraintMeta {
|
|
78
|
+
readonly key: ConstraintKey;
|
|
79
|
+
readonly direction: ConstraintDirection;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Map of constraint keys to their comparison direction
|
|
83
|
+
*/
|
|
84
|
+
export declare const CONSTRAINT_DIRECTION: Record<ConstraintKey, ConstraintDirection>;
|
|
85
|
+
/**
|
|
86
|
+
* All constraint keys for iteration
|
|
87
|
+
*/
|
|
88
|
+
export declare const CONSTRAINT_KEYS: ConstraintKey[];
|
|
89
|
+
/**
|
|
90
|
+
* Composition keywords in JSON Schema
|
|
91
|
+
*/
|
|
92
|
+
export type CompositionKeyword = 'anyOf' | 'oneOf' | 'allOf' | 'if' | 'then' | 'else' | 'not';
|
|
93
|
+
/**
|
|
94
|
+
* All composition keywords for iteration
|
|
95
|
+
*/
|
|
96
|
+
export declare const COMPOSITION_KEYWORDS: CompositionKeyword[];
|
|
97
|
+
/**
|
|
98
|
+
* Metadata keys that are compared (patch-level changes)
|
|
99
|
+
*/
|
|
100
|
+
export type MetadataKey = 'description' | 'title' | 'default' | 'examples';
|
|
101
|
+
/**
|
|
102
|
+
* All metadata keys for iteration
|
|
103
|
+
*/
|
|
104
|
+
export declare const METADATA_KEYS: MetadataKey[];
|
|
105
|
+
/**
|
|
106
|
+
* Annotation keys (patch-level changes per Strands API)
|
|
107
|
+
*/
|
|
108
|
+
export type AnnotationKey = 'deprecated' | 'readOnly' | 'writeOnly';
|
|
109
|
+
/**
|
|
110
|
+
* All annotation keys for iteration
|
|
111
|
+
*/
|
|
112
|
+
export declare const ANNOTATION_KEYS: AnnotationKey[];
|
|
113
|
+
/**
|
|
114
|
+
* Content keywords (patch-level changes per Strands API)
|
|
115
|
+
*/
|
|
116
|
+
export type ContentKey = 'contentEncoding' | 'contentMediaType' | 'contentSchema';
|
|
117
|
+
/**
|
|
118
|
+
* All content keys for iteration
|
|
119
|
+
*/
|
|
120
|
+
export declare const CONTENT_KEYS: ContentKey[];
|
|
121
|
+
/**
|
|
122
|
+
* Resolved JSON Schema object (refs already resolved)
|
|
123
|
+
*/
|
|
124
|
+
export interface ResolvedSchema {
|
|
125
|
+
$schema?: string;
|
|
126
|
+
$id?: string;
|
|
127
|
+
$ref?: string;
|
|
128
|
+
$defs?: Record<string, ResolvedSchema>;
|
|
129
|
+
type?: JSONSchemaType | JSONSchemaType[];
|
|
130
|
+
title?: string;
|
|
131
|
+
description?: string;
|
|
132
|
+
default?: unknown;
|
|
133
|
+
examples?: unknown[];
|
|
134
|
+
deprecated?: boolean;
|
|
135
|
+
readOnly?: boolean;
|
|
136
|
+
writeOnly?: boolean;
|
|
137
|
+
enum?: unknown[];
|
|
138
|
+
const?: unknown;
|
|
139
|
+
format?: string;
|
|
140
|
+
minimum?: number;
|
|
141
|
+
maximum?: number;
|
|
142
|
+
exclusiveMinimum?: number;
|
|
143
|
+
exclusiveMaximum?: number;
|
|
144
|
+
multipleOf?: number;
|
|
145
|
+
minLength?: number;
|
|
146
|
+
maxLength?: number;
|
|
147
|
+
pattern?: string;
|
|
148
|
+
contentEncoding?: string;
|
|
149
|
+
contentMediaType?: string;
|
|
150
|
+
contentSchema?: ResolvedSchema;
|
|
151
|
+
properties?: Record<string, ResolvedSchema>;
|
|
152
|
+
required?: string[];
|
|
153
|
+
additionalProperties?: boolean | ResolvedSchema;
|
|
154
|
+
minProperties?: number;
|
|
155
|
+
maxProperties?: number;
|
|
156
|
+
propertyNames?: ResolvedSchema;
|
|
157
|
+
patternProperties?: Record<string, ResolvedSchema>;
|
|
158
|
+
dependentRequired?: Record<string, string[]>;
|
|
159
|
+
dependentSchemas?: Record<string, ResolvedSchema>;
|
|
160
|
+
unevaluatedProperties?: boolean | ResolvedSchema;
|
|
161
|
+
items?: ResolvedSchema | ResolvedSchema[];
|
|
162
|
+
prefixItems?: ResolvedSchema[];
|
|
163
|
+
minItems?: number;
|
|
164
|
+
maxItems?: number;
|
|
165
|
+
uniqueItems?: boolean;
|
|
166
|
+
contains?: ResolvedSchema;
|
|
167
|
+
minContains?: number;
|
|
168
|
+
maxContains?: number;
|
|
169
|
+
unevaluatedItems?: boolean | ResolvedSchema;
|
|
170
|
+
anyOf?: ResolvedSchema[];
|
|
171
|
+
oneOf?: ResolvedSchema[];
|
|
172
|
+
allOf?: ResolvedSchema[];
|
|
173
|
+
if?: ResolvedSchema;
|
|
174
|
+
then?: ResolvedSchema;
|
|
175
|
+
else?: ResolvedSchema;
|
|
176
|
+
not?: ResolvedSchema;
|
|
177
|
+
[key: string]: unknown;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Walker context for tracking traversal state
|
|
181
|
+
*/
|
|
182
|
+
export interface WalkerContext {
|
|
183
|
+
/** Current JSON Pointer path */
|
|
184
|
+
readonly path: string;
|
|
185
|
+
/** Depth of recursion (for cycle detection) */
|
|
186
|
+
readonly depth: number;
|
|
187
|
+
/** Maximum allowed depth */
|
|
188
|
+
readonly maxDepth: number;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Default maximum recursion depth
|
|
192
|
+
*/
|
|
193
|
+
export declare const DEFAULT_MAX_DEPTH = 100;
|
|
194
|
+
/**
|
|
195
|
+
* Type guard to check if value is a schema object
|
|
196
|
+
*/
|
|
197
|
+
export declare function isSchemaObject(value: unknown): value is ResolvedSchema;
|
|
198
|
+
/**
|
|
199
|
+
* Type guard to check if value is an array of schemas
|
|
200
|
+
*/
|
|
201
|
+
export declare function isSchemaArray(value: unknown): value is ResolvedSchema[];
|
|
202
|
+
/**
|
|
203
|
+
* Normalize type to array for consistent comparison
|
|
204
|
+
*/
|
|
205
|
+
export declare function normalizeType(type: JSONSchemaType | JSONSchemaType[] | undefined): NormalizedType;
|
|
206
|
+
/**
|
|
207
|
+
* Check if two arrays have the same elements (order-independent)
|
|
208
|
+
*/
|
|
209
|
+
export declare function arraysEqual<T>(a: T[], b: T[]): boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Deep equality check for JSON values
|
|
212
|
+
*/
|
|
213
|
+
export declare function deepEqual(a: unknown, b: unknown): boolean;
|
|
214
|
+
/**
|
|
215
|
+
* Escape JSON Pointer segment according to RFC 6901
|
|
216
|
+
*/
|
|
217
|
+
export declare function escapeJsonPointer(segment: string): string;
|
|
218
|
+
/**
|
|
219
|
+
* Join path segments into a JSON Pointer
|
|
220
|
+
*/
|
|
221
|
+
export declare function joinPath(basePath: string, ...segments: string[]): string;
|
|
222
|
+
/**
|
|
223
|
+
* Severity classification for detected changes
|
|
224
|
+
*/
|
|
225
|
+
export type ChangeSeverity = 'breaking' | 'non-breaking' | 'patch' | 'unknown';
|
|
226
|
+
/**
|
|
227
|
+
* Suggested semver bump based on detected changes
|
|
228
|
+
*/
|
|
229
|
+
export type SuggestedBump = 'major' | 'minor' | 'patch' | 'none';
|
|
230
|
+
/**
|
|
231
|
+
* A single change detected between two spec versions
|
|
232
|
+
*/
|
|
233
|
+
export interface Change {
|
|
234
|
+
path: string;
|
|
235
|
+
severity: ChangeSeverity;
|
|
236
|
+
category: string;
|
|
237
|
+
message: string;
|
|
238
|
+
oldValue?: unknown;
|
|
239
|
+
newValue?: unknown;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Summary counts of changes by severity
|
|
243
|
+
*/
|
|
244
|
+
export interface DiffSummary {
|
|
245
|
+
breaking: number;
|
|
246
|
+
nonBreaking: number;
|
|
247
|
+
patch: number;
|
|
248
|
+
unknown: number;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Result of comparing two spec versions
|
|
252
|
+
*/
|
|
253
|
+
export interface DiffResult {
|
|
254
|
+
contract: string;
|
|
255
|
+
changes: Change[];
|
|
256
|
+
summary: DiffSummary;
|
|
257
|
+
suggestedBump: SuggestedBump;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* All possible structural change types for classification
|
|
261
|
+
*/
|
|
262
|
+
export type ChangeType = 'property-added' | 'property-removed' | 'required-added' | 'required-removed' | 'type-changed' | 'type-narrowed' | 'type-widened' | 'enum-value-added' | 'enum-value-removed' | 'enum-added' | 'enum-removed' | 'constraint-tightened' | 'constraint-loosened' | 'format-changed' | 'format-added' | 'format-removed' | 'additional-properties-denied' | 'additional-properties-allowed' | 'additional-properties-changed' | 'property-names-changed' | 'dependent-required-added' | 'dependent-required-removed' | 'dependent-schemas-changed' | 'unevaluated-properties-changed' | 'items-changed' | 'min-items-increased' | 'max-items-decreased' | 'min-contains-changed' | 'max-contains-changed' | 'unevaluated-items-changed' | 'ref-target-changed' | 'description-changed' | 'title-changed' | 'default-changed' | 'examples-changed' | 'deprecated-changed' | 'read-only-changed' | 'write-only-changed' | 'content-encoding-changed' | 'content-media-type-changed' | 'content-schema-changed' | 'anyof-option-added' | 'anyof-option-removed' | 'oneof-option-added' | 'oneof-option-removed' | 'allof-member-added' | 'allof-member-removed' | 'not-schema-changed' | 'if-then-else-changed' | 'composition-changed' | 'unknown-change';
|
|
263
|
+
/**
|
|
264
|
+
* Raw change detected by a differ before severity classification
|
|
265
|
+
*/
|
|
266
|
+
export interface RawChange {
|
|
267
|
+
path: string;
|
|
268
|
+
type: ChangeType;
|
|
269
|
+
oldValue?: unknown;
|
|
270
|
+
newValue?: unknown;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Mapping from change types to their severity classification
|
|
274
|
+
*/
|
|
275
|
+
export declare const CHANGE_TYPE_SEVERITY: Record<ChangeType, ChangeSeverity>;
|
|
276
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,cAAc,GAAG,YAAY,GAAG,SAAS,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,IAAI,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,0CAA0C;IAC1C,QAAQ,CAAC,aAAa,EAAE,oBAAoB,CAAC;IAC7C,mEAAmE;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,sEAAsE;IACtE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,gDAAgD;IAChD,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,kDAAkD;IAClD,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC;IAChC,2DAA2D;IAC3D,QAAQ,CAAC,UAAU,EAAE,eAAe,GAAG,IAAI,CAAC;IAC5C,+BAA+B;IAC/B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;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,GACf,iBAAiB,GACjB,kBAAkB,GAElB,oBAAoB,GACpB,mBAAmB,GACnB,oBAAoB,GAEpB,0BAA0B,GAC1B,4BAA4B,GAC5B,wBAAwB,GAExB,oBAAoB,GACpB,sBAAsB,GACtB,oBAAoB,GACpB,sBAAsB,GACtB,oBAAoB,GACpB,sBAAsB,GACtB,oBAAoB,GACpB,sBAAsB,GAEtB,qBAAqB,GAErB,gBAAgB,CAAC;AAErB;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,UAAU,EAAE,cAAc,CA2DnE,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal types for JSON Schema structural differ
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Map of constraint keys to their comparison direction
|
|
6
|
+
*/
|
|
7
|
+
export const CONSTRAINT_DIRECTION = {
|
|
8
|
+
minimum: 'min',
|
|
9
|
+
maximum: 'max',
|
|
10
|
+
exclusiveMinimum: 'min',
|
|
11
|
+
exclusiveMaximum: 'max',
|
|
12
|
+
minLength: 'min',
|
|
13
|
+
maxLength: 'max',
|
|
14
|
+
minItems: 'min',
|
|
15
|
+
maxItems: 'max',
|
|
16
|
+
minProperties: 'min',
|
|
17
|
+
maxProperties: 'max',
|
|
18
|
+
minContains: 'min',
|
|
19
|
+
maxContains: 'max',
|
|
20
|
+
pattern: 'exact',
|
|
21
|
+
multipleOf: 'exact',
|
|
22
|
+
uniqueItems: 'exact',
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* All constraint keys for iteration
|
|
26
|
+
*/
|
|
27
|
+
export const CONSTRAINT_KEYS = [
|
|
28
|
+
'minimum',
|
|
29
|
+
'maximum',
|
|
30
|
+
'exclusiveMinimum',
|
|
31
|
+
'exclusiveMaximum',
|
|
32
|
+
'minLength',
|
|
33
|
+
'maxLength',
|
|
34
|
+
'minItems',
|
|
35
|
+
'maxItems',
|
|
36
|
+
'minProperties',
|
|
37
|
+
'maxProperties',
|
|
38
|
+
'minContains',
|
|
39
|
+
'maxContains',
|
|
40
|
+
'pattern',
|
|
41
|
+
'multipleOf',
|
|
42
|
+
'uniqueItems',
|
|
43
|
+
];
|
|
44
|
+
/**
|
|
45
|
+
* All composition keywords for iteration
|
|
46
|
+
*/
|
|
47
|
+
export const COMPOSITION_KEYWORDS = [
|
|
48
|
+
'anyOf',
|
|
49
|
+
'oneOf',
|
|
50
|
+
'allOf',
|
|
51
|
+
'if',
|
|
52
|
+
'then',
|
|
53
|
+
'else',
|
|
54
|
+
'not',
|
|
55
|
+
];
|
|
56
|
+
/**
|
|
57
|
+
* All metadata keys for iteration
|
|
58
|
+
*/
|
|
59
|
+
export const METADATA_KEYS = ['description', 'title', 'default', 'examples'];
|
|
60
|
+
/**
|
|
61
|
+
* All annotation keys for iteration
|
|
62
|
+
*/
|
|
63
|
+
export const ANNOTATION_KEYS = ['deprecated', 'readOnly', 'writeOnly'];
|
|
64
|
+
/**
|
|
65
|
+
* All content keys for iteration
|
|
66
|
+
*/
|
|
67
|
+
export const CONTENT_KEYS = ['contentEncoding', 'contentMediaType', 'contentSchema'];
|
|
68
|
+
/**
|
|
69
|
+
* Default maximum recursion depth
|
|
70
|
+
*/
|
|
71
|
+
export const DEFAULT_MAX_DEPTH = 100;
|
|
72
|
+
/**
|
|
73
|
+
* Type guard to check if value is a schema object
|
|
74
|
+
*/
|
|
75
|
+
export function isSchemaObject(value) {
|
|
76
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Type guard to check if value is an array of schemas
|
|
80
|
+
*/
|
|
81
|
+
export function isSchemaArray(value) {
|
|
82
|
+
return Array.isArray(value) && value.every(isSchemaObject);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Normalize type to array for consistent comparison
|
|
86
|
+
*/
|
|
87
|
+
export function normalizeType(type) {
|
|
88
|
+
if (type === undefined) {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
if (Array.isArray(type)) {
|
|
92
|
+
return [...type].sort();
|
|
93
|
+
}
|
|
94
|
+
return [type];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Check if two arrays have the same elements (order-independent)
|
|
98
|
+
*/
|
|
99
|
+
export function arraysEqual(a, b) {
|
|
100
|
+
if (a.length !== b.length)
|
|
101
|
+
return false;
|
|
102
|
+
const sortedA = [...a].sort();
|
|
103
|
+
const sortedB = [...b].sort();
|
|
104
|
+
return sortedA.every((val, idx) => val === sortedB[idx]);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Deep equality check for JSON values
|
|
108
|
+
*/
|
|
109
|
+
export function deepEqual(a, b) {
|
|
110
|
+
if (a === b) {
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
if (typeof a !== typeof b) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
if (a === null || b === null)
|
|
117
|
+
return a === b;
|
|
118
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
119
|
+
if (a.length !== b.length)
|
|
120
|
+
return false;
|
|
121
|
+
return a.every((val, idx) => deepEqual(val, b[idx]));
|
|
122
|
+
}
|
|
123
|
+
if (typeof a === 'object' && typeof b === 'object') {
|
|
124
|
+
const aObj = a;
|
|
125
|
+
const bObj = b;
|
|
126
|
+
const aKeys = Object.keys(aObj);
|
|
127
|
+
const bKeys = Object.keys(bObj);
|
|
128
|
+
if (aKeys.length !== bKeys.length)
|
|
129
|
+
return false;
|
|
130
|
+
return aKeys.every((key) => deepEqual(aObj[key], bObj[key]));
|
|
131
|
+
}
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Escape JSON Pointer segment according to RFC 6901
|
|
136
|
+
*/
|
|
137
|
+
export function escapeJsonPointer(segment) {
|
|
138
|
+
return segment.replace(/~/g, '~0').replace(/\//g, '~1');
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Join path segments into a JSON Pointer
|
|
142
|
+
*/
|
|
143
|
+
export function joinPath(basePath, ...segments) {
|
|
144
|
+
const escaped = segments.map(escapeJsonPointer);
|
|
145
|
+
if (basePath === '') {
|
|
146
|
+
return escaped.length > 0 ? '/' + escaped.join('/') : '';
|
|
147
|
+
}
|
|
148
|
+
return basePath + '/' + escaped.join('/');
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Mapping from change types to their severity classification
|
|
152
|
+
*/
|
|
153
|
+
export const CHANGE_TYPE_SEVERITY = {
|
|
154
|
+
// Breaking changes (major)
|
|
155
|
+
'property-removed': 'breaking',
|
|
156
|
+
'required-added': 'breaking',
|
|
157
|
+
'type-changed': 'breaking',
|
|
158
|
+
'type-narrowed': 'breaking',
|
|
159
|
+
'enum-value-removed': 'breaking',
|
|
160
|
+
'enum-added': 'breaking',
|
|
161
|
+
'constraint-tightened': 'breaking',
|
|
162
|
+
'additional-properties-denied': 'breaking',
|
|
163
|
+
'items-changed': 'breaking',
|
|
164
|
+
'min-items-increased': 'breaking',
|
|
165
|
+
'max-items-decreased': 'breaking',
|
|
166
|
+
'ref-target-changed': 'breaking',
|
|
167
|
+
'dependent-required-added': 'breaking',
|
|
168
|
+
'anyof-option-added': 'breaking',
|
|
169
|
+
'oneof-option-added': 'breaking',
|
|
170
|
+
'allof-member-added': 'breaking',
|
|
171
|
+
'not-schema-changed': 'breaking',
|
|
172
|
+
// Non-breaking changes (minor)
|
|
173
|
+
'property-added': 'non-breaking',
|
|
174
|
+
'required-removed': 'non-breaking',
|
|
175
|
+
'type-widened': 'non-breaking',
|
|
176
|
+
'enum-value-added': 'non-breaking',
|
|
177
|
+
'enum-removed': 'non-breaking',
|
|
178
|
+
'constraint-loosened': 'non-breaking',
|
|
179
|
+
'additional-properties-allowed': 'non-breaking',
|
|
180
|
+
'additional-properties-changed': 'non-breaking',
|
|
181
|
+
'dependent-required-removed': 'non-breaking',
|
|
182
|
+
'anyof-option-removed': 'non-breaking',
|
|
183
|
+
'oneof-option-removed': 'non-breaking',
|
|
184
|
+
'allof-member-removed': 'non-breaking',
|
|
185
|
+
// Patch-level changes
|
|
186
|
+
'format-added': 'patch',
|
|
187
|
+
'format-removed': 'patch',
|
|
188
|
+
'format-changed': 'patch',
|
|
189
|
+
'description-changed': 'patch',
|
|
190
|
+
'title-changed': 'patch',
|
|
191
|
+
'default-changed': 'patch',
|
|
192
|
+
'examples-changed': 'patch',
|
|
193
|
+
'deprecated-changed': 'patch',
|
|
194
|
+
'read-only-changed': 'patch',
|
|
195
|
+
'write-only-changed': 'patch',
|
|
196
|
+
'content-encoding-changed': 'patch',
|
|
197
|
+
'content-media-type-changed': 'patch',
|
|
198
|
+
'content-schema-changed': 'patch',
|
|
199
|
+
// Unknown (manual review)
|
|
200
|
+
'property-names-changed': 'unknown',
|
|
201
|
+
'dependent-schemas-changed': 'unknown',
|
|
202
|
+
'unevaluated-properties-changed': 'unknown',
|
|
203
|
+
'unevaluated-items-changed': 'unknown',
|
|
204
|
+
'min-contains-changed': 'unknown',
|
|
205
|
+
'max-contains-changed': 'unknown',
|
|
206
|
+
'if-then-else-changed': 'unknown',
|
|
207
|
+
'composition-changed': 'unknown',
|
|
208
|
+
'unknown-change': 'unknown',
|
|
209
|
+
};
|
|
210
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAyHH;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA+C;IAC9E,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,KAAK;IACd,gB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C9B,eAAe,EAAE,OAAO;IACxB,iBAAiB,EAAE,OAAO;IAC1B,kBAAkB,EAAE,OAAO;IAC3B,oBAAoB,EAAE,OAAO;IAC7B,mBAAmB,EAAE,OAAO;IAC5B,oBAAoB,EAAE,OAAO;IAC7B,0BAA0B,EAAE,OAAO;IACnC,4BAA4B,EAAE,OAAO;IACrC,wBAAwB,EAAE,OAAO;IAEjC,0BAA0B;IAC1B,wBAAwB,EAAE,SAAS;IACnC,2BAA2B,EAAE,SAAS;IACtC,gCAAgC,EAAE,SAAS;IAC3C,2BAA2B,EAAE,SAAS;IACtC,sBAAsB,EAAE,SAAS;IACjC,sBAAsB,EAAE,SAAS;IACjC,sBAAsB,EAAE,SAAS;IACjC,qBAAqB,EAAE,SAAS;IAChC,gBAAgB,EAAE,SAAS;CAC5B,CAAC"}
|
package/dist/walker.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Schema structural walker
|
|
3
|
+
*
|
|
4
|
+
* Recursively walks two resolved JSON Schemas side-by-side (DFS)
|
|
5
|
+
* and emits RawChange for every structural difference.
|
|
6
|
+
*/
|
|
7
|
+
import type { RawChange } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Walk two resolved JSON Schemas and emit changes
|
|
10
|
+
*
|
|
11
|
+
* @param oldSchema - The original schema (resolved, no $refs)
|
|
12
|
+
* @param newSchema - The new schema (resolved, no $refs)
|
|
13
|
+
* @param basePath - JSON Pointer base path (default: '')
|
|
14
|
+
* @returns Array of raw changes detected
|
|
15
|
+
*/
|
|
16
|
+
export declare function walk(oldSchema: unknown, newSchema: unknown, basePath?: string): RawChange[];
|
|
17
|
+
//# sourceMappingURL=walker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walker.d.ts","sourceRoot":"","sources":["../src/walker.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAc,SAAS,EAAE,MAAM,YAAY,CAAC;AAkBxD;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,GAAE,MAAW,GAAG,SAAS,EAAE,CAE/F"}
|