-
Notifications
You must be signed in to change notification settings - Fork 254
/
cruise-result.schema.json
1573 lines (1573 loc) · 73.9 KB
/
cruise-result.schema.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"title": "dependency-cruiser output format",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://dependency-cruiser.js.org/schema/cruise-result.schema.json",
"type": "object",
"required": ["summary", "modules"],
"additionalProperties": false,
"properties": {
"modules": { "$ref": "#/definitions/ModulesType" },
"folders": { "$ref": "#/definitions/FoldersType" },
"summary": { "$ref": "#/definitions/SummaryType" },
"revisionData": { "$ref": "#/definitions/RevisionDataType" }
},
"definitions": {
"ModulesType": {
"type": "array",
"description": "A list of modules, with for each module the modules it depends upon",
"items": { "$ref": "#/definitions/ModuleType" }
},
"ModuleType": {
"type": "object",
"required": ["source", "dependencies", "valid"],
"additionalProperties": false,
"properties": {
"source": {
"type": "string",
"description": "The (resolved) file name of the module, e.g. 'src/main/index.js'"
},
"valid": {
"type": "boolean",
"description": "'true' if this module violated a rule; 'false' in all other cases. The violated rule will be in the 'rule' object at the same level."
},
"dependencies": { "$ref": "#/definitions/DependenciesType" },
"dependents": {
"type": "array",
"description": "list of modules depending on this module",
"items": {
"type": "string",
"description": "the (resolved) name of the dependent"
}
},
"followable": {
"type": "boolean",
"description": "Whether or not this is a dependency that can be followed any further. This will be 'false' for for core modules, json, modules that could not be resolved to a file and modules that weren't followed because it matches the doNotFollow expression."
},
"matchesDoNotFollow": {
"type": "boolean",
"description": "'true' if the file name of this module matches the doNotFollow filter regular expression"
},
"matchesFocus": {
"type": "boolean",
"description": "'true' if the file name of this module matches the focus filter regular expression"
},
"matchesReaches": {
"type": "boolean",
"description": "'true' if the file name of this module matches the 'reaches' filter regular expression"
},
"matchesHighlight": {
"type": "boolean",
"description": "'true' if the file name of this module matches the 'highlight' regular expression"
},
"coreModule": {
"type": "boolean",
"description": "Whether or not this is a node.js core module"
},
"couldNotResolve": {
"type": "boolean",
"description": "'true' if dependency-cruiser could not resolve the module name in the source code to a file name or core module. 'false' in all other cases."
},
"dependencyTypes": {
"type": "array",
"items": { "$ref": "#/definitions/DependencyTypeType" },
"description": "the type of inclusion - local, core, unknown (= we honestly don't know), undetermined (= we didn't bother determining it) or one of the npm dependencies defined in a package.json ('npm' for 'dependencies', 'npm-dev', 'npm-optional', 'npm-peer', 'npm-no-pkg' for development, optional, peer dependencies and dependencies in node_modules but not in package.json respectively)"
},
"license": {
"type": "string",
"description": "the license, if known (usually known for modules pulled from npm, not for local ones)"
},
"orphan": {
"type": "boolean",
"description": "'true' if this module does not have dependencies, and no module has it as a dependency"
},
"reachable": {
"type": "array",
"items": { "$ref": "#/definitions/ReachableType" },
"description": "An array of objects that tell whether this module is 'reachable', and according to rule in which this reachability was defined"
},
"reaches": {
"type": "array",
"items": { "$ref": "#/definitions/ReachesType" },
"description": "An array of objects that tell which other modules it reaches, and that falls within the definition of the passed rule."
},
"rules": {
"type": "array",
"items": { "$ref": "#/definitions/RuleSummaryType" },
"description": "an array of rules violated by this module - left out if the module is valid"
},
"consolidated": {
"type": "boolean",
"description": "true if the module was 'consolidated'. Consolidating implies the entity a Module represents might be several modules at the same time. This attribute is set by tools that consolidate modules for reporting purposes - it will not be present after a regular cruise."
},
"instability": {
"type": "number",
"description": "number of dependents/ (number of dependents + number of dependencies)A measure for how stable the module is; ranging between 0 (completely stable module) to 1 (completely instable module). Derived from Uncle Bob's instability metric - but applied to a single module instead of to a group of them. This attribute is only present when dependency-cruiser was asked to calculate metrics."
},
"experimentalStats": { "$ref": "#/definitions/ExperimentalStatsType" },
"checksum": {
"type": "string",
"description": "checksum of the contents of the module. This attribute is currently only available when the cruise was executed with caching and the cache strategy is 'content'."
}
}
},
"ReachableType": {
"type": "object",
"required": ["value", "asDefinedInRule", "matchedFrom"],
"additionalProperties": false,
"properties": {
"value": {
"type": "boolean",
"description": "'true' if this module is reachable from any of the modules matched by the from part of a reachability-rule in 'asDefinedInRule', 'false' if not."
},
"asDefinedInRule": {
"type": "string",
"description": "The name of the rule where the reachability was defined"
},
"matchedFrom": {
"type": "string",
"description": "The matchedFrom attribute shows what the 'from' module that causes the 'reachable' information to be what it is. Sometimes the 'asDefinedInRule' is not specific enough - e.g. when the from part can be many modules and/ or contains capturing groups used in the to part of the rule."
}
}
},
"ReachesType": {
"type": "object",
"required": ["modules", "asDefinedInRule"],
"additionalProperties": false,
"properties": {
"modules": {
"type": "array",
"items": {
"type": "object",
"required": ["source", "via"],
"additionalProperties": false,
"properties": {
"source": { "type": "string" },
"via": {
"type": "array",
"description": "The path along which the 'to' module is reachable from this one.",
"items": { "$ref": "#/definitions/MiniDependency" }
}
}
},
"description": "An array of modules that is (transitively) reachable from this module."
},
"asDefinedInRule": {
"type": "string",
"description": "The name of the rule within which the reachability is restricted"
}
}
},
"DependenciesType": {
"type": "array",
"items": { "$ref": "#/definitions/DependencyType" }
},
"DependencyType": {
"type": "object",
"required": [
"circular",
"coreModule",
"couldNotResolve",
"dependencyTypes",
"exoticallyRequired",
"dynamic",
"followable",
"module",
"moduleSystem",
"resolved",
"valid"
],
"additionalProperties": false,
"properties": {
"module": {
"type": "string",
"description": "The name of the module as it appeared in the source code, e.g. './main'"
},
"protocol": {
"type": "string",
"enum": ["data:", "file:", "node:"],
"description": "If the module specification is an URI with a protocol in it (e.g. `import * as fs from 'node:fs'` or `import stuff from 'data:application/json,some-thing'`) - this attribute holds the protocol part (e.g. 'node:', 'data:', 'file:'). Also see https://nodejs.org/api/esm.html#esm_urls"
},
"mimeType": {
"type": "string",
"description": "If the module specification is an URI and contains a mime type, this attribute holds the mime type (e.g. in `import stuff from 'data:application/json,some-thing'` this would be data:application/json). Also see https://nodejs.org/api/esm.html#esm_urls"
},
"resolved": {
"type": "string",
"description": "The (resolved) file name of the module, e.g. 'src/main/index.js'"
},
"coreModule": {
"type": "boolean",
"description": "Whether or not this is a node.js core module - deprecated in favor of dependencyType === core"
},
"dependencyTypes": {
"type": "array",
"items": { "$ref": "#/definitions/DependencyTypeType" },
"description": "the type of inclusion - local, core, unknown (= we honestly don't know), undetermined (= we didn't bother determining it) or one of the npm dependencies defined in a package.json ('npm' for 'dependencies', 'npm-dev', 'npm-optional', 'npm-peer', 'npm-no-pkg' for development, optional, peer dependencies and dependencies in node_modules but not in package.json respectively)"
},
"license": {
"type": "string",
"description": "the license, if known (usually known for modules pulled from npm, not for local ones)"
},
"followable": {
"type": "boolean",
"description": "Whether or not this is a dependency that can be followed any further. This will be 'false' for for core modules, json, modules that could not be resolved to a file and modules that weren't followed because it matches the doNotFollow expression."
},
"dynamic": {
"type": "boolean",
"description": "true if this dependency is dynamic, false in all other cases"
},
"exoticallyRequired": {
"type": "boolean",
"description": "true if the dependency was defined by a require function not named'require' - false in all other cases"
},
"exoticRequire": {
"type": "string",
"description": "If this dependency was defined by a require not named 'require' (as defined in the exoticRequireStrings option): the string that was used"
},
"matchesDoNotFollow": {
"type": "boolean",
"description": "'true' if the file name of this module matches the doNotFollow regular expression"
},
"couldNotResolve": {
"type": "boolean",
"description": "'true' if dependency-cruiser could not resolve the module name in the source code to a file name or core module. 'false' in all other cases."
},
"preCompilationOnly": {
"type": "boolean",
"description": "'true' if the dependency between this dependency and its parent only exists before compilation takes place. 'false in all other cases. Dependency-cruiser will only specify this attribute for TypeScript and then only when the option 'tsPreCompilationDeps' has the value 'specify'."
},
"typeOnly": {
"type": "boolean",
"description": "'true' when the module included the module explicitly as type only with the 'type' keyword e.g. import type { IThingus } from 'thing' Dependency-cruiser will only specify this attribute for TypeScript and when the 'tsPreCompilationDeps' option has either the value true or 'specify'."
},
"circular": {
"type": "boolean",
"description": "'true' if following this dependency will ultimately return to the source, false in all other cases"
},
"cycle": {
"type": "array",
"items": { "$ref": "#/definitions/MiniDependency" },
"description": "If following this dependency will ultimately return to the source (circular === true), this attribute will contain an (ordered) array of module names that shows (one of) the circular path(s)"
},
"moduleSystem": { "$ref": "#/definitions/ModuleSystemType" },
"valid": {
"type": "boolean",
"description": "'true' if this dependency violated a rule; 'false' in all other cases. The violated rule will be in the 'rules' object at the same level."
},
"rules": {
"type": "array",
"items": { "$ref": "#/definitions/RuleSummaryType" },
"description": "an array of rules violated by this dependency - left out if the dependency is valid"
},
"instability": {
"type": "number",
"description": "the (de-normalized) instability of the dependency - also available in the module on the 'to' side of this dependency"
}
}
},
"DependencyTypeType": {
"type": "string",
"enum": [
"aliased-subpath-import",
"aliased-tsconfig-base-url",
"aliased-tsconfig-paths",
"aliased-tsconfig",
"aliased-webpack",
"aliased-workspace",
"aliased",
"amd-define",
"amd-require",
"amd-exotic-require",
"core",
"deprecated",
"dynamic-import",
"exotic-require",
"export",
"import-equals",
"import",
"jsdoc",
"jsdoc-bracket-import",
"jsdoc-import-tag",
"local",
"localmodule",
"npm-bundled",
"npm-dev",
"npm-no-pkg",
"npm-optional",
"npm-peer",
"npm-unknown",
"npm",
"pre-compilation-only",
"require",
"triple-slash-amd-dependency",
"triple-slash-directive",
"triple-slash-file-reference",
"triple-slash-type-reference",
"type-import",
"type-only",
"undetermined",
"unknown"
]
},
"ModuleSystemType": {
"type": "string",
"enum": ["cjs", "es6", "amd", "tsd"]
},
"RuleSummaryType": {
"type": "object",
"description": "If there was a rule violation (valid === false), this object contains the name of the rule and severity of violating it.",
"required": ["name", "severity"],
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"description": "The (short, eslint style) name of the violated rule. Typically something like 'no-core-punycode' or 'no-outside-deps'."
},
"severity": { "$ref": "#/definitions/SeverityType" }
}
},
"SeverityType": {
"type": "string",
"description": "How severe a violation of a rule is. The 'error' severity will make some reporters return a non-zero exit code, so if you want e.g. a build to stop when there's a rule violated: use that.",
"enum": ["error", "warn", "info", "ignore"]
},
"MiniDependency": {
"type": "object",
"description": "A small dependency object with the uniquely identifying name of the module +the dependency types it has relative to the _previous_ module in the chain it is part of (e.g. a cycle).",
"required": ["name", "dependencyTypes"],
"additionalProperties": false,
"properties": {
"name": { "type": "string", "description": "The name of the module" },
"dependencyTypes": {
"type": "array",
"items": { "$ref": "#/definitions/DependencyTypeType" },
"description": "The dependency types of the module relative to the previous module in the chain it is a part of (e.g. a cycle)"
}
}
},
"ExperimentalStatsType": {
"type": "object",
"required": ["size", "topLevelStatementCount"],
"additionalProperties": false,
"properties": {
"topLevelStatementCount": {
"type": "number",
"description": "the number of top level statements in the module. Attribute only available when the cruise was executed with the 'experimentalStats' option set to 'true'."
},
"size": {
"type": "number",
"description": "the size of the module in bytes. Attribute only available when the cruise was executed with the 'experimentalStats' option set to 'true'."
}
}
},
"FoldersType": {
"type": "array",
"description": "A list of folders, as derived from the detected modules, with for each folder a bunch of metrics (adapted from 'Agile software development: principles, patterns, and practices' by Robert C Martin (ISBN 0-13-597444-5). Note: these metrics substitute 'components' and 'classes' from that book with 'folders' and 'modules'; the closest relatives that work for the most programming styles in JavaScript (and its derivative languages).",
"items": { "$ref": "#/definitions/FolderType" }
},
"FolderType": {
"type": "object",
"required": ["name", "moduleCount"],
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"description": "The name of the folder. Folder names are normalized to posix (so separated by forward slashes e.g.: src/things/morethings)"
},
"dependents": {
"type": "array",
"description": "list of folders depending on this folder",
"items": {
"type": "object",
"required": ["name"],
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"description": "the (resolved) name of the dependent"
}
}
}
},
"dependencies": {
"type": "array",
"description": "list of folders this module depends upon",
"items": {
"type": "object",
"required": ["name", "valid", "circular"],
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"description": "the (resolved) name of the dependency"
},
"instability": {
"type": "number",
"description": "the instability of the dependency (de-normalized - this is a duplicate of the one found in the instability of the folder with the same name)"
},
"valid": {
"type": "boolean",
"description": "'true' if this folder dependency violated a rule; 'false' in all other cases. The violated rule will be in the 'rules' object at the same level."
},
"circular": {
"type": "boolean",
"description": "'true' if following this dependency will ultimately return to the source, false in all other cases"
},
"cycle": {
"type": "array",
"items": { "$ref": "#/definitions/MiniDependency" },
"description": "If following this dependency will ultimately return to the source (circular === true), this attribute will contain an (ordered) array of module names that shows (one of) the circular path(s)"
},
"rules": {
"type": "array",
"items": { "$ref": "#/definitions/RuleSummaryType" },
"description": "an array of rules violated by this dependency - left out if the dependency is valid"
}
}
}
},
"moduleCount": {
"type": "number",
"description": "The total number of modules detected in this folder and its sub-folders"
},
"afferentCouplings": {
"type": "number",
"description": "The number of modules outside this folder that depend on modules within this folder. Only present when dependency-cruiser was asked to calculate it."
},
"efferentCouplings": {
"type": "number",
"description": "The number of modules inside this folder that depend on modules outside this folder. Only present when dependency-cruiser was asked to calculate it."
},
"instability": {
"type": "number",
"description": "efferentCouplings/ (afferentCouplings + efferentCouplings) A measure for how stable the folder is; ranging between 0 (completely stable folder) to 1 (completely instable folder) Note that while 'instability' has a negative connotation it's also unavoidable in any meaningful system. It's the basis of Martin's variable component stability principle: 'the instability of a folder should be larger than the folders it depends on'. Only present when dependency-cruiser was asked to calculate it."
},
"experimentalStats": { "$ref": "#/definitions/ExperimentalStatsType" }
}
},
"SummaryType": {
"type": "object",
"required": [
"violations",
"error",
"warn",
"info",
"totalCruised",
"optionsUsed"
],
"additionalProperties": false,
"description": "Data summarizing the found dependencies",
"properties": {
"violations": { "$ref": "#/definitions/ViolationsType" },
"error": {
"type": "number",
"description": "the number of errors in the dependencies"
},
"warn": {
"type": "number",
"description": "the number of warnings in the dependencies"
},
"info": {
"type": "number",
"description": "the number of informational level notices in the dependencies"
},
"ignore": {
"type": "number",
"description": "the number of ignored notices in the dependencies"
},
"totalCruised": {
"type": "number",
"description": "the number of modules cruised"
},
"totalDependenciesCruised": {
"type": "number",
"description": "the number of dependencies cruised"
},
"ruleSetUsed": { "$ref": "#/definitions/RuleSetType" },
"optionsUsed": { "$ref": "#/definitions/OptionsUsedType" }
}
},
"ViolationsType": {
"type": "array",
"description": "A list of violations found in the dependencies. The dependencies themselves also contain this information, this summary is here for convenience.",
"items": { "$ref": "#/definitions/ViolationType" }
},
"ViolationType": {
"type": "object",
"required": ["from", "to", "rule"],
"additionalProperties": false,
"properties": {
"from": { "type": "string" },
"to": { "type": "string" },
"type": { "$ref": "#/definitions/ViolationTypeType" },
"rule": { "$ref": "#/definitions/RuleSummaryType" },
"cycle": {
"type": "array",
"items": { "$ref": "#/definitions/MiniDependency" },
"description": "The circular path if the violation is about circularity"
},
"via": {
"type": "array",
"items": { "$ref": "#/definitions/MiniDependency" },
"description": "The path from the from to the to if the violation is transitive"
},
"metrics": {
"type": "object",
"required": ["from", "to"],
"additionalProperties": false,
"properties": {
"from": {
"type": "object",
"required": ["instability"],
"additionalProperties": false,
"properties": { "instability": { "type": "number" } }
},
"to": {
"type": "object",
"required": ["instability"],
"additionalProperties": false,
"properties": { "instability": { "type": "number" } }
}
}
},
"comment": {
"type": "string",
"description": "Free format text you can e.g. use to explain why this violation can be ignored or is quarantined (only used in _known-violations_) "
}
}
},
"ViolationTypeType": {
"type": "string",
"enum": [
"dependency",
"module",
"reachability",
"cycle",
"instability",
"folder"
]
},
"RuleSetType": {
"type": "object",
"additionalProperties": false,
"properties": {
"forbidden": {
"type": "array",
"description": "A list of rules that describe dependencies that are not allowed. dependency-cruiser will emit a separate error (warning/ informational) messages for each violated rule.",
"items": { "$ref": "#/definitions/ForbiddenRuleType" }
},
"allowed": {
"type": "array",
"description": "A list of rules that describe dependencies that are allowed. dependency-cruiser will emit the warning message 'not-in-allowed' for each dependency that does not at least meet one of them.",
"items": { "$ref": "#/definitions/AllowedRuleType" }
},
"allowedSeverity": {
"$ref": "#/definitions/SeverityType",
"description": "Severity to use when a dependency is not in the 'allowed' set of rules. Defaults to 'warn'"
},
"required": {
"type": "array",
"description": "A list of rules that describe what dependencies modules _must_ have. E.g. - every controller needs to (directly) depend on a base controller. - each source file should be the dependency of a spec file with the same base name",
"items": { "$ref": "#/definitions/RequiredRuleType" }
}
}
},
"AllowedRuleType": {
"oneOf": [
{ "$ref": "#/definitions/RegularAllowedRuleType" },
{ "$ref": "#/definitions/ReachabilityAllowedRuleType" }
]
},
"RegularAllowedRuleType": {
"type": "object",
"required": ["from", "to"],
"additionalProperties": false,
"properties": {
"comment": { "type": "string" },
"scope": {
"type": "string",
"description": "What to apply the rule to - modules (the default) or folders. Currently ignored for 'allowed' rules, defaulting to 'module'",
"enum": ["module", "folder"]
},
"from": { "$ref": "#/definitions/FromRestrictionType" },
"to": { "$ref": "#/definitions/ToRestrictionType" }
}
},
"ReachabilityAllowedRuleType": {
"type": "object",
"required": ["from", "to"],
"additionalProperties": false,
"properties": {
"comment": { "type": "string" },
"scope": {
"type": "string",
"description": "What to apply the rule to - modules (the default) or folders. Currently ignored for 'allowed' rules, defaulting to 'module'",
"enum": ["module", "folder"]
},
"from": { "$ref": "#/definitions/ReachabilityFromRestrictionType" },
"to": { "$ref": "#/definitions/ReachabilityToRestrictionType" }
}
},
"ForbiddenRuleType": {
"oneOf": [
{ "$ref": "#/definitions/RegularForbiddenRuleType" },
{ "$ref": "#/definitions/ReachabilityForbiddenRuleType" },
{ "$ref": "#/definitions/DependentsForbiddenRuleType" }
]
},
"RegularForbiddenRuleType": {
"type": "object",
"required": ["from", "to"],
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"description": "A short name for the rule - will appear in reporters to enable customers to quickly identify a violated rule. Try to keep them short, eslint style. E.g. 'not-to-core' for a rule forbidding dependencies on core modules, or 'not-to-unresolvable' for one that prevents dependencies on modules that probably don't exist."
},
"severity": { "$ref": "#/definitions/SeverityType" },
"scope": {
"type": "string",
"description": "What to apply the rule to - modules (the default) or folders. Switching the scope to 'folder' can be useful in rules where this makes a difference like those regarding circular dependencies or instability. Only the to.moreUnstable, to.circular, and path (both from and to) attributes work at the moment. Other attributes will follow suit in later releases (depending on demand).",
"enum": ["module", "folder"]
},
"comment": {
"type": "string",
"description": "You can use this field to document why the rule is there."
},
"from": { "$ref": "#/definitions/FromRestrictionType" },
"to": { "$ref": "#/definitions/ToRestrictionType" }
}
},
"DependentsForbiddenRuleType": {
"type": "object",
"required": ["module", "from"],
"additionalProperties": false,
"properties": {
"name": { "type": "string" },
"severity": { "$ref": "#/definitions/SeverityType" },
"scope": {
"type": "string",
"description": "What to apply the rule to - modules (the default) or folders. Currently ignored for DependentsForbiddenRules, defaulting to 'module'",
"enum": ["module", "folder"]
},
"comment": { "type": "string" },
"module": { "$ref": "#/definitions/DependentsModuleRestrictionType" },
"from": { "$ref": "#/definitions/DependentsFromRestrictionType" }
}
},
"ReachabilityForbiddenRuleType": {
"type": "object",
"required": ["from", "to"],
"additionalProperties": false,
"properties": {
"name": { "type": "string" },
"severity": { "$ref": "#/definitions/SeverityType" },
"scope": {
"type": "string",
"description": "What to apply the rule to - modules (the default) or folders. Currently ignored for ReachabilityForbiddenRules, defaulting to 'module'",
"enum": ["module", "folder"]
},
"comment": { "type": "string" },
"from": { "$ref": "#/definitions/ReachabilityFromRestrictionType" },
"to": { "$ref": "#/definitions/ReachabilityToRestrictionType" }
}
},
"RequiredRuleType": {
"type": "object",
"required": ["module", "to"],
"additionalProperties": false,
"properties": {
"name": { "type": "string" },
"severity": { "$ref": "#/definitions/SeverityType" },
"scope": {
"type": "string",
"description": "What to apply the rule to - modules (the default) or folders. Currently ignored for RequiredRules, defaulting to 'module'",
"enum": ["module", "folder"]
},
"comment": { "type": "string" },
"module": { "$ref": "#/definitions/RequiredModuleRestrictionType" },
"to": { "$ref": "#/definitions/RequiredToRestrictionType" }
}
},
"MiniDependencyRestrictionType": {
"oneOf": [
{ "$ref": "#/definitions/REAsStringsType" },
{
"type": "object",
"additionalProperties": false,
"properties": {
"path": {
"description": "A regular expression or an array of regular expressions the 'via' module should match to be caught by this rule.",
"$ref": "#/definitions/REAsStringsType"
},
"pathNot": {
"description": "A regular expression or an array of regular expressions an the 'via' module should _not_ match to be caught by this rule.",
"$ref": "#/definitions/REAsStringsType"
},
"dependencyTypes": {
"type": "array",
"description": "Which dependency types the dependency between this via and the previous one in the 'via chain' should have to be caught by this rule.",
"items": { "$ref": "#/definitions/DependencyTypeType" }
},
"dependencyTypesNot": {
"type": "array",
"description": "Which dependency types the dependency between this via and the previous one in the 'via chain' should _not_ have to be caught by this rule.",
"items": { "$ref": "#/definitions/DependencyTypeType" }
}
}
}
]
},
"FromRestrictionType": {
"type": "object",
"description": "Criteria an end of a dependency should match to be caught by this rule. Leave it empty if you want any module to be matched.",
"additionalProperties": false,
"properties": {
"path": {
"description": "A regular expression or an array of regular expressions an end of a dependency should match to be caught by this rule.",
"$ref": "#/definitions/REAsStringsType"
},
"pathNot": {
"description": "A regular expression or an array of regular expressions an end of a dependency should NOT match to be caught by this rule.",
"$ref": "#/definitions/REAsStringsType"
},
"orphan": {
"type": "boolean",
"description": "Whether or not to match when the module is an orphan (= has no incoming or outgoing dependencies). When this property it is part of a rule, dependency-cruiser will ignore the 'to' part."
}
}
},
"ReachabilityFromRestrictionType": {
"type": "object",
"description": "Criteria an end of a dependency should match to be caught by this rule. Leave it empty if you want any module to be matched.",
"additionalProperties": false,
"properties": {
"path": {
"description": "A regular expression or an array of regular expressions an end of a dependency should match to be caught by this rule.",
"$ref": "#/definitions/REAsStringsType"
},
"pathNot": {
"description": "A regular expression or an array of regular expressions an end of a dependency should NOT match to be caught by this rule.",
"$ref": "#/definitions/REAsStringsType"
}
}
},
"ToRestrictionType": {
"type": "object",
"description": "Criteria the 'to' end of a dependency should match to be caught by this rule. Leave it empty if you want any module to be matched.",
"additionalProperties": false,
"properties": {
"path": {
"description": "A regular expression or an array of regular expressions an end of a dependency should match to be caught by this rule.",
"$ref": "#/definitions/REAsStringsType"
},
"pathNot": {
"description": "A regular expression or an array of regular expressions an end of a dependency should NOT match to be caught by this rule.",
"$ref": "#/definitions/REAsStringsType"
},
"couldNotResolve": {
"type": "boolean",
"description": "Whether or not to match modules dependency-cruiser could not resolve (and probably aren't on disk). For this one too: leave out if you don't care either way."
},
"circular": {
"type": "boolean",
"description": "Whether or not to match when following to the to will ultimately end up in the from."
},
"dynamic": {
"type": "boolean",
"description": "Whether or not to match when the dependency is a dynamic one."
},
"exoticallyRequired": {
"type": "boolean",
"description": "Whether or not to match when the dependency is exotically required."
},
"exoticRequire": {
"description": "A regular expression to match against any 'exotic' require strings",
"$ref": "#/definitions/REAsStringsType"
},
"exoticRequireNot": {
"description": "A regular expression to match against any 'exotic' require strings - when it should NOT be caught by the rule",
"$ref": "#/definitions/REAsStringsType"
},
"preCompilationOnly": {
"type": "boolean",
"description": "true if this dependency only exists before compilation (like type only imports), false in all other cases. Only returned when the tsPreCompilationDeps is set to 'specify'."
},
"dependencyTypes": {
"type": "array",
"description": "Whether or not to match modules of any of these types (leaving out matches any of them)",
"items": { "$ref": "#/definitions/DependencyTypeType" }
},
"dependencyTypesNot": {
"type": "array",
"description": "Whether or not to match modules NOT of any of these types (leaving out matches none of them)",
"items": { "$ref": "#/definitions/DependencyTypeType" }
},
"moreThanOneDependencyType": {
"type": "boolean",
"description": "If true matches dependencies with more than one dependency type (e.g. defined in _both_ npm and npm-dev)"
},
"license": {
"description": "Whether or not to match modules that were released under one of the mentioned licenses. E.g. to flag GPL-1.0, GPL-2.0 licensed modules (e.g. because your app is not compatible with the GPL) use \"GPL\"",
"$ref": "#/definitions/REAsStringsType"
},
"licenseNot": {
"description": "Whether or not to match modules that were NOT released under one of the mentioned licenses. E.g. to flag everything non MIT use \"MIT\" here",
"$ref": "#/definitions/REAsStringsType"
},
"via": {
"description": "For circular dependencies - whether or not to match cycles that include some modules with these conditions. If you want to match cycles that _exclusively_ include modules satisfying them use the viaOnly restriction.E.g. to allow all cycles, except when they go through one specific module. Typically to temporarily disallow some cycles with a lower severity - setting up a rule with a via that ignores them in an 'allowed' section.",
"$ref": "#/definitions/MiniDependencyRestrictionType"
},
"viaOnly": {
"description": "For circular dependencies - whether or not to match cycles that include exclusively modules with these conditions. This is different from the regular via that already matches when only _some_ of the modules in the cycle satisfy the condition.",
"$ref": "#/definitions/MiniDependencyRestrictionType"
},
"viaNot": {
"description": "This attribute is deprecated. Use 'viaOnly' with a 'pathNot' attribute in stead.",
"deprecated": true,
"$ref": "#/definitions/REAsStringsType"
},
"viaSomeNot": {
"description": "This attribute is deprecated. Use 'via' with a 'pathNot' attribute in stead.",
"deprecated": true,
"$ref": "#/definitions/REAsStringsType"
},
"moreUnstable": {
"type": "boolean",
"description": "When set to true moreUnstable matches for any dependency that has a higher Instability than the module that depends on it. When set to false it matches when the opposite is true; the dependency has an equal or lower Instability. This attribute is useful when you want to check against Robert C. Martin's stable dependency principle. See online documentation for examples and details. Leave this out when you don't care either way."
}
}
},
"DependentsModuleRestrictionType": {
"description": "Criteria to select the module(s) this restriction should apply to",
"required": [],
"type": "object",
"additionalProperties": false,
"properties": {
"path": {
"description": "A regular expression or an array of regular expressions an end of a dependency should match to be caught by this rule.",
"$ref": "#/definitions/REAsStringsType"
},
"pathNot": {
"description": "A regular expression or an array of regular expressions an end of a dependency should NOT match to be caught by this rule.",
"$ref": "#/definitions/REAsStringsType"
},
"numberOfDependentsLessThan": {
"type": "integer",
"description": "Matches when the number of times the 'to' module is used falls below (<) this number. Caveat: only works in concert with path and pathNot restrictions in the from and to parts of the rule; other conditions will be ignored. E.g. to flag modules that are used only once or not at all, use 2 here.",
"minimum": 0,
"maximum": 100
},
"numberOfDependentsMoreThan": {
"type": "integer",
"description": "Matches when the number of times the 'to' module is used raises above (>) this number. Caveat: only works in concert with path and pathNot restrictions in the from and to parts of the rule; other conditions will be ignored. E.g. to flag modules that are used more than 10 times, use 10 here.",
"minimum": 0,
"maximum": 100
}
}
},
"DependentsFromRestrictionType": {
"description": "Criteria the dependents of the module should adhere to be caught by this rule rule. Leave it empty if you want any dependent to be matched.",
"required": [],
"type": "object",
"additionalProperties": false,
"properties": {
"path": {
"description": "A regular expression or an array of regular expressions an end of a dependency should match to be caught by this rule.",
"$ref": "#/definitions/REAsStringsType"
},
"pathNot": {
"description": "A regular expression or an array of regular expressions an end of a dependency should NOT match to be caught by this rule.",
"$ref": "#/definitions/REAsStringsType"
}
}
},
"ReachabilityToRestrictionType": {
"description": "Criteria the 'to' end of a dependency should match to be caught by this rule. Leave it empty if you want any module to be matched.",
"required": ["reachable"],
"type": "object",
"additionalProperties": false,
"properties": {
"path": {
"description": "A regular expression or an array of regular expressions an end of a dependency should match to be caught by this rule.",
"$ref": "#/definitions/REAsStringsType"
},
"pathNot": {
"description": "A regular expression or an array of regular expressions an end of a dependency should NOT match to be caught by this rule.",
"$ref": "#/definitions/REAsStringsType"
},
"reachable": {
"type": "boolean",
"description": "Whether or not to match modules that aren't reachable from the from part of the rule."
}
}
},
"RequiredModuleRestrictionType": {
"description": "Criteria to select the module(s) this restriction should apply to",
"required": [],
"type": "object",
"additionalProperties": false,
"properties": {
"path": {
"description": "A regular expression or an array of regular expressions an end of a dependency should match to be caught by this rule.",
"$ref": "#/definitions/REAsStringsType"
},
"pathNot": {
"description": "A regular expression or an array of regular expressions an end of a dependency should NOT match to be caught by this rule.",
"$ref": "#/definitions/REAsStringsType"
}
}
},
"RequiredToRestrictionType": {
"description": "Criteria for modules the associated module must depend on.",
"required": [],
"type": "object",
"additionalProperties": false,
"properties": {
"path": {
"description": "Criteria at least one dependency of each matching module must adhere to.",
"$ref": "#/definitions/REAsStringsType"
},
"reachable": {
"type": "boolean",
"description": "Whether or not to match transitive ('indirect') dependencies as well as direct ones."
}
}
},
"REAsStringsType": {
"oneOf": [
{ "type": "string" },
{ "type": "array", "items": { "type": "string" } }
]
},
"OptionsUsedType": {
"type": "object",
"description": "the (command line) options used to generate the dependency-tree",
"additionalProperties": false,
"properties": {
"doNotFollow": { "$ref": "#/definitions/CompoundDoNotFollowType" },
"exclude": { "$ref": "#/definitions/CompoundExcludeType" },
"includeOnly": {
"description": "a regular expression for modules to cruise; anything outside it will be skipped",
"oneOf": [
{ "$ref": "#/definitions/REAsStringsType" },
{ "$ref": "#/definitions/CompoundIncludeOnlyType" }
]
},
"focus": { "$ref": "#/definitions/CompoundFocusType" },
"reaches": { "$ref": "#/definitions/CompoundReachesType" },
"affected": {
"description": "dependency-cruiser will mark modules that have changed since the specified revision (or 'main', when not specified) in its output, as well as _any_ module that reaches them - either directly or via via. NOTE: this is currently a command line _only_ option, so if you pass this to the API or in a configuration file it will be ignored.",
"oneOf": [{ "type": "string" }, { "type": "boolean" }]
},
"highlight": { "$ref": "#/definitions/CompoundHighlightType" },
"knownViolations": {
"description": "baseline of known validations. Typically you'd specify these in a file called .dependency-cruiser-known-violations.json (which you'd generate with the --outputType 'baseline') - and which is easy to keep up to date. In a pinch you can specify them here as well. The known violations in .dependency-cruiser-known-violations.json always take precedence.",
"$ref": "#/definitions/ViolationsType"
},
"collapse": { "type": "string" },
"maxDepth": {
"type": "integer",
"minimum": 0,
"maximum": 99,
"description": "The maximum cruise depth specified. 0 means no maximum specified. While it might look attractive to regulate the size of the output, this is not the best option to do so. Filters (exclude, includeOnly, focus), the dot and archi reporter's collapsePattern and the collapse options offer better, more reliable and more understandable results."
},
"moduleSystems": { "$ref": "#/definitions/ModuleSystemsType" },
"detectJSDocImports": {
"type": "boolean",
"description": "When true, dependency-cruiser will detect dependencies in JSDoc-style import statements. Implies `\"parser\": \"tsc\"`. Defaults to false."
},
"prefix": { "type": "string" },
"preserveSymlinks": {
"type": "boolean",
"description": "if true leave symlinks untouched, otherwise use the realpath. Defaults to `false` (which is also nodejs's default behavior since version 6)"
},
"combinedDependencies": {
"type": "boolean",
"description": "if true combines the package.jsons found from the module up to the base folder the cruise is initiated from. Useful for how (some) mono-repos manage dependencies & dependency definitions. Defaults to `false`."
},
"tsConfig": {
"type": "object",
"additionalProperties": false,
"description": "TypeScript project file ('tsconfig.json') to use for (1) compilation and (2) resolution (e.g. with the paths property)",
"properties": {
"fileName": {
"description": "The TypeScript project file to use. The fileName is relative to dependency-cruiser's current working directory. When not provided defaults to './tsconfig.json'.",
"type": "string"
}
}
},