@squiz/dx-json-schema-lib 1.90.0 → 1.90.1

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.
@@ -1,13 +1,10 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  jest.mock('./dereference/dereference', () => ({
7
4
  dereferenceLocal: jest.fn((schema) => schema),
8
5
  }));
9
6
  const dereference_1 = require("./dereference/dereference");
10
- const jsonBreakDetector_1 = __importDefault(require("./jsonBreakDetector"));
7
+ const jsonBreakDetector_1 = require("./jsonBreakDetector");
11
8
  const breakAt = (location, message) => ({ location, message });
12
9
  describe('jsonBreakDetector', () => {
13
10
  describe('required fields', () => {
@@ -24,7 +21,7 @@ describe('jsonBreakDetector', () => {
24
21
  title: { type: 'string' },
25
22
  },
26
23
  };
27
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
24
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
28
25
  });
29
26
  it('returns no breaks when required fields are unchanged', async () => {
30
27
  const beforeSchema = {
@@ -42,7 +39,7 @@ describe('jsonBreakDetector', () => {
42
39
  },
43
40
  required: ['title'],
44
41
  };
45
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
42
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
46
43
  });
47
44
  it('detects a newly required field at the root', async () => {
48
45
  const beforeSchema = {
@@ -61,7 +58,7 @@ describe('jsonBreakDetector', () => {
61
58
  },
62
59
  required: ['title', 'subtitle'],
63
60
  };
64
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('subtitle', 'New required field')]);
61
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('subtitle', 'New required field')]);
65
62
  });
66
63
  it('detects required on a newly added property', async () => {
67
64
  const beforeSchema = {
@@ -79,7 +76,7 @@ describe('jsonBreakDetector', () => {
79
76
  },
80
77
  required: ['title', 'subtitle'],
81
78
  };
82
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('subtitle', 'New required field')]);
79
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('subtitle', 'New required field')]);
83
80
  });
84
81
  it('detects required fields on a newly added nested property', async () => {
85
82
  const beforeSchema = {
@@ -103,7 +100,7 @@ describe('jsonBreakDetector', () => {
103
100
  },
104
101
  required: ['title'],
105
102
  };
106
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('metadata.version', 'New required field')]);
103
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('metadata.version', 'New required field')]);
107
104
  });
108
105
  it('returns no breaks when a newly added property is optional', async () => {
109
106
  const beforeSchema = {
@@ -121,7 +118,7 @@ describe('jsonBreakDetector', () => {
121
118
  },
122
119
  required: ['title'],
123
120
  };
124
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
121
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
125
122
  });
126
123
  it('detects multiple newly required fields at the root', async () => {
127
124
  const beforeSchema = {
@@ -142,7 +139,7 @@ describe('jsonBreakDetector', () => {
142
139
  },
143
140
  required: ['title', 'author'],
144
141
  };
145
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
142
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
146
143
  breakAt('title', 'New required field'),
147
144
  breakAt('author', 'New required field'),
148
145
  ]);
@@ -174,7 +171,7 @@ describe('jsonBreakDetector', () => {
174
171
  },
175
172
  },
176
173
  };
177
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('image.width', 'New required field')]);
174
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('image.width', 'New required field')]);
178
175
  });
179
176
  it('detects a newly required field in array item schemas', async () => {
180
177
  const beforeSchema = {
@@ -209,7 +206,7 @@ describe('jsonBreakDetector', () => {
209
206
  },
210
207
  },
211
208
  };
212
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('tags[].value', 'New required field')]);
209
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('tags[].value', 'New required field')]);
213
210
  });
214
211
  it('treats a missing before property schema as having no required fields', async () => {
215
212
  const beforeSchema = {
@@ -228,7 +225,7 @@ describe('jsonBreakDetector', () => {
228
225
  },
229
226
  },
230
227
  };
231
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('metadata.version', 'New required field')]);
228
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('metadata.version', 'New required field')]);
232
229
  });
233
230
  it('does not report a break when a field is removed from required', async () => {
234
231
  const beforeSchema = {
@@ -247,7 +244,7 @@ describe('jsonBreakDetector', () => {
247
244
  },
248
245
  required: ['title'],
249
246
  };
250
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
247
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
251
248
  });
252
249
  it('does not report a break when required is removed entirely', async () => {
253
250
  const beforeSchema = {
@@ -263,7 +260,7 @@ describe('jsonBreakDetector', () => {
263
260
  title: { type: 'string' },
264
261
  },
265
262
  };
266
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
263
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
267
264
  });
268
265
  it('does not report a break when required is an empty array', async () => {
269
266
  const beforeSchema = {
@@ -280,7 +277,7 @@ describe('jsonBreakDetector', () => {
280
277
  },
281
278
  required: [],
282
279
  };
283
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
280
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
284
281
  });
285
282
  it('does not report a break when dependentRequired is unchanged and a new optional property is added', async () => {
286
283
  const beforeSchema = {
@@ -304,7 +301,7 @@ describe('jsonBreakDetector', () => {
304
301
  image: ['width'],
305
302
  },
306
303
  };
307
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
304
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
308
305
  });
309
306
  it('detects a newly dependent required field at the root', async () => {
310
307
  const beforeSchema = {
@@ -329,7 +326,7 @@ describe('jsonBreakDetector', () => {
329
326
  image: ['width', 'height'],
330
327
  },
331
328
  };
332
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('height', 'New dependent required field')]);
329
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('height', 'New dependent required field')]);
333
330
  });
334
331
  it('detects a new dependentRequired rule at the root', async () => {
335
332
  const beforeSchema = {
@@ -349,7 +346,7 @@ describe('jsonBreakDetector', () => {
349
346
  image: ['width'],
350
347
  },
351
348
  };
352
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('width', 'New dependent required field')]);
349
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('width', 'New dependent required field')]);
353
350
  });
354
351
  it('detects a newly dependent required field in a nested object property', async () => {
355
352
  const beforeSchema = {
@@ -384,7 +381,7 @@ describe('jsonBreakDetector', () => {
384
381
  },
385
382
  },
386
383
  };
387
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
384
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
388
385
  breakAt('metadata.width', 'New dependent required field'),
389
386
  ]);
390
387
  });
@@ -426,7 +423,7 @@ describe('jsonBreakDetector', () => {
426
423
  },
427
424
  },
428
425
  };
429
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
426
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
430
427
  breakAt('tags[].category', 'New dependent required field'),
431
428
  ]);
432
429
  });
@@ -453,7 +450,7 @@ describe('jsonBreakDetector', () => {
453
450
  image: ['width'],
454
451
  },
455
452
  };
456
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
453
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
457
454
  });
458
455
  it('does not report a break when a dependentRequired trigger rule is removed entirely', async () => {
459
456
  const beforeSchema = {
@@ -473,7 +470,7 @@ describe('jsonBreakDetector', () => {
473
470
  width: { type: 'number' },
474
471
  },
475
472
  };
476
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
473
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
477
474
  });
478
475
  it('does not report a break when dependentRequired uses empty arrays', async () => {
479
476
  const beforeSchema = {
@@ -496,7 +493,7 @@ describe('jsonBreakDetector', () => {
496
493
  image: [],
497
494
  },
498
495
  };
499
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
496
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
500
497
  });
501
498
  it('does not report a break when dependentRequired is added with only empty arrays', async () => {
502
499
  const beforeSchema = {
@@ -514,7 +511,7 @@ describe('jsonBreakDetector', () => {
514
511
  image: [],
515
512
  },
516
513
  };
517
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
514
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
518
515
  });
519
516
  it('does not report dependentRequired for a newly added property', async () => {
520
517
  const beforeSchema = {
@@ -539,7 +536,7 @@ describe('jsonBreakDetector', () => {
539
536
  },
540
537
  },
541
538
  };
542
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
539
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
543
540
  });
544
541
  it('does not report dependentRequired when the trigger field is newly added', async () => {
545
542
  const beforeSchema = {
@@ -559,7 +556,7 @@ describe('jsonBreakDetector', () => {
559
556
  image: ['width'],
560
557
  },
561
558
  };
562
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
559
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
563
560
  });
564
561
  });
565
562
  describe('field types', () => {
@@ -578,7 +575,7 @@ describe('jsonBreakDetector', () => {
578
575
  count: { type: 'number' },
579
576
  },
580
577
  };
581
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
578
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
582
579
  });
583
580
  it('returns no breaks when a new field is added', async () => {
584
581
  const beforeSchema = {
@@ -596,7 +593,7 @@ describe('jsonBreakDetector', () => {
596
593
  subtitle: { type: 'string' },
597
594
  },
598
595
  };
599
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
596
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
600
597
  });
601
598
  it('returns no breaks when a "type" is added where it was undefined', async () => {
602
599
  const beforeSchema = {
@@ -612,7 +609,7 @@ describe('jsonBreakDetector', () => {
612
609
  count: { type: 'number' },
613
610
  },
614
611
  };
615
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
612
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
616
613
  });
617
614
  it('treats equivalent union types as unchanged', async () => {
618
615
  const beforeSchema = {
@@ -627,7 +624,7 @@ describe('jsonBreakDetector', () => {
627
624
  value: { type: ['null', 'string'] },
628
625
  },
629
626
  };
630
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
627
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
631
628
  });
632
629
  it('does not report a break when integer is relaxed to number', async () => {
633
630
  const beforeSchema = {
@@ -642,7 +639,7 @@ describe('jsonBreakDetector', () => {
642
639
  count: { type: 'number' },
643
640
  },
644
641
  };
645
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
642
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
646
643
  });
647
644
  it('does not report a break when integer is relaxed to number in a union type', async () => {
648
645
  const beforeSchema = {
@@ -657,7 +654,7 @@ describe('jsonBreakDetector', () => {
657
654
  count: { type: ['number', 'null'] },
658
655
  },
659
656
  };
660
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
657
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
661
658
  });
662
659
  it('does not report a break when integer is relaxed to number in array item schemas', async () => {
663
660
  const beforeSchema = {
@@ -678,7 +675,7 @@ describe('jsonBreakDetector', () => {
678
675
  },
679
676
  },
680
677
  };
681
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
678
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
682
679
  });
683
680
  it('detects a break when number is narrowed to integer', async () => {
684
681
  const beforeSchema = {
@@ -693,7 +690,7 @@ describe('jsonBreakDetector', () => {
693
690
  count: { type: 'integer' },
694
691
  },
695
692
  };
696
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Field type changed')]);
693
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Field type changed')]);
697
694
  });
698
695
  it('detects a break when number is narrowed to integer in a union type', async () => {
699
696
  const beforeSchema = {
@@ -708,7 +705,7 @@ describe('jsonBreakDetector', () => {
708
705
  count: { type: ['integer', 'null'] },
709
706
  },
710
707
  };
711
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Field type changed')]);
708
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Field type changed')]);
712
709
  });
713
710
  it('detects a field type change at the root', async () => {
714
711
  const beforeSchema = {
@@ -723,7 +720,7 @@ describe('jsonBreakDetector', () => {
723
720
  sheep: { type: 'array', items: { type: 'object', properties: { name: { type: 'string' } } } },
724
721
  },
725
722
  };
726
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('sheep', 'Field type changed')]);
723
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('sheep', 'Field type changed')]);
727
724
  });
728
725
  it('detects a field type change in a nested object property', async () => {
729
726
  const beforeSchema = {
@@ -748,7 +745,7 @@ describe('jsonBreakDetector', () => {
748
745
  },
749
746
  },
750
747
  };
751
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('image.width', 'Field type changed')]);
748
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('image.width', 'Field type changed')]);
752
749
  });
753
750
  it('detects a field type change in array item schemas', async () => {
754
751
  const beforeSchema = {
@@ -769,7 +766,7 @@ describe('jsonBreakDetector', () => {
769
766
  },
770
767
  },
771
768
  };
772
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('tags[]', 'Field type changed')]);
769
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('tags[]', 'Field type changed')]);
773
770
  });
774
771
  it('detects when type is removed on an existing field', async () => {
775
772
  const beforeSchema = {
@@ -784,7 +781,7 @@ describe('jsonBreakDetector', () => {
784
781
  count: {},
785
782
  },
786
783
  };
787
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Field type changed')]);
784
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Field type changed')]);
788
785
  });
789
786
  it('detects a field type change in a deeply nested object property', async () => {
790
787
  const beforeSchema = {
@@ -819,7 +816,7 @@ describe('jsonBreakDetector', () => {
819
816
  },
820
817
  },
821
818
  };
822
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
819
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
823
820
  breakAt('content.sidebar.width', 'Field type changed'),
824
821
  ]);
825
822
  });
@@ -838,7 +835,7 @@ describe('jsonBreakDetector', () => {
838
835
  status: { type: 'string', enum: ['draft', 'published', 'archived'] },
839
836
  },
840
837
  };
841
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
838
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
842
839
  });
843
840
  it('returns no breaks when enum options are added', async () => {
844
841
  const beforeSchema = {
@@ -853,7 +850,7 @@ describe('jsonBreakDetector', () => {
853
850
  status: { type: 'string', enum: ['draft', 'published', 'archived'] },
854
851
  },
855
852
  };
856
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
853
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
857
854
  });
858
855
  it('returns no breaks when a single-value enum becomes const with the same value', async () => {
859
856
  const beforeSchema = {
@@ -868,7 +865,7 @@ describe('jsonBreakDetector', () => {
868
865
  status: { type: 'string', const: 'published' },
869
866
  },
870
867
  };
871
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
868
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
872
869
  });
873
870
  it('detects removed enum options when a multi-value enum is narrowed to const', async () => {
874
871
  const beforeSchema = {
@@ -883,7 +880,7 @@ describe('jsonBreakDetector', () => {
883
880
  status: { type: 'string', const: 'published' },
884
881
  },
885
882
  };
886
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
883
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
887
884
  breakAt('status', 'Enum options removed'),
888
885
  breakAt('status', 'Const value changed'),
889
886
  ]);
@@ -901,7 +898,7 @@ describe('jsonBreakDetector', () => {
901
898
  status: { type: 'string', enum: ['draft', 'published'] },
902
899
  },
903
900
  };
904
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('status', 'Enum options removed')]);
901
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('status', 'Enum options removed')]);
905
902
  });
906
903
  it('detects removed enum options in a nested object property', async () => {
907
904
  const beforeSchema = {
@@ -926,7 +923,7 @@ describe('jsonBreakDetector', () => {
926
923
  },
927
924
  },
928
925
  };
929
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
926
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
930
927
  breakAt('metadata.status', 'Enum options removed'),
931
928
  breakAt('metadata.status', 'Const value changed'),
932
929
  ]);
@@ -950,7 +947,7 @@ describe('jsonBreakDetector', () => {
950
947
  },
951
948
  },
952
949
  };
953
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('tags[]', 'Enum options removed')]);
950
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('tags[]', 'Enum options removed')]);
954
951
  });
955
952
  it('returns no breaks when enum is removed entirely', async () => {
956
953
  const beforeSchema = {
@@ -965,7 +962,7 @@ describe('jsonBreakDetector', () => {
965
962
  status: { type: 'string' },
966
963
  },
967
964
  };
968
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
965
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
969
966
  });
970
967
  it('detects enum added to an existing field without enum', async () => {
971
968
  const beforeSchema = {
@@ -980,7 +977,7 @@ describe('jsonBreakDetector', () => {
980
977
  status: { type: 'string', enum: ['draft', 'published'] },
981
978
  },
982
979
  };
983
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('status', 'Enum added')]);
980
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('status', 'Enum added')]);
984
981
  });
985
982
  it('detects enum added in a nested object property', async () => {
986
983
  const beforeSchema = {
@@ -1005,7 +1002,7 @@ describe('jsonBreakDetector', () => {
1005
1002
  },
1006
1003
  },
1007
1004
  };
1008
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('metadata.status', 'Enum added')]);
1005
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('metadata.status', 'Enum added')]);
1009
1006
  });
1010
1007
  it('detects enum added in array item schemas', async () => {
1011
1008
  const beforeSchema = {
@@ -1026,7 +1023,7 @@ describe('jsonBreakDetector', () => {
1026
1023
  },
1027
1024
  },
1028
1025
  };
1029
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('tags[]', 'Enum added')]);
1026
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('tags[]', 'Enum added')]);
1030
1027
  });
1031
1028
  it('does not report enum added for a newly added property', async () => {
1032
1029
  const beforeSchema = {
@@ -1042,7 +1039,7 @@ describe('jsonBreakDetector', () => {
1042
1039
  status: { type: 'string', enum: ['draft', 'published'] },
1043
1040
  },
1044
1041
  };
1045
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
1042
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
1046
1043
  });
1047
1044
  it('does not report enum added when a const is relaxed to an enum that includes the same value', async () => {
1048
1045
  const beforeSchema = {
@@ -1057,7 +1054,7 @@ describe('jsonBreakDetector', () => {
1057
1054
  status: { type: 'string', enum: ['draft', 'published'] },
1058
1055
  },
1059
1056
  };
1060
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
1057
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
1061
1058
  });
1062
1059
  it('does not report enum removal for a newly added property', async () => {
1063
1060
  const beforeSchema = {
@@ -1073,7 +1070,7 @@ describe('jsonBreakDetector', () => {
1073
1070
  status: { type: 'string', enum: ['draft', 'published'] },
1074
1071
  },
1075
1072
  };
1076
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
1073
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
1077
1074
  });
1078
1075
  });
1079
1076
  describe('const values', () => {
@@ -1090,7 +1087,7 @@ describe('jsonBreakDetector', () => {
1090
1087
  type: { type: 'string', const: 'article' },
1091
1088
  },
1092
1089
  };
1093
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
1090
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
1094
1091
  });
1095
1092
  it('returns no breaks when a single-value enum becomes const with the same value', async () => {
1096
1093
  const beforeSchema = {
@@ -1105,7 +1102,7 @@ describe('jsonBreakDetector', () => {
1105
1102
  type: { type: 'string', const: 'article' },
1106
1103
  },
1107
1104
  };
1108
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
1105
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
1109
1106
  });
1110
1107
  it('returns no breaks when const becomes a single-value enum with the same value', async () => {
1111
1108
  const beforeSchema = {
@@ -1120,7 +1117,7 @@ describe('jsonBreakDetector', () => {
1120
1117
  type: { type: 'string', enum: ['article'] },
1121
1118
  },
1122
1119
  };
1123
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
1120
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
1124
1121
  });
1125
1122
  it('returns no breaks when const is removed', async () => {
1126
1123
  const beforeSchema = {
@@ -1135,7 +1132,7 @@ describe('jsonBreakDetector', () => {
1135
1132
  type: { type: 'string' },
1136
1133
  },
1137
1134
  };
1138
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
1135
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
1139
1136
  });
1140
1137
  it('detects when const is added to an existing field', async () => {
1141
1138
  const beforeSchema = {
@@ -1150,7 +1147,7 @@ describe('jsonBreakDetector', () => {
1150
1147
  type: { type: 'string', const: 'article' },
1151
1148
  },
1152
1149
  };
1153
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('type', 'Const value changed')]);
1150
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('type', 'Const value changed')]);
1154
1151
  });
1155
1152
  it('detects when const is changed on an existing field', async () => {
1156
1153
  const beforeSchema = {
@@ -1165,7 +1162,7 @@ describe('jsonBreakDetector', () => {
1165
1162
  type: { type: 'string', const: 'page' },
1166
1163
  },
1167
1164
  };
1168
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('type', 'Const value changed')]);
1165
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('type', 'Const value changed')]);
1169
1166
  });
1170
1167
  it('detects const changes in a nested object property', async () => {
1171
1168
  const beforeSchema = {
@@ -1190,7 +1187,7 @@ describe('jsonBreakDetector', () => {
1190
1187
  },
1191
1188
  },
1192
1189
  };
1193
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
1190
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
1194
1191
  breakAt('metadata.version', 'Const value changed'),
1195
1192
  ]);
1196
1193
  });
@@ -1213,7 +1210,7 @@ describe('jsonBreakDetector', () => {
1213
1210
  },
1214
1211
  },
1215
1212
  };
1216
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('tags[]', 'Const value changed')]);
1213
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('tags[]', 'Const value changed')]);
1217
1214
  });
1218
1215
  it('does not report const changes for a newly added property', async () => {
1219
1216
  const beforeSchema = {
@@ -1229,7 +1226,7 @@ describe('jsonBreakDetector', () => {
1229
1226
  type: { type: 'string', const: 'article' },
1230
1227
  },
1231
1228
  };
1232
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
1229
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
1233
1230
  });
1234
1231
  });
1235
1232
  describe('array constraints', () => {
@@ -1260,7 +1257,7 @@ describe('jsonBreakDetector', () => {
1260
1257
  },
1261
1258
  },
1262
1259
  };
1263
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
1260
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
1264
1261
  });
1265
1262
  it('returns no breaks when array constraints are relaxed', async () => {
1266
1263
  const beforeSchema = {
@@ -1288,7 +1285,7 @@ describe('jsonBreakDetector', () => {
1288
1285
  },
1289
1286
  },
1290
1287
  };
1291
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
1288
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
1292
1289
  });
1293
1290
  it('detects minItems being increased at the root', async () => {
1294
1291
  const beforeSchema = {
@@ -1303,7 +1300,7 @@ describe('jsonBreakDetector', () => {
1303
1300
  tags: { type: 'array', minItems: 3, items: { type: 'string' } },
1304
1301
  },
1305
1302
  };
1306
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('tags', 'Array minItems increased')]);
1303
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('tags', 'Array minItems increased')]);
1307
1304
  });
1308
1305
  it('detects minItems being added where it was previously unset', async () => {
1309
1306
  const beforeSchema = {
@@ -1318,7 +1315,7 @@ describe('jsonBreakDetector', () => {
1318
1315
  tags: { type: 'array', minItems: 1, items: { type: 'string' } },
1319
1316
  },
1320
1317
  };
1321
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('tags', 'Array minItems increased')]);
1318
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('tags', 'Array minItems increased')]);
1322
1319
  });
1323
1320
  it('detects maxItems being lowered at the root', async () => {
1324
1321
  const beforeSchema = {
@@ -1333,7 +1330,7 @@ describe('jsonBreakDetector', () => {
1333
1330
  tags: { type: 'array', maxItems: 5, items: { type: 'string' } },
1334
1331
  },
1335
1332
  };
1336
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('tags', 'Array maxItems lowered')]);
1333
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('tags', 'Array maxItems lowered')]);
1337
1334
  });
1338
1335
  it('detects maxItems being added where it was previously unset', async () => {
1339
1336
  const beforeSchema = {
@@ -1348,7 +1345,7 @@ describe('jsonBreakDetector', () => {
1348
1345
  tags: { type: 'array', maxItems: 5, items: { type: 'string' } },
1349
1346
  },
1350
1347
  };
1351
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('tags', 'Array maxItems lowered')]);
1348
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('tags', 'Array maxItems lowered')]);
1352
1349
  });
1353
1350
  it('detects uniqueItems being added at the root', async () => {
1354
1351
  const beforeSchema = {
@@ -1363,7 +1360,7 @@ describe('jsonBreakDetector', () => {
1363
1360
  tags: { type: 'array', uniqueItems: true, items: { type: 'string' } },
1364
1361
  },
1365
1362
  };
1366
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('tags', 'Array uniqueItems added')]);
1363
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('tags', 'Array uniqueItems added')]);
1367
1364
  });
1368
1365
  it('detects contains being added at the root', async () => {
1369
1366
  const beforeSchema = {
@@ -1378,7 +1375,7 @@ describe('jsonBreakDetector', () => {
1378
1375
  tags: { type: 'array', contains: { type: 'string' }, items: { type: 'string' } },
1379
1376
  },
1380
1377
  };
1381
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('tags.{contains}', 'Field type changed')]);
1378
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('tags.{contains}', 'Field type changed')]);
1382
1379
  });
1383
1380
  it('detects contains type changes at the root', async () => {
1384
1381
  const beforeSchema = {
@@ -1401,7 +1398,7 @@ describe('jsonBreakDetector', () => {
1401
1398
  },
1402
1399
  },
1403
1400
  };
1404
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('tags.{contains}', 'Field type changed')]);
1401
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('tags.{contains}', 'Field type changed')]);
1405
1402
  });
1406
1403
  it('detects string constraint narrowing inside contains subschemas', async () => {
1407
1404
  const beforeSchema = {
@@ -1424,7 +1421,7 @@ describe('jsonBreakDetector', () => {
1424
1421
  },
1425
1422
  },
1426
1423
  };
1427
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
1424
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
1428
1425
  breakAt('tags.{contains}', 'String minLength increased'),
1429
1426
  ]);
1430
1427
  });
@@ -1451,7 +1448,7 @@ describe('jsonBreakDetector', () => {
1451
1448
  },
1452
1449
  },
1453
1450
  };
1454
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
1451
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
1455
1452
  breakAt('metadata.tags', 'Array minItems increased'),
1456
1453
  ]);
1457
1454
  });
@@ -1488,7 +1485,7 @@ describe('jsonBreakDetector', () => {
1488
1485
  },
1489
1486
  },
1490
1487
  };
1491
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
1488
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
1492
1489
  breakAt('content.sidebar.links', 'Array maxItems lowered'),
1493
1490
  ]);
1494
1491
  });
@@ -1515,7 +1512,7 @@ describe('jsonBreakDetector', () => {
1515
1512
  },
1516
1513
  },
1517
1514
  };
1518
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
1515
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
1519
1516
  breakAt('metadata.roles', 'Array uniqueItems added'),
1520
1517
  ]);
1521
1518
  });
@@ -1550,7 +1547,7 @@ describe('jsonBreakDetector', () => {
1550
1547
  },
1551
1548
  },
1552
1549
  };
1553
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
1550
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
1554
1551
  breakAt('metadata.tags.{contains}', 'Field type changed'),
1555
1552
  ]);
1556
1553
  });
@@ -1581,7 +1578,7 @@ describe('jsonBreakDetector', () => {
1581
1578
  },
1582
1579
  },
1583
1580
  };
1584
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('groups[]', 'Array maxItems lowered')]);
1581
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('groups[]', 'Array maxItems lowered')]);
1585
1582
  });
1586
1583
  it('detects minItems being increased on arrays inside array item objects', async () => {
1587
1584
  const beforeSchema = {
@@ -1612,7 +1609,7 @@ describe('jsonBreakDetector', () => {
1612
1609
  },
1613
1610
  },
1614
1611
  };
1615
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
1612
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
1616
1613
  breakAt('groups[].tags', 'Array minItems increased'),
1617
1614
  ]);
1618
1615
  });
@@ -1645,7 +1642,7 @@ describe('jsonBreakDetector', () => {
1645
1642
  },
1646
1643
  },
1647
1644
  };
1648
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
1645
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
1649
1646
  breakAt('groups[].tags', 'Array maxItems lowered'),
1650
1647
  ]);
1651
1648
  });
@@ -1678,7 +1675,7 @@ describe('jsonBreakDetector', () => {
1678
1675
  },
1679
1676
  },
1680
1677
  };
1681
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
1678
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
1682
1679
  breakAt('groups[].members', 'Array uniqueItems added'),
1683
1680
  ]);
1684
1681
  });
@@ -1719,7 +1716,7 @@ describe('jsonBreakDetector', () => {
1719
1716
  },
1720
1717
  },
1721
1718
  };
1722
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
1719
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
1723
1720
  breakAt('groups[].labels.{contains}', 'Field type changed'),
1724
1721
  ]);
1725
1722
  });
@@ -1768,7 +1765,7 @@ describe('jsonBreakDetector', () => {
1768
1765
  },
1769
1766
  },
1770
1767
  };
1771
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
1768
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
1772
1769
  breakAt('sections[].blocks[].items', 'Array minItems increased'),
1773
1770
  ]);
1774
1771
  });
@@ -1817,7 +1814,7 @@ describe('jsonBreakDetector', () => {
1817
1814
  },
1818
1815
  },
1819
1816
  };
1820
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
1817
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
1821
1818
  breakAt('sections[].content.tags', 'Array minItems increased'),
1822
1819
  breakAt('sections[].content.tags', 'Array maxItems lowered'),
1823
1820
  breakAt('sections[].content.tags', 'Array uniqueItems added'),
@@ -1842,7 +1839,7 @@ describe('jsonBreakDetector', () => {
1842
1839
  },
1843
1840
  },
1844
1841
  };
1845
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
1842
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
1846
1843
  breakAt('tags', 'Array minItems increased'),
1847
1844
  breakAt('tags', 'Array maxItems lowered'),
1848
1845
  breakAt('tags', 'Array uniqueItems added'),
@@ -1862,7 +1859,7 @@ describe('jsonBreakDetector', () => {
1862
1859
  tags: { type: 'array', minItems: 1, uniqueItems: true, items: { type: 'string' } },
1863
1860
  },
1864
1861
  };
1865
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
1862
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
1866
1863
  });
1867
1864
  });
1868
1865
  describe('numeric constraints', () => {
@@ -1879,7 +1876,7 @@ describe('jsonBreakDetector', () => {
1879
1876
  count: { type: 'number', minimum: 0, maximum: 100, exclusiveMinimum: 0, exclusiveMaximum: 100 },
1880
1877
  },
1881
1878
  };
1882
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
1879
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
1883
1880
  });
1884
1881
  it('returns no breaks when numeric constraints are relaxed', async () => {
1885
1882
  const beforeSchema = {
@@ -1894,7 +1891,7 @@ describe('jsonBreakDetector', () => {
1894
1891
  count: { type: 'number', minimum: 0, maximum: 100, multipleOf: 2 },
1895
1892
  },
1896
1893
  };
1897
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
1894
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
1898
1895
  });
1899
1896
  it('returns no breaks when both bounds are set and minimum remains the effective lower bound', async () => {
1900
1897
  const beforeSchema = {
@@ -1909,7 +1906,7 @@ describe('jsonBreakDetector', () => {
1909
1906
  count: { type: 'number', minimum: 5, exclusiveMinimum: 4 },
1910
1907
  },
1911
1908
  };
1912
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
1909
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
1913
1910
  });
1914
1911
  it('returns no breaks when both bounds are set and maximum remains the effective upper bound', async () => {
1915
1912
  const beforeSchema = {
@@ -1924,7 +1921,7 @@ describe('jsonBreakDetector', () => {
1924
1921
  count: { type: 'number', maximum: 10, exclusiveMaximum: 15 },
1925
1922
  },
1926
1923
  };
1927
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
1924
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
1928
1925
  });
1929
1926
  it('detects minimum being increased at the root', async () => {
1930
1927
  const beforeSchema = {
@@ -1939,7 +1936,7 @@ describe('jsonBreakDetector', () => {
1939
1936
  count: { type: 'number', minimum: 5 },
1940
1937
  },
1941
1938
  };
1942
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Numeric minimum increased')]);
1939
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Numeric minimum increased')]);
1943
1940
  });
1944
1941
  it('detects minimum being added where it was previously unset', async () => {
1945
1942
  const beforeSchema = {
@@ -1954,7 +1951,7 @@ describe('jsonBreakDetector', () => {
1954
1951
  count: { type: 'number', minimum: 1 },
1955
1952
  },
1956
1953
  };
1957
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Numeric minimum increased')]);
1954
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Numeric minimum increased')]);
1958
1955
  });
1959
1956
  it('detects exclusiveMinimum being increased at the root', async () => {
1960
1957
  const beforeSchema = {
@@ -1969,7 +1966,7 @@ describe('jsonBreakDetector', () => {
1969
1966
  count: { type: 'number', exclusiveMinimum: 5 },
1970
1967
  },
1971
1968
  };
1972
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
1969
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
1973
1970
  breakAt('count', 'Numeric exclusiveMinimum increased'),
1974
1971
  ]);
1975
1972
  });
@@ -1986,7 +1983,7 @@ describe('jsonBreakDetector', () => {
1986
1983
  count: { type: 'number', exclusiveMinimum: 0 },
1987
1984
  },
1988
1985
  };
1989
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
1986
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
1990
1987
  breakAt('count', 'Numeric exclusiveMinimum increased'),
1991
1988
  ]);
1992
1989
  });
@@ -2003,7 +2000,7 @@ describe('jsonBreakDetector', () => {
2003
2000
  count: { type: 'number', maximum: 50 },
2004
2001
  },
2005
2002
  };
2006
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Numeric maximum lowered')]);
2003
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Numeric maximum lowered')]);
2007
2004
  });
2008
2005
  it('detects maximum being added where it was previously unset', async () => {
2009
2006
  const beforeSchema = {
@@ -2018,7 +2015,7 @@ describe('jsonBreakDetector', () => {
2018
2015
  count: { type: 'number', maximum: 100 },
2019
2016
  },
2020
2017
  };
2021
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Numeric maximum lowered')]);
2018
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Numeric maximum lowered')]);
2022
2019
  });
2023
2020
  it('detects exclusiveMaximum being lowered at the root', async () => {
2024
2021
  const beforeSchema = {
@@ -2033,7 +2030,7 @@ describe('jsonBreakDetector', () => {
2033
2030
  count: { type: 'number', exclusiveMaximum: 50 },
2034
2031
  },
2035
2032
  };
2036
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
2033
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
2037
2034
  breakAt('count', 'Numeric exclusiveMaximum lowered'),
2038
2035
  ]);
2039
2036
  });
@@ -2050,7 +2047,7 @@ describe('jsonBreakDetector', () => {
2050
2047
  count: { type: 'number', exclusiveMaximum: 100 },
2051
2048
  },
2052
2049
  };
2053
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
2050
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
2054
2051
  breakAt('count', 'Numeric exclusiveMaximum lowered'),
2055
2052
  ]);
2056
2053
  });
@@ -2077,7 +2074,7 @@ describe('jsonBreakDetector', () => {
2077
2074
  },
2078
2075
  },
2079
2076
  };
2080
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
2077
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
2081
2078
  breakAt('metadata.priority', 'Numeric minimum increased'),
2082
2079
  ]);
2083
2080
  });
@@ -2100,7 +2097,7 @@ describe('jsonBreakDetector', () => {
2100
2097
  },
2101
2098
  },
2102
2099
  };
2103
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('scores[]', 'Numeric maximum lowered')]);
2100
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('scores[]', 'Numeric maximum lowered')]);
2104
2101
  });
2105
2102
  it('detects multiple numeric constraint breaks on the same field', async () => {
2106
2103
  const beforeSchema = {
@@ -2115,7 +2112,7 @@ describe('jsonBreakDetector', () => {
2115
2112
  count: { type: 'number', minimum: 5, maximum: 50, exclusiveMinimum: 5, exclusiveMaximum: 50 },
2116
2113
  },
2117
2114
  };
2118
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
2115
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
2119
2116
  breakAt('count', 'Numeric exclusiveMinimum increased'),
2120
2117
  breakAt('count', 'Numeric exclusiveMaximum lowered'),
2121
2118
  ]);
@@ -2133,7 +2130,7 @@ describe('jsonBreakDetector', () => {
2133
2130
  count: { type: 'number', exclusiveMinimum: 5 },
2134
2131
  },
2135
2132
  };
2136
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
2133
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
2137
2134
  breakAt('count', 'Numeric exclusiveMinimum increased'),
2138
2135
  ]);
2139
2136
  });
@@ -2150,7 +2147,7 @@ describe('jsonBreakDetector', () => {
2150
2147
  count: { type: 'number', exclusiveMinimum: 4 },
2151
2148
  },
2152
2149
  };
2153
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
2150
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
2154
2151
  });
2155
2152
  it('does not report a break when exclusiveMinimum is relaxed to minimum at the same value', async () => {
2156
2153
  const beforeSchema = {
@@ -2165,7 +2162,7 @@ describe('jsonBreakDetector', () => {
2165
2162
  count: { type: 'number', minimum: 5 },
2166
2163
  },
2167
2164
  };
2168
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
2165
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
2169
2166
  });
2170
2167
  it('detects maximum being changed to exclusiveMaximum at the same value', async () => {
2171
2168
  const beforeSchema = {
@@ -2180,7 +2177,7 @@ describe('jsonBreakDetector', () => {
2180
2177
  count: { type: 'number', exclusiveMaximum: 10 },
2181
2178
  },
2182
2179
  };
2183
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
2180
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
2184
2181
  breakAt('count', 'Numeric exclusiveMaximum lowered'),
2185
2182
  ]);
2186
2183
  });
@@ -2197,7 +2194,7 @@ describe('jsonBreakDetector', () => {
2197
2194
  count: { type: 'number', exclusiveMaximum: 11 },
2198
2195
  },
2199
2196
  };
2200
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
2197
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
2201
2198
  });
2202
2199
  it('does not report a break when exclusiveMaximum is relaxed to maximum at the same value', async () => {
2203
2200
  const beforeSchema = {
@@ -2212,7 +2209,7 @@ describe('jsonBreakDetector', () => {
2212
2209
  count: { type: 'number', maximum: 10 },
2213
2210
  },
2214
2211
  };
2215
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
2212
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
2216
2213
  });
2217
2214
  it('does not report a break when exclusiveMinimum is redundant alongside a stricter minimum', async () => {
2218
2215
  const beforeSchema = {
@@ -2227,7 +2224,7 @@ describe('jsonBreakDetector', () => {
2227
2224
  count: { type: 'number', minimum: 5, exclusiveMinimum: 3 },
2228
2225
  },
2229
2226
  };
2230
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
2227
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
2231
2228
  });
2232
2229
  it('detects when exclusiveMinimum is added at the same value as an existing minimum', async () => {
2233
2230
  const beforeSchema = {
@@ -2242,7 +2239,7 @@ describe('jsonBreakDetector', () => {
2242
2239
  count: { type: 'number', minimum: 5, exclusiveMinimum: 5 },
2243
2240
  },
2244
2241
  };
2245
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
2242
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
2246
2243
  breakAt('count', 'Numeric exclusiveMinimum increased'),
2247
2244
  ]);
2248
2245
  });
@@ -2259,7 +2256,7 @@ describe('jsonBreakDetector', () => {
2259
2256
  count: { type: 'number', maximum: 10, exclusiveMaximum: 10 },
2260
2257
  },
2261
2258
  };
2262
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
2259
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
2263
2260
  breakAt('count', 'Numeric exclusiveMaximum lowered'),
2264
2261
  ]);
2265
2262
  });
@@ -2276,7 +2273,7 @@ describe('jsonBreakDetector', () => {
2276
2273
  count: { type: 'number', minimum: 3, exclusiveMinimum: 5 },
2277
2274
  },
2278
2275
  };
2279
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
2276
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
2280
2277
  breakAt('count', 'Numeric exclusiveMinimum increased'),
2281
2278
  ]);
2282
2279
  });
@@ -2293,7 +2290,7 @@ describe('jsonBreakDetector', () => {
2293
2290
  count: { type: 'number', minimum: 5, exclusiveMinimum: 1 },
2294
2291
  },
2295
2292
  };
2296
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Numeric minimum increased')]);
2293
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Numeric minimum increased')]);
2297
2294
  });
2298
2295
  it('does not report a break when exclusiveMaximum is redundant alongside a stricter maximum', async () => {
2299
2296
  const beforeSchema = {
@@ -2308,7 +2305,7 @@ describe('jsonBreakDetector', () => {
2308
2305
  count: { type: 'number', maximum: 10, exclusiveMaximum: 20 },
2309
2306
  },
2310
2307
  };
2311
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
2308
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
2312
2309
  });
2313
2310
  it('detects when exclusiveMaximum tightens beyond an existing maximum', async () => {
2314
2311
  const beforeSchema = {
@@ -2323,7 +2320,7 @@ describe('jsonBreakDetector', () => {
2323
2320
  count: { type: 'number', maximum: 20, exclusiveMaximum: 10 },
2324
2321
  },
2325
2322
  };
2326
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
2323
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
2327
2324
  breakAt('count', 'Numeric exclusiveMaximum lowered'),
2328
2325
  ]);
2329
2326
  });
@@ -2340,7 +2337,7 @@ describe('jsonBreakDetector', () => {
2340
2337
  count: { type: 'number', maximum: 10, exclusiveMaximum: 30 },
2341
2338
  },
2342
2339
  };
2343
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Numeric maximum lowered')]);
2340
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Numeric maximum lowered')]);
2344
2341
  });
2345
2342
  it('detects multipleOf being added where it was previously unset', async () => {
2346
2343
  const beforeSchema = {
@@ -2355,7 +2352,7 @@ describe('jsonBreakDetector', () => {
2355
2352
  count: { type: 'number', multipleOf: 2 },
2356
2353
  },
2357
2354
  };
2358
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Numeric multipleOf narrowed')]);
2355
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Numeric multipleOf narrowed')]);
2359
2356
  });
2360
2357
  it('detects multipleOf being narrowed to a coarser divisor', async () => {
2361
2358
  const beforeSchema = {
@@ -2370,7 +2367,7 @@ describe('jsonBreakDetector', () => {
2370
2367
  count: { type: 'number', multipleOf: 4 },
2371
2368
  },
2372
2369
  };
2373
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Numeric multipleOf narrowed')]);
2370
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Numeric multipleOf narrowed')]);
2374
2371
  });
2375
2372
  it('detects multipleOf being changed to an incompatible divisor', async () => {
2376
2373
  const beforeSchema = {
@@ -2385,7 +2382,7 @@ describe('jsonBreakDetector', () => {
2385
2382
  count: { type: 'number', multipleOf: 3 },
2386
2383
  },
2387
2384
  };
2388
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Numeric multipleOf narrowed')]);
2385
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('count', 'Numeric multipleOf narrowed')]);
2389
2386
  });
2390
2387
  it('does not report a break when multipleOf is relaxed to a finer divisor', async () => {
2391
2388
  const beforeSchema = {
@@ -2400,7 +2397,7 @@ describe('jsonBreakDetector', () => {
2400
2397
  count: { type: 'number', multipleOf: 2 },
2401
2398
  },
2402
2399
  };
2403
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
2400
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
2404
2401
  });
2405
2402
  it('does not report numeric constraint changes for a newly added property', async () => {
2406
2403
  const beforeSchema = {
@@ -2416,7 +2413,7 @@ describe('jsonBreakDetector', () => {
2416
2413
  count: { type: 'number', minimum: 1, maximum: 10 },
2417
2414
  },
2418
2415
  };
2419
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
2416
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
2420
2417
  });
2421
2418
  });
2422
2419
  describe('string constraints', () => {
@@ -2433,7 +2430,7 @@ describe('jsonBreakDetector', () => {
2433
2430
  title: { type: 'string', minLength: 1, maxLength: 100, format: 'email', pattern: '^[a-z]+$' },
2434
2431
  },
2435
2432
  };
2436
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
2433
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
2437
2434
  });
2438
2435
  it('returns no breaks when string constraints are relaxed', async () => {
2439
2436
  const beforeSchema = {
@@ -2448,7 +2445,7 @@ describe('jsonBreakDetector', () => {
2448
2445
  title: { type: 'string', minLength: 1, maxLength: 100 },
2449
2446
  },
2450
2447
  };
2451
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
2448
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
2452
2449
  });
2453
2450
  it('detects minLength being increased at the root', async () => {
2454
2451
  const beforeSchema = {
@@ -2463,7 +2460,7 @@ describe('jsonBreakDetector', () => {
2463
2460
  title: { type: 'string', minLength: 5 },
2464
2461
  },
2465
2462
  };
2466
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('title', 'String minLength increased')]);
2463
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('title', 'String minLength increased')]);
2467
2464
  });
2468
2465
  it('detects minLength being added where it was previously unset', async () => {
2469
2466
  const beforeSchema = {
@@ -2478,7 +2475,7 @@ describe('jsonBreakDetector', () => {
2478
2475
  title: { type: 'string', minLength: 1 },
2479
2476
  },
2480
2477
  };
2481
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('title', 'String minLength increased')]);
2478
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('title', 'String minLength increased')]);
2482
2479
  });
2483
2480
  it('detects maxLength being lowered at the root', async () => {
2484
2481
  const beforeSchema = {
@@ -2493,7 +2490,7 @@ describe('jsonBreakDetector', () => {
2493
2490
  title: { type: 'string', maxLength: 50 },
2494
2491
  },
2495
2492
  };
2496
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('title', 'String maxLength lowered')]);
2493
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('title', 'String maxLength lowered')]);
2497
2494
  });
2498
2495
  it('detects maxLength being added where it was previously unset', async () => {
2499
2496
  const beforeSchema = {
@@ -2508,7 +2505,7 @@ describe('jsonBreakDetector', () => {
2508
2505
  title: { type: 'string', maxLength: 100 },
2509
2506
  },
2510
2507
  };
2511
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('title', 'String maxLength lowered')]);
2508
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('title', 'String maxLength lowered')]);
2512
2509
  });
2513
2510
  it('detects format being added where it was previously unset', async () => {
2514
2511
  const beforeSchema = {
@@ -2523,7 +2520,7 @@ describe('jsonBreakDetector', () => {
2523
2520
  email: { type: 'string', format: 'email' },
2524
2521
  },
2525
2522
  };
2526
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('email', 'String format changed')]);
2523
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('email', 'String format changed')]);
2527
2524
  });
2528
2525
  it('detects format being changed on an existing field', async () => {
2529
2526
  const beforeSchema = {
@@ -2538,7 +2535,7 @@ describe('jsonBreakDetector', () => {
2538
2535
  value: { type: 'string', format: 'uri' },
2539
2536
  },
2540
2537
  };
2541
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('value', 'String format changed')]);
2538
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('value', 'String format changed')]);
2542
2539
  });
2543
2540
  it('detects pattern being added where it was previously unset', async () => {
2544
2541
  const beforeSchema = {
@@ -2553,7 +2550,7 @@ describe('jsonBreakDetector', () => {
2553
2550
  slug: { type: 'string', pattern: '^[a-z]+$' },
2554
2551
  },
2555
2552
  };
2556
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('slug', 'String pattern changed')]);
2553
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('slug', 'String pattern changed')]);
2557
2554
  });
2558
2555
  it('detects pattern being changed on an existing field', async () => {
2559
2556
  const beforeSchema = {
@@ -2568,7 +2565,7 @@ describe('jsonBreakDetector', () => {
2568
2565
  slug: { type: 'string', pattern: '^[a-z0-9-]+$' },
2569
2566
  },
2570
2567
  };
2571
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('slug', 'String pattern changed')]);
2568
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('slug', 'String pattern changed')]);
2572
2569
  });
2573
2570
  it('does not report a break when format is removed', async () => {
2574
2571
  const beforeSchema = {
@@ -2583,7 +2580,7 @@ describe('jsonBreakDetector', () => {
2583
2580
  email: { type: 'string' },
2584
2581
  },
2585
2582
  };
2586
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
2583
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
2587
2584
  });
2588
2585
  it('does not report a break when pattern is removed', async () => {
2589
2586
  const beforeSchema = {
@@ -2598,7 +2595,7 @@ describe('jsonBreakDetector', () => {
2598
2595
  slug: { type: 'string' },
2599
2596
  },
2600
2597
  };
2601
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
2598
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
2602
2599
  });
2603
2600
  it('detects string constraint narrowing in nested object properties', async () => {
2604
2601
  const beforeSchema = {
@@ -2623,7 +2620,7 @@ describe('jsonBreakDetector', () => {
2623
2620
  },
2624
2621
  },
2625
2622
  };
2626
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
2623
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
2627
2624
  breakAt('metadata.slug', 'String minLength increased'),
2628
2625
  ]);
2629
2626
  });
@@ -2646,7 +2643,7 @@ describe('jsonBreakDetector', () => {
2646
2643
  },
2647
2644
  },
2648
2645
  };
2649
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('tags[]', 'String maxLength lowered')]);
2646
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('tags[]', 'String maxLength lowered')]);
2650
2647
  });
2651
2648
  it('detects multiple string constraint breaks on the same field', async () => {
2652
2649
  const beforeSchema = {
@@ -2667,7 +2664,7 @@ describe('jsonBreakDetector', () => {
2667
2664
  },
2668
2665
  },
2669
2666
  };
2670
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
2667
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
2671
2668
  breakAt('slug', 'String minLength increased'),
2672
2669
  breakAt('slug', 'String maxLength lowered'),
2673
2670
  breakAt('slug', 'String format changed'),
@@ -2688,7 +2685,7 @@ describe('jsonBreakDetector', () => {
2688
2685
  slug: { type: 'string', minLength: 1, maxLength: 10, format: 'hostname', pattern: '^[a-z]+$' },
2689
2686
  },
2690
2687
  };
2691
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([]);
2688
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([]);
2692
2689
  });
2693
2690
  });
2694
2691
  describe('schema dereferencing', () => {
@@ -2709,7 +2706,7 @@ describe('jsonBreakDetector', () => {
2709
2706
  subtitle: { type: 'string' },
2710
2707
  },
2711
2708
  };
2712
- (0, jsonBreakDetector_1.default)(beforeSchema, afterSchema);
2709
+ (0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema);
2713
2710
  expect(dereference_1.dereferenceLocal).toHaveBeenCalledTimes(2);
2714
2711
  expect(dereference_1.dereferenceLocal).toHaveBeenNthCalledWith(1, beforeSchema);
2715
2712
  expect(dereference_1.dereferenceLocal).toHaveBeenNthCalledWith(2, afterSchema);
@@ -2721,7 +2718,7 @@ describe('jsonBreakDetector', () => {
2721
2718
  jest.mocked(dereference_1.dereferenceLocal).mockImplementationOnce(() => {
2722
2719
  throw new Error(errorMessage);
2723
2720
  });
2724
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('', errorMessage)]);
2721
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('', errorMessage)]);
2725
2722
  expect(dereference_1.dereferenceLocal).toHaveBeenCalledTimes(2);
2726
2723
  });
2727
2724
  it('reports a break when after schema dereferencing fails', () => {
@@ -2734,7 +2731,7 @@ describe('jsonBreakDetector', () => {
2734
2731
  .mockImplementationOnce(() => {
2735
2732
  throw new Error(errorMessage);
2736
2733
  });
2737
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([breakAt('', errorMessage)]);
2734
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([breakAt('', errorMessage)]);
2738
2735
  expect(dereference_1.dereferenceLocal).toHaveBeenCalledTimes(2);
2739
2736
  });
2740
2737
  it('reports breaks for both schemas when dereferencing fails for each', () => {
@@ -2750,7 +2747,7 @@ describe('jsonBreakDetector', () => {
2750
2747
  .mockImplementationOnce(() => {
2751
2748
  throw new Error(afterErrorMessage);
2752
2749
  });
2753
- expect((0, jsonBreakDetector_1.default)(beforeSchema, afterSchema)).toEqual([
2750
+ expect((0, jsonBreakDetector_1.SchemaBreakDetector)(beforeSchema, afterSchema)).toEqual([
2754
2751
  breakAt('', beforeErrorMessage),
2755
2752
  breakAt('', afterErrorMessage),
2756
2753
  ]);