@redocly/openapi-core 1.3.0 → 1.4.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.
Files changed (202) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/lib/benchmark/benches/lint-with-many-rules.bench.js +4 -4
  3. package/lib/benchmark/benches/lint-with-nested-rule.bench.js +4 -4
  4. package/lib/benchmark/benches/lint-with-no-rules.bench.js +4 -4
  5. package/lib/benchmark/benches/lint-with-top-level-rule-report.bench.js +4 -4
  6. package/lib/benchmark/benches/lint-with-top-level-rule.bench.js +4 -4
  7. package/lib/benchmark/benches/recommended-oas3.bench.js +4 -4
  8. package/lib/benchmark/benches/resolve-with-no-external.bench.js +3 -3
  9. package/lib/benchmark/utils.js +3 -3
  10. package/lib/bundle.d.ts +4 -4
  11. package/lib/bundle.js +25 -25
  12. package/lib/config/all.d.ts +2 -2
  13. package/lib/config/all.js +44 -8
  14. package/lib/config/builtIn.js +2 -0
  15. package/lib/config/config-resolvers.js +25 -25
  16. package/lib/config/config.js +9 -9
  17. package/lib/config/index.js +5 -1
  18. package/lib/config/load.d.ts +1 -1
  19. package/lib/config/load.js +6 -6
  20. package/lib/config/minimal.d.ts +2 -2
  21. package/lib/config/minimal.js +34 -3
  22. package/lib/config/recommended-strict.d.ts +3 -0
  23. package/lib/config/recommended-strict.js +92 -0
  24. package/lib/config/recommended.d.ts +2 -2
  25. package/lib/config/recommended.js +34 -3
  26. package/lib/config/rules.d.ts +1 -1
  27. package/lib/config/types.d.ts +47 -46
  28. package/lib/config/types.js +2 -2
  29. package/lib/config/utils.js +26 -14
  30. package/lib/decorators/common/filters/filter-helper.js +4 -4
  31. package/lib/decorators/common/filters/filter-in.js +2 -2
  32. package/lib/decorators/common/filters/filter-out.js +2 -2
  33. package/lib/decorators/common/info-description-override.js +1 -1
  34. package/lib/decorators/common/media-type-examples-override.js +3 -3
  35. package/lib/decorators/common/operation-description-override.js +1 -1
  36. package/lib/decorators/common/registry-dependencies.js +1 -1
  37. package/lib/decorators/common/remove-x-internal.js +4 -4
  38. package/lib/decorators/common/tag-description-override.js +1 -1
  39. package/lib/decorators/oas2/remove-unused-components.d.ts +2 -0
  40. package/lib/{rules → decorators}/oas2/remove-unused-components.js +1 -1
  41. package/lib/decorators/oas3/remove-unused-components.d.ts +2 -0
  42. package/lib/{rules → decorators}/oas3/remove-unused-components.js +2 -2
  43. package/lib/env.js +1 -1
  44. package/lib/format/codeframes.d.ts +6 -6
  45. package/lib/format/format.d.ts +2 -2
  46. package/lib/format/format.js +12 -12
  47. package/lib/js-yaml/index.d.ts +2 -2
  48. package/lib/js-yaml/index.js +2 -2
  49. package/lib/lint.js +18 -18
  50. package/lib/oas-types.d.ts +12 -10
  51. package/lib/oas-types.js +2 -2
  52. package/lib/redocly/index.js +10 -10
  53. package/lib/redocly/registry-api.js +2 -2
  54. package/lib/resolve.d.ts +4 -4
  55. package/lib/resolve.js +18 -18
  56. package/lib/rules/ajv.js +1 -1
  57. package/lib/rules/async2/index.d.ts +2 -11
  58. package/lib/rules/common/assertions/asserts.d.ts +3 -3
  59. package/lib/rules/common/assertions/asserts.js +21 -21
  60. package/lib/rules/common/assertions/index.d.ts +4 -4
  61. package/lib/rules/common/assertions/index.js +3 -3
  62. package/lib/rules/common/assertions/utils.d.ts +4 -4
  63. package/lib/rules/common/assertions/utils.js +3 -3
  64. package/lib/rules/common/info-contact.js +1 -1
  65. package/lib/rules/common/info-license-url.js +1 -1
  66. package/lib/rules/common/info-license.js +1 -1
  67. package/lib/rules/common/no-enum-type-mismatch.js +3 -3
  68. package/lib/rules/common/no-http-verbs-in-paths.js +2 -2
  69. package/lib/rules/common/no-invalid-parameter-examples.js +3 -3
  70. package/lib/rules/common/no-invalid-schema-examples.js +3 -3
  71. package/lib/rules/common/operation-2xx-response.js +2 -2
  72. package/lib/rules/common/operation-4xx-response.js +2 -2
  73. package/lib/rules/common/operation-description.js +1 -1
  74. package/lib/rules/common/operation-operationId.js +1 -1
  75. package/lib/rules/common/operation-summary.js +1 -1
  76. package/lib/rules/common/path-segment-plural.js +1 -1
  77. package/lib/rules/common/response-contains-header.js +2 -2
  78. package/lib/rules/common/spec-strict-refs.js +1 -1
  79. package/lib/rules/common/spec.js +11 -11
  80. package/lib/rules/common/tag-description.js +1 -1
  81. package/lib/rules/oas2/boolean-parameter-prefixes.d.ts +1 -1
  82. package/lib/rules/oas2/index.d.ts +2 -46
  83. package/lib/rules/oas2/request-mime-type.js +2 -2
  84. package/lib/rules/oas2/response-contains-property.js +2 -2
  85. package/lib/rules/oas2/response-mime-type.js +2 -2
  86. package/lib/rules/oas3/boolean-parameter-prefixes.d.ts +1 -1
  87. package/lib/rules/oas3/index.d.ts +1 -1
  88. package/lib/rules/oas3/index.js +1 -1
  89. package/lib/rules/oas3/no-invalid-media-type-examples.js +3 -3
  90. package/lib/rules/oas3/operation-4xx-problem-details-rfc7807.js +3 -3
  91. package/lib/rules/oas3/request-mime-type.js +3 -3
  92. package/lib/rules/oas3/response-contains-property.js +2 -2
  93. package/lib/rules/oas3/response-mime-type.js +3 -3
  94. package/lib/rules/utils.js +3 -3
  95. package/lib/types/asyncapi.js +21 -21
  96. package/lib/types/index.d.ts +8 -8
  97. package/lib/types/oas2.js +14 -14
  98. package/lib/types/oas3.js +27 -27
  99. package/lib/types/oas3_1.js +18 -6
  100. package/lib/types/redocly-yaml.d.ts +11 -0
  101. package/lib/types/redocly-yaml.js +71 -53
  102. package/lib/types/theme-config.js +1 -1
  103. package/lib/typings/common.d.ts +2 -2
  104. package/lib/typings/openapi.d.ts +6 -6
  105. package/lib/typings/swagger.d.ts +3 -3
  106. package/lib/utils.d.ts +5 -5
  107. package/lib/utils.js +3 -3
  108. package/lib/visitors.d.ts +38 -40
  109. package/lib/walk.d.ts +14 -15
  110. package/lib/walk.js +11 -11
  111. package/package.json +2 -2
  112. package/src/__tests__/lint.test.ts +40 -40
  113. package/src/__tests__/normalizeVisitors.test.ts +23 -5
  114. package/src/__tests__/ref-utils.test.ts +7 -7
  115. package/src/__tests__/resolve-http.test.ts +10 -10
  116. package/src/__tests__/resolve.test.ts +39 -39
  117. package/src/__tests__/walk.test.ts +48 -48
  118. package/src/bundle.ts +4 -4
  119. package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +95 -32
  120. package/src/config/__tests__/__snapshots__/config.test.ts.snap +81 -81
  121. package/src/config/__tests__/config-resolvers.test.ts +30 -1
  122. package/src/config/__tests__/config.test.ts +88 -88
  123. package/src/config/__tests__/load.test.ts +12 -8
  124. package/src/config/__tests__/utils.test.ts +18 -18
  125. package/src/config/all.ts +46 -9
  126. package/src/config/builtIn.ts +2 -0
  127. package/src/config/minimal.ts +36 -4
  128. package/src/config/recommended-strict.ts +93 -0
  129. package/src/config/recommended.ts +36 -4
  130. package/src/config/types.ts +22 -8
  131. package/src/config/utils.ts +15 -0
  132. package/src/decorators/common/media-type-examples-override.ts +2 -2
  133. package/src/{rules → decorators}/oas2/remove-unused-components.ts +3 -3
  134. package/src/{rules → decorators}/oas3/remove-unused-components.ts +3 -3
  135. package/src/env.ts +1 -1
  136. package/src/lint.ts +3 -3
  137. package/src/oas-types.ts +26 -3
  138. package/src/rules/__tests__/no-unresolved-refs.test.ts +26 -26
  139. package/src/rules/async2/__tests__/channels-kebab-case.test.ts +12 -12
  140. package/src/rules/async2/__tests__/no-channel-trailing-slash.test.ts +7 -7
  141. package/src/rules/async2/index.ts +2 -1
  142. package/src/rules/common/__tests__/info-license.test.ts +6 -6
  143. package/src/rules/common/__tests__/license-url.test.ts +6 -6
  144. package/src/rules/common/__tests__/no-ambiguous-paths.test.ts +13 -13
  145. package/src/rules/common/__tests__/no-enum-type-mismatch.test.ts +18 -18
  146. package/src/rules/common/__tests__/no-identical-paths.test.ts +5 -5
  147. package/src/rules/common/__tests__/no-path-trailing-slash.test.ts +12 -12
  148. package/src/rules/common/__tests__/operation-2xx-response.test.ts +18 -18
  149. package/src/rules/common/__tests__/operation-4xx-response.test.ts +23 -23
  150. package/src/rules/common/__tests__/operation-operationId-unique.test.ts +6 -6
  151. package/src/rules/common/__tests__/operation-operationId-url-safe.test.ts +5 -5
  152. package/src/rules/common/__tests__/operation-parameters-unique.test.ts +16 -16
  153. package/src/rules/common/__tests__/operation-singular-tag.test.ts +6 -6
  154. package/src/rules/common/__tests__/path-http-verbs-order.test.ts +10 -10
  155. package/src/rules/common/__tests__/path-not-include-query.test.ts +6 -6
  156. package/src/rules/common/__tests__/path-params-defined.test.ts +21 -21
  157. package/src/rules/common/__tests__/paths-kebab-case.test.ts +11 -11
  158. package/src/rules/common/__tests__/scalar-property-missing-example.test.ts +18 -18
  159. package/src/rules/common/__tests__/security-defined.test.ts +21 -21
  160. package/src/rules/common/__tests__/spec-strict-refs.test.ts +9 -9
  161. package/src/rules/common/__tests__/spec.test.ts +102 -102
  162. package/src/rules/common/__tests__/tag-description.test.ts +6 -6
  163. package/src/rules/common/__tests__/tags-alphabetical.test.ts +12 -12
  164. package/src/rules/common/assertions/__tests__/index.test.ts +15 -15
  165. package/src/rules/common/assertions/__tests__/utils.test.ts +9 -9
  166. package/src/rules/oas2/__tests__/boolean-parameter-prefixes.test.ts +7 -7
  167. package/src/rules/oas2/__tests__/response-contains-header.test.ts +13 -13
  168. package/src/rules/oas2/__tests__/response-contains-property.test.ts +8 -8
  169. package/src/rules/oas2/__tests__/spec/info.test.ts +21 -21
  170. package/src/rules/oas2/__tests__/spec/operation.test.ts +4 -4
  171. package/src/rules/oas2/__tests__/spec/paths.test.ts +12 -12
  172. package/src/rules/oas2/__tests__/spec/referenceableScalars.test.ts +1 -1
  173. package/src/rules/oas2/index.ts +3 -1
  174. package/src/rules/oas3/__tests__/boolean-parameter-prefixes.test.ts +7 -7
  175. package/src/rules/oas3/__tests__/component-name-unique.test.ts +186 -186
  176. package/src/rules/oas3/__tests__/no-empty-enum-servers.com.test.ts +18 -18
  177. package/src/rules/oas3/__tests__/no-example-value-and-externalValue.test.ts +6 -6
  178. package/src/rules/oas3/__tests__/no-invalid-media-type-examples.test.ts +36 -36
  179. package/src/rules/oas3/__tests__/no-server-example.com.test.ts +11 -11
  180. package/src/rules/oas3/__tests__/no-server-trailing-slash.test.ts +7 -7
  181. package/src/rules/oas3/__tests__/no-unused-components.test.ts +31 -31
  182. package/src/rules/oas3/__tests__/operation-4xx-problem-details-rfc7807.test.ts +15 -15
  183. package/src/rules/oas3/__tests__/response-contains-header.test.ts +26 -26
  184. package/src/rules/oas3/__tests__/response-contains-property.test.ts +27 -27
  185. package/src/rules/oas3/__tests__/spec/callbacks.test.ts +1 -1
  186. package/src/rules/oas3/__tests__/spec/info.test.ts +21 -21
  187. package/src/rules/oas3/__tests__/spec/operation.test.ts +10 -10
  188. package/src/rules/oas3/__tests__/spec/paths.test.ts +13 -13
  189. package/src/rules/oas3/__tests__/spec/referenceableScalars.test.ts +2 -2
  190. package/src/rules/oas3/__tests__/spec/servers.test.ts +25 -25
  191. package/src/rules/oas3/__tests__/spec/spec.test.ts +56 -56
  192. package/src/rules/oas3/__tests__/spec-components-invalid-map-name.test.ts +28 -28
  193. package/src/rules/oas3/index.ts +3 -3
  194. package/src/types/oas3_1.ts +12 -0
  195. package/src/types/redocly-yaml.ts +75 -40
  196. package/src/visitors.ts +10 -21
  197. package/src/walk.ts +23 -10
  198. package/tsconfig.tsbuildinfo +1 -1
  199. package/lib/rules/oas2/remove-unused-components.d.ts +0 -2
  200. package/lib/rules/oas3/remove-unused-components.d.ts +0 -2
  201. /package/src/{rules → decorators}/oas2/__tests__/remove-unused-components.test.ts +0 -0
  202. /package/src/{rules → decorators}/oas3/__tests__/remove-unused-components.test.ts +0 -0
@@ -6,63 +6,78 @@ const theme_config_1 = require("./theme-config");
6
6
  const _1 = require(".");
7
7
  const oas3_1_1 = require("./oas3_1");
8
8
  const utils_1 = require("../utils");
9
- const builtInRulesList = [
9
+ const builtInCommonRules = [
10
10
  'spec',
11
11
  'info-contact',
12
- 'info-license',
12
+ 'operation-operationId',
13
+ 'tag-description',
14
+ 'tags-alphabetical',
15
+ ];
16
+ const builtInCommonOASRules = [
13
17
  'info-license-url',
18
+ 'info-license',
19
+ 'no-ambiguous-paths',
20
+ 'no-enum-type-mismatch',
21
+ 'no-http-verbs-in-paths',
22
+ 'no-identical-paths',
23
+ 'no-invalid-parameter-examples',
24
+ 'no-invalid-schema-examples',
25
+ 'no-path-trailing-slash',
14
26
  'operation-2xx-response',
15
27
  'operation-4xx-response',
16
- 'operation-4xx-problem-details-rfc7807',
17
- 'assertions',
28
+ 'operation-description',
18
29
  'operation-operationId-unique',
30
+ 'operation-operationId-url-safe',
19
31
  'operation-parameters-unique',
20
- 'path-parameters-defined',
32
+ 'operation-singular-tag',
33
+ 'operation-summary',
21
34
  'operation-tag-defined',
22
- 'no-example-value-and-externalValue',
23
- 'no-enum-type-mismatch',
24
- 'no-path-trailing-slash',
25
- 'no-empty-servers',
35
+ 'parameter-description',
26
36
  'path-declaration-must-exist',
27
- 'operation-operationId-url-safe',
28
- 'operation-operationId',
29
- 'operation-summary',
30
- 'tags-alphabetical',
31
- 'no-server-example.com',
32
- 'no-server-trailing-slash',
33
- 'tag-description',
34
- 'operation-description',
35
- 'no-unused-components',
37
+ 'path-excludes-patterns',
38
+ 'path-http-verbs-order',
36
39
  'path-not-include-query',
37
40
  'path-params-defined',
38
- 'parameter-description',
39
- 'operation-singular-tag',
41
+ 'path-parameters-defined',
42
+ 'path-segment-plural',
43
+ 'paths-kebab-case',
44
+ 'required-string-property-missing-min-length',
45
+ 'response-contains-header',
46
+ 'scalar-property-missing-example',
40
47
  'security-defined',
48
+ 'spec-strict-refs',
41
49
  'no-unresolved-refs',
42
- 'paths-kebab-case',
50
+ ];
51
+ const builtInOAS2Rules = [
43
52
  'boolean-parameter-prefixes',
44
- 'path-http-verbs-order',
53
+ 'request-mime-type',
54
+ 'response-contains-property',
55
+ 'response-mime-type',
56
+ ];
57
+ const builtInOAS3Rules = [
58
+ 'boolean-parameter-prefixes',
59
+ 'component-name-unique',
60
+ 'no-empty-servers',
61
+ 'no-example-value-and-externalValue',
45
62
  'no-invalid-media-type-examples',
46
- 'no-identical-paths',
47
- 'no-ambiguous-paths',
48
- 'no-undefined-server-variable',
63
+ 'no-server-example.com',
64
+ 'no-server-trailing-slash',
49
65
  'no-server-variables-empty-enum',
50
- 'no-http-verbs-in-paths',
51
- 'path-excludes-patterns',
66
+ 'no-undefined-server-variable',
67
+ 'no-unused-components',
68
+ 'operation-4xx-problem-details-rfc7807',
52
69
  'request-mime-type',
53
- 'response-mime-type',
54
- 'path-segment-plural',
55
- 'no-invalid-schema-examples',
56
- 'no-invalid-parameter-examples',
57
- 'response-contains-header',
58
70
  'response-contains-property',
59
- 'scalar-property-missing-example',
71
+ 'response-mime-type',
60
72
  'spec-components-invalid-map-name',
61
- 'required-string-property-missing-min-length',
62
- 'spec-strict-refs',
63
- 'component-name-unique',
64
- 'channels-kebab-case',
65
- 'no-channel-trailing-slash',
73
+ ];
74
+ const builtInAsync2Rules = ['channels-kebab-case', 'no-channel-trailing-slash'];
75
+ const builtInRules = [
76
+ ...builtInCommonRules,
77
+ ...builtInCommonOASRules,
78
+ ...builtInOAS2Rules,
79
+ ...builtInOAS3Rules,
80
+ ...builtInAsync2Rules,
66
81
  ];
67
82
  const nodeTypesList = [
68
83
  'any',
@@ -138,14 +153,17 @@ const ConfigStyleguide = {
138
153
  oas2Rules: 'Rules',
139
154
  oas3_0Rules: 'Rules',
140
155
  oas3_1Rules: 'Rules',
156
+ async2Rules: 'Rules',
141
157
  preprocessors: { type: 'object' },
142
158
  oas2Preprocessors: { type: 'object' },
143
159
  oas3_0Preprocessors: { type: 'object' },
144
160
  oas3_1Preprocessors: { type: 'object' },
161
+ async2Preprocessors: { type: 'object' },
145
162
  decorators: { type: 'object' },
146
163
  oas2Decorators: { type: 'object' },
147
164
  oas3_0Decorators: { type: 'object' },
148
165
  oas3_1Decorators: { type: 'object' },
166
+ async2Decorators: { type: 'object' },
149
167
  },
150
168
  };
151
169
  const RootConfigStyleguide = {
@@ -208,7 +226,7 @@ const Rules = {
208
226
  // keep the old assert/ prefix as an alias
209
227
  return 'Assert';
210
228
  }
211
- else if (builtInRulesList.includes(key) || utils_1.isCustomRuleId(key)) {
229
+ else if (builtInRules.includes(key) || (0, utils_1.isCustomRuleId)(key)) {
212
230
  if (typeof value === 'string') {
213
231
  return { enum: ['error', 'warn', 'off'] };
214
232
  }
@@ -309,7 +327,7 @@ const Assert = {
309
327
  properties: {
310
328
  subject: 'AssertionDefinitionSubject',
311
329
  assertions: 'AssertionDefinitionAssertions',
312
- where: _1.listOf('AssertDefinition'),
330
+ where: (0, _1.listOf)('AssertDefinition'),
313
331
  message: { type: 'string' },
314
332
  suggest: { type: 'array', items: { type: 'string' } },
315
333
  severity: { enum: ['error', 'warn', 'off'] },
@@ -357,8 +375,8 @@ const ConfigLabels = {
357
375
  };
358
376
  const ConfigSidebarLinks = {
359
377
  properties: {
360
- beforeInfo: _1.listOf('CommonConfigSidebarLinks'),
361
- end: _1.listOf('CommonConfigSidebarLinks'),
378
+ beforeInfo: (0, _1.listOf)('CommonConfigSidebarLinks'),
379
+ end: (0, _1.listOf)('CommonConfigSidebarLinks'),
362
380
  },
363
381
  };
364
382
  const CommonConfigSidebarLinks = {
@@ -386,7 +404,7 @@ const CommonColorProps = {
386
404
  },
387
405
  };
388
406
  const BorderThemeColors = {
389
- properties: utils_1.pickObjectProps(CommonThemeColors.properties, ['light', 'dark']),
407
+ properties: (0, utils_1.pickObjectProps)(CommonThemeColors.properties, ['light', 'dark']),
390
408
  };
391
409
  const HttpColors = {
392
410
  properties: {
@@ -410,7 +428,7 @@ const ResponseColors = {
410
428
  },
411
429
  };
412
430
  const SecondaryColors = {
413
- properties: utils_1.omitObjectProps(CommonThemeColors.properties, ['dark']),
431
+ properties: (0, utils_1.omitObjectProps)(CommonThemeColors.properties, ['dark']),
414
432
  };
415
433
  const TextThemeColors = {
416
434
  properties: {
@@ -458,10 +476,10 @@ const FontConfig = {
458
476
  },
459
477
  };
460
478
  const ButtonsConfig = {
461
- properties: Object.assign(Object.assign({}, utils_1.omitObjectProps(FontConfig.properties, ['fontSize', 'lineHeight'])), { borderRadius: { type: 'string' }, hoverStyle: { type: 'string' }, boxShadow: { type: 'string' }, hoverBoxShadow: { type: 'string' }, sizes: 'Sizes' }),
479
+ properties: Object.assign(Object.assign({}, (0, utils_1.omitObjectProps)(FontConfig.properties, ['fontSize', 'lineHeight'])), { borderRadius: { type: 'string' }, hoverStyle: { type: 'string' }, boxShadow: { type: 'string' }, hoverBoxShadow: { type: 'string' }, sizes: 'Sizes' }),
462
480
  };
463
481
  const BadgeFontConfig = {
464
- properties: utils_1.pickObjectProps(FontConfig.properties, ['fontSize', 'lineHeight']),
482
+ properties: (0, utils_1.pickObjectProps)(FontConfig.properties, ['fontSize', 'lineHeight']),
465
483
  };
466
484
  const BadgeSizes = {
467
485
  properties: {
@@ -470,7 +488,7 @@ const BadgeSizes = {
470
488
  },
471
489
  };
472
490
  const HttpBadgesConfig = {
473
- properties: Object.assign(Object.assign({}, utils_1.omitObjectProps(FontConfig.properties, ['fontSize', 'lineHeight'])), { borderRadius: { type: 'string' }, color: { type: 'string' }, sizes: 'BadgeSizes' }),
491
+ properties: Object.assign(Object.assign({}, (0, utils_1.omitObjectProps)(FontConfig.properties, ['fontSize', 'lineHeight'])), { borderRadius: { type: 'string' }, color: { type: 'string' }, sizes: 'BadgeSizes' }),
474
492
  };
475
493
  const LabelControls = {
476
494
  properties: {
@@ -556,7 +574,7 @@ const GroupItemsConfig = {
556
574
  },
557
575
  };
558
576
  const Level1Items = {
559
- properties: utils_1.pickObjectProps(GroupItemsConfig.properties, ['textTransform']),
577
+ properties: (0, utils_1.pickObjectProps)(GroupItemsConfig.properties, ['textTransform']),
560
578
  };
561
579
  const SpacingConfig = {
562
580
  properties: {
@@ -569,7 +587,7 @@ const SpacingConfig = {
569
587
  },
570
588
  };
571
589
  const Sidebar = {
572
- properties: Object.assign(Object.assign({}, utils_1.omitObjectProps(FontConfig.properties, ['fontWeight', 'lineHeight'])), { activeBgColor: { type: 'string' }, activeTextColor: { type: 'string' }, backgroundColor: { type: 'string' }, borderRadius: { type: 'string' }, breakPath: { type: 'boolean' }, caretColor: { type: 'string' }, caretSize: { type: 'string' }, groupItems: 'GroupItemsConfig', level1items: 'Level1Items', rightLineColor: { type: 'string' }, separatorLabelColor: { type: 'string' }, showAtBreakpoint: { type: 'string' }, spacing: 'SpacingConfig', textColor: { type: 'string' }, width: { type: 'string' } }),
590
+ properties: Object.assign(Object.assign({}, (0, utils_1.omitObjectProps)(FontConfig.properties, ['fontWeight', 'lineHeight'])), { activeBgColor: { type: 'string' }, activeTextColor: { type: 'string' }, backgroundColor: { type: 'string' }, borderRadius: { type: 'string' }, breakPath: { type: 'boolean' }, caretColor: { type: 'string' }, caretSize: { type: 'string' }, groupItems: 'GroupItemsConfig', level1items: 'Level1Items', rightLineColor: { type: 'string' }, separatorLabelColor: { type: 'string' }, showAtBreakpoint: { type: 'string' }, spacing: 'SpacingConfig', textColor: { type: 'string' }, width: { type: 'string' } }),
573
591
  };
574
592
  const Heading = {
575
593
  properties: Object.assign(Object.assign({}, FontConfig.properties), { color: { type: 'string' }, transform: { type: 'string' } }),
@@ -589,7 +607,7 @@ const CodeConfig = {
589
607
  }, wrap: { type: 'boolean' } }),
590
608
  };
591
609
  const HeadingsConfig = {
592
- properties: utils_1.omitObjectProps(FontConfig.properties, ['fontSize']),
610
+ properties: (0, utils_1.omitObjectProps)(FontConfig.properties, ['fontSize']),
593
611
  };
594
612
  const LinksConfig = {
595
613
  properties: {
@@ -601,10 +619,10 @@ const LinksConfig = {
601
619
  },
602
620
  };
603
621
  const Typography = {
604
- properties: Object.assign(Object.assign({ code: 'CodeConfig', fieldName: 'FontConfig' }, utils_1.pickObjectProps(FontConfig.properties, ['fontSize', 'fontFamily'])), { fontWeightBold: { type: 'string' }, fontWeightLight: { type: 'string' }, fontWeightRegular: { type: 'string' }, heading1: 'Heading', heading2: 'Heading', heading3: 'Heading', headings: 'HeadingsConfig', lineHeight: { type: 'string' }, links: 'LinksConfig', optimizeSpeed: { type: 'boolean' }, rightPanelHeading: 'Heading', smoothing: { enum: ['auto', 'none', 'antialiased', 'subpixel-antialiased', 'grayscale'] } }),
622
+ properties: Object.assign(Object.assign({ code: 'CodeConfig', fieldName: 'FontConfig' }, (0, utils_1.pickObjectProps)(FontConfig.properties, ['fontSize', 'fontFamily'])), { fontWeightBold: { type: 'string' }, fontWeightLight: { type: 'string' }, fontWeightRegular: { type: 'string' }, heading1: 'Heading', heading2: 'Heading', heading3: 'Heading', headings: 'HeadingsConfig', lineHeight: { type: 'string' }, links: 'LinksConfig', optimizeSpeed: { type: 'boolean' }, rightPanelHeading: 'Heading', smoothing: { enum: ['auto', 'none', 'antialiased', 'subpixel-antialiased', 'grayscale'] } }),
605
623
  };
606
624
  const TokenProps = {
607
- properties: Object.assign({ color: { type: 'string' } }, utils_1.omitObjectProps(FontConfig.properties, ['fontWeight'])),
625
+ properties: Object.assign({ color: { type: 'string' } }, (0, utils_1.omitObjectProps)(FontConfig.properties, ['fontWeight'])),
608
626
  };
609
627
  const CodeBlock = {
610
628
  properties: {
@@ -680,7 +698,7 @@ const ConfigTheme = {
680
698
  const GenerateCodeSamples = {
681
699
  properties: {
682
700
  skipOptionalParameters: { type: 'boolean' },
683
- languages: _1.listOf('ConfigLanguage'),
701
+ languages: (0, _1.listOf)('ConfigLanguage'),
684
702
  },
685
703
  required: ['languages'],
686
704
  };
@@ -596,4 +596,4 @@ var ScorecardStatus;
596
596
  ScorecardStatus["BelowMinimum"] = "Below minimum";
597
597
  ScorecardStatus["Highest"] = "Highest";
598
598
  ScorecardStatus["Minimum"] = "Minimum";
599
- })(ScorecardStatus = exports.ScorecardStatus || (exports.ScorecardStatus = {}));
599
+ })(ScorecardStatus || (exports.ScorecardStatus = ScorecardStatus = {}));
@@ -4,5 +4,5 @@ export interface StatsRow {
4
4
  color: 'red' | 'yellow' | 'green' | 'white' | 'magenta' | 'cyan';
5
5
  items?: Set<string>;
6
6
  }
7
- export declare type StatsName = 'operations' | 'refs' | 'tags' | 'externalDocs' | 'pathItems' | 'links' | 'schemas' | 'parameters';
8
- export declare type StatsAccumulator = Record<StatsName, StatsRow>;
7
+ export type StatsName = 'operations' | 'refs' | 'tags' | 'externalDocs' | 'pathItems' | 'links' | 'schemas' | 'parameters';
8
+ export type StatsAccumulator = Record<StatsName, StatsRow>;
@@ -35,7 +35,7 @@ export interface Oas3Paths {
35
35
  export interface OasRef {
36
36
  $ref: string;
37
37
  }
38
- export declare type Referenced<T> = OasRef | T;
38
+ export type Referenced<T> = OasRef | T;
39
39
  export interface Oas3PathItem {
40
40
  summary?: string;
41
41
  description?: string;
@@ -147,7 +147,7 @@ export interface Oas3Schema {
147
147
  xml?: Oas3Xml;
148
148
  'x-tags'?: string[];
149
149
  }
150
- export declare type Oas3_1Schema = Oas3Schema & {
150
+ export type Oas3_1Schema = Oas3Schema & {
151
151
  type?: string | string[];
152
152
  examples?: any[];
153
153
  };
@@ -183,8 +183,8 @@ export interface Oas3Encoding {
183
183
  explode: boolean;
184
184
  allowReserved: boolean;
185
185
  }
186
- export declare type Oas3ParameterLocation = 'query' | 'header' | 'path' | 'cookie';
187
- export declare type Oas3ParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';
186
+ export type Oas3ParameterLocation = 'query' | 'header' | 'path' | 'cookie';
187
+ export type Oas3ParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';
188
188
  export interface Oas3RequestBody {
189
189
  description?: string;
190
190
  required?: boolean;
@@ -210,7 +210,7 @@ export interface Oas3Response {
210
210
  export interface Oas3Link {
211
211
  $ref?: string;
212
212
  }
213
- export declare type Oas3Header = Omit<Oas3Parameter, 'in' | 'name'>;
213
+ export type Oas3Header = Omit<Oas3Parameter, 'in' | 'name'>;
214
214
  export interface Oas3Callback {
215
215
  [name: string]: Oas3PathItem;
216
216
  }
@@ -243,7 +243,7 @@ export interface Oas3Components {
243
243
  [name: string]: Referenced<Oas3Callback>;
244
244
  };
245
245
  }
246
- export declare type Oas3ComponentName = keyof Oas3Components;
246
+ export type Oas3ComponentName = keyof Oas3Components;
247
247
  export interface Oas3SecurityRequirement {
248
248
  [name: string]: string[];
249
249
  }
@@ -73,7 +73,7 @@ export interface Oas2Operation {
73
73
  'x-code-samples'?: Oas2XCodeSample[];
74
74
  'x-hideTryItPanel'?: boolean;
75
75
  }
76
- export declare type Oas2Parameter = Oas2BodyParameter | Oas2SimpleParameter;
76
+ export type Oas2Parameter = Oas2BodyParameter | Oas2SimpleParameter;
77
77
  export interface Oas2BodyParameter {
78
78
  name: string;
79
79
  in: 'body';
@@ -169,11 +169,11 @@ export interface Oas2Schema {
169
169
  xml?: Oas2Xml;
170
170
  'x-tags'?: string[];
171
171
  }
172
- export declare type Oas2ParameterLocation = 'query' | 'header' | 'path' | 'formData';
172
+ export type Oas2ParameterLocation = 'query' | 'header' | 'path' | 'formData';
173
173
  export interface Oas2Responses {
174
174
  [code: string]: Oas2Response;
175
175
  }
176
- export declare type Oas2Header = Oas2Items & {
176
+ export type Oas2Header = Oas2Items & {
177
177
  description?: 'string';
178
178
  };
179
179
  export interface Oas2Response {
package/lib/utils.d.ts CHANGED
@@ -1,18 +1,18 @@
1
1
  import { UserContext } from './walk';
2
2
  import { HttpResolveConfig } from './config';
3
3
  export { parseYaml, stringifyYaml } from './js-yaml';
4
- export declare type StackFrame<T> = {
4
+ export type StackFrame<T> = {
5
5
  prev: StackFrame<T> | null;
6
6
  value: T;
7
7
  };
8
- export declare type Stack<T> = StackFrame<T> | null;
9
- export declare type StackNonEmpty<T> = StackFrame<T>;
8
+ export type Stack<T> = StackFrame<T> | null;
9
+ export type StackNonEmpty<T> = StackFrame<T>;
10
10
  export declare function pushStack<T, P extends Stack<T> = Stack<T>>(head: P, value: T): {
11
11
  prev: P;
12
12
  value: T;
13
13
  };
14
14
  export declare function popStack<T, P extends Stack<T>>(head: P): StackFrame<T> | null;
15
- export declare type BundleOutputFormat = 'json' | 'yml' | 'yaml';
15
+ export type BundleOutputFormat = 'json' | 'yml' | 'yaml';
16
16
  export declare function loadYaml<T>(filename: string): Promise<T>;
17
17
  export declare function isDefined<T>(x: T | undefined): x is T;
18
18
  export declare function isPlainObject(value: any): value is object;
@@ -44,7 +44,7 @@ export declare function isCustomRuleId(id: string): boolean;
44
44
  export declare function doesYamlFileExist(filePath: string): boolean;
45
45
  export declare function showWarningForDeprecatedField(deprecatedField: string, updatedField?: string, updatedObject?: string): void;
46
46
  export declare function showErrorForDeprecatedField(deprecatedField: string, updatedField?: string, updatedObject?: string): void;
47
- export declare type Falsy = undefined | null | false | '' | 0;
47
+ export type Falsy = undefined | null | false | '' | 0;
48
48
  export declare function isTruthy<Truthy>(value: Truthy | Falsy): value is Truthy;
49
49
  export declare function identity<T>(value: T): T;
50
50
  export declare function keysOf<T>(obj: T): (keyof T)[];
package/lib/utils.js CHANGED
@@ -33,7 +33,7 @@ exports.popStack = popStack;
33
33
  function loadYaml(filename) {
34
34
  return __awaiter(this, void 0, void 0, function* () {
35
35
  const contents = yield fs.promises.readFile(filename, 'utf-8');
36
- return js_yaml_1.parseYaml(contents);
36
+ return (0, js_yaml_1.parseYaml)(contents);
37
37
  });
38
38
  }
39
39
  exports.loadYaml = loadYaml;
@@ -141,7 +141,7 @@ function readFileAsStringSync(filePath) {
141
141
  exports.readFileAsStringSync = readFileAsStringSync;
142
142
  function yamlAndJsonSyncReader(filePath) {
143
143
  const content = fs.readFileSync(filePath, 'utf-8');
144
- return js_yaml_1.parseYaml(content);
144
+ return (0, js_yaml_1.parseYaml)(content);
145
145
  }
146
146
  exports.yamlAndJsonSyncReader = yamlAndJsonSyncReader;
147
147
  function isPathParameter(pathSegment) {
@@ -189,7 +189,7 @@ function isCustomRuleId(id) {
189
189
  }
190
190
  exports.isCustomRuleId = isCustomRuleId;
191
191
  function doesYamlFileExist(filePath) {
192
- return ((path_1.extname(filePath) === '.yaml' || path_1.extname(filePath) === '.yml') &&
192
+ return (((0, path_1.extname)(filePath) === '.yaml' || (0, path_1.extname)(filePath) === '.yml') &&
193
193
  fs.hasOwnProperty('existsSync') &&
194
194
  fs.existsSync(filePath));
195
195
  }
package/lib/visitors.d.ts CHANGED
@@ -5,20 +5,20 @@ import type { Stack } from './utils';
5
5
  import type { UserContext, ResolveResult, ProblemSeverity } from './walk';
6
6
  import type { Location } from './ref-utils';
7
7
  import { Async2Definition } from './typings/asyncapi';
8
- export declare type SkipFunctionContext = Pick<UserContext, 'location' | 'rawNode' | 'resolve' | 'rawLocation'>;
9
- export declare type VisitFunction<T> = (node: T, ctx: UserContext & {
8
+ export type SkipFunctionContext = Pick<UserContext, 'location' | 'rawNode' | 'resolve' | 'rawLocation'>;
9
+ export type VisitFunction<T> = (node: T, ctx: UserContext & {
10
10
  ignoreNextVisitorsOnNode: () => void;
11
11
  }, parents?: any, context?: any) => void;
12
- declare type VisitRefFunction = (node: OasRef, ctx: UserContext, resolved: ResolveResult<any>) => void;
13
- declare type SkipFunction<T> = (node: T, key: string | number, ctx: SkipFunctionContext) => boolean;
14
- declare type VisitObject<T> = {
12
+ type VisitRefFunction = (node: OasRef, ctx: UserContext, resolved: ResolveResult<any>) => void;
13
+ type SkipFunction<T> = (node: T, key: string | number, ctx: SkipFunctionContext) => boolean;
14
+ type VisitObject<T> = {
15
15
  enter?: VisitFunction<T>;
16
16
  leave?: VisitFunction<T>;
17
17
  skip?: SkipFunction<T>;
18
18
  };
19
- declare type NestedVisitObject<T, P> = VisitObject<T> & NestedVisitor<P>;
20
- declare type VisitFunctionOrObject<T> = VisitFunction<T> | VisitObject<T>;
21
- declare type VisitorNode<T> = {
19
+ export type NestedVisitObject<T, P> = VisitObject<T> & NestedVisitor<P>;
20
+ type VisitFunctionOrObject<T> = VisitFunction<T> | VisitObject<T>;
21
+ export type VisitorNode<T> = {
22
22
  ruleId: string;
23
23
  severity: ProblemSeverity;
24
24
  context: VisitorLevelContext | VisitorSkippedLevelContext;
@@ -26,14 +26,14 @@ declare type VisitorNode<T> = {
26
26
  visit: VisitFunction<T>;
27
27
  skip?: SkipFunction<T>;
28
28
  };
29
- declare type VisitorRefNode = {
29
+ type VisitorRefNode = {
30
30
  ruleId: string;
31
31
  severity: ProblemSeverity;
32
32
  context: VisitorLevelContext;
33
33
  depth: number;
34
34
  visit: VisitRefFunction;
35
35
  };
36
- export declare type VisitorLevelContext = {
36
+ export type VisitorLevelContext = {
37
37
  isSkippedLevel: false;
38
38
  type: NormalizedNodeType;
39
39
  parent: VisitorLevelContext | null;
@@ -45,13 +45,13 @@ export declare type VisitorLevelContext = {
45
45
  location?: Location;
46
46
  }>;
47
47
  };
48
- export declare type VisitorSkippedLevelContext = {
48
+ export type VisitorSkippedLevelContext = {
49
49
  isSkippedLevel: true;
50
50
  parent: VisitorLevelContext;
51
51
  seen: Set<any>;
52
52
  };
53
- declare type NormalizeVisitor<Fn> = Fn extends VisitFunction<infer T> ? VisitorNode<T> : never;
54
- export declare type BaseVisitor = {
53
+ export type NormalizeVisitor<Fn> = Fn extends VisitFunction<infer T> ? VisitorNode<T> : never;
54
+ export type BaseVisitor = {
55
55
  any?: {
56
56
  enter?: VisitFunction<any>;
57
57
  leave?: VisitFunction<any>;
@@ -62,7 +62,7 @@ export declare type BaseVisitor = {
62
62
  leave?: VisitRefFunction;
63
63
  } | VisitRefFunction;
64
64
  };
65
- declare type Oas3FlatVisitor = {
65
+ type Oas3FlatVisitor = {
66
66
  Root?: VisitFunctionOrObject<Oas3Definition>;
67
67
  Tag?: VisitFunctionOrObject<Oas3Tag>;
68
68
  ExternalDocs?: VisitFunctionOrObject<Oas3ExternalDocs>;
@@ -110,7 +110,7 @@ declare type Oas3FlatVisitor = {
110
110
  SecurityScheme?: VisitFunctionOrObject<Oas3SecurityScheme>;
111
111
  SpecExtension?: VisitFunctionOrObject<unknown>;
112
112
  };
113
- declare type Oas2FlatVisitor = {
113
+ type Oas2FlatVisitor = {
114
114
  Root?: VisitFunctionOrObject<Oas2Definition>;
115
115
  Tag?: VisitFunctionOrObject<Oas2Tag>;
116
116
  ExternalDocs?: VisitFunctionOrObject<Oas2ExternalDocs>;
@@ -133,28 +133,26 @@ declare type Oas2FlatVisitor = {
133
133
  NamedResponses?: VisitFunctionOrObject<Record<string, Oas2Response>>;
134
134
  NamedParameters?: VisitFunctionOrObject<Record<string, Oas2Parameter>>;
135
135
  SecurityScheme?: VisitFunctionOrObject<Oas2SecurityScheme>;
136
+ NamedSecuritySchemes?: VisitFunctionOrObject<Record<string, Oas2SecurityScheme>>;
136
137
  SpecExtension?: VisitFunctionOrObject<unknown>;
137
138
  };
138
- declare type Async2FlatVisitor = {
139
+ type Async2FlatVisitor = {
139
140
  Root?: VisitFunctionOrObject<Async2Definition>;
140
141
  };
141
- declare type Oas3NestedVisitor = {
142
+ type Oas3NestedVisitor = {
142
143
  [T in keyof Oas3FlatVisitor]: Oas3FlatVisitor[T] extends Function ? Oas3FlatVisitor[T] : Oas3FlatVisitor[T] & NestedVisitor<Oas3NestedVisitor>;
143
144
  };
144
- declare type Oas2NestedVisitor = {
145
+ type Oas2NestedVisitor = {
145
146
  [T in keyof Oas2FlatVisitor]: Oas2FlatVisitor[T] extends Function ? Oas2FlatVisitor[T] : Oas2FlatVisitor[T] & NestedVisitor<Oas2NestedVisitor>;
146
147
  };
147
- declare type Async2NestedVisitor = {
148
+ type Async2NestedVisitor = {
148
149
  [T in keyof Async2FlatVisitor]: Async2FlatVisitor[T] extends Function ? Async2FlatVisitor[T] : Async2FlatVisitor[T] & NestedVisitor<Async2NestedVisitor>;
149
150
  };
150
- export declare type Oas3Visitor = BaseVisitor & Oas3NestedVisitor & Record<string, VisitFunction<any> | NestedVisitObject<any, Oas3NestedVisitor>>;
151
- export declare type Oas2Visitor = BaseVisitor & Oas2NestedVisitor & Record<string, VisitFunction<any> | NestedVisitObject<any, Oas2NestedVisitor>>;
152
- export declare type Async2Visitor = BaseVisitor & Async2NestedVisitor & Record<string, VisitFunction<any> | NestedVisitObject<any, Async2NestedVisitor>>;
153
- export declare type Oas3TransformVisitor = BaseVisitor & Oas3FlatVisitor & Record<string, VisitFunction<any> | VisitObject<any>>;
154
- export declare type Oas2TransformVisitor = BaseVisitor & Oas2FlatVisitor & Record<string, VisitFunction<any> | VisitObject<any>>;
155
- export declare type Async2TransformVisitor = BaseVisitor & Async2FlatVisitor & Record<string, VisitFunction<any> | VisitObject<any>>;
156
- export declare type NestedVisitor<T> = Exclude<T, 'any' | 'ref' | 'Root'>;
157
- export declare type NormalizedOasVisitors<T extends BaseVisitor> = {
151
+ export type Oas3Visitor = BaseVisitor & Oas3NestedVisitor & Record<string, VisitFunction<any> | NestedVisitObject<any, Oas3NestedVisitor>>;
152
+ export type Oas2Visitor = BaseVisitor & Oas2NestedVisitor & Record<string, VisitFunction<any> | NestedVisitObject<any, Oas2NestedVisitor>>;
153
+ export type Async2Visitor = BaseVisitor & Async2NestedVisitor & Record<string, VisitFunction<any> | NestedVisitObject<any, Async2NestedVisitor>>;
154
+ export type NestedVisitor<T> = Exclude<T, 'any' | 'ref' | 'Root'>;
155
+ export type NormalizedOasVisitors<T extends BaseVisitor> = {
158
156
  [V in keyof T]-?: {
159
157
  enter: Array<NormalizeVisitor<T[V]>>;
160
158
  leave: Array<NormalizeVisitor<T[V]>>;
@@ -169,19 +167,19 @@ export declare type NormalizedOasVisitors<T extends BaseVisitor> = {
169
167
  leave: Array<VisitorNode<any>>;
170
168
  };
171
169
  };
172
- export declare type Oas3Rule = (options: Record<string, any>) => Oas3Visitor | Oas3Visitor[];
173
- export declare type Oas2Rule = (options: Record<string, any>) => Oas2Visitor | Oas2Visitor[];
174
- export declare type Async2Rule = (options: Record<string, any>) => Async2Visitor | Async2Visitor[];
175
- export declare type Oas3Preprocessor = (options: Record<string, any>) => Oas3TransformVisitor;
176
- export declare type Oas2Preprocessor = (options: Record<string, any>) => Oas2TransformVisitor;
177
- export declare type Async2Preprocessor = (options: Record<string, any>) => Async2TransformVisitor;
178
- export declare type Oas3Decorator = (options: Record<string, any>) => Oas3TransformVisitor;
179
- export declare type Oas2Decorator = (options: Record<string, any>) => Oas2TransformVisitor;
180
- export declare type Async2Decorator = (options: Record<string, any>) => Async2TransformVisitor;
181
- export declare type OasRule = Oas3Rule;
182
- export declare type OasPreprocessor = Oas3Preprocessor;
183
- export declare type OasDecorator = Oas3Decorator;
184
- export declare type RuleInstanceConfig = {
170
+ export type Oas3Rule = (options: Record<string, any>) => Oas3Visitor | Oas3Visitor[];
171
+ export type Oas2Rule = (options: Record<string, any>) => Oas2Visitor | Oas2Visitor[];
172
+ export type Async2Rule = (options: Record<string, any>) => Async2Visitor | Async2Visitor[];
173
+ export type Oas3Preprocessor = (options: Record<string, any>) => Oas3Visitor;
174
+ export type Oas2Preprocessor = (options: Record<string, any>) => Oas2Visitor;
175
+ export type Async2Preprocessor = (options: Record<string, any>) => Async2Visitor;
176
+ export type Oas3Decorator = (options: Record<string, any>) => Oas3Visitor;
177
+ export type Oas2Decorator = (options: Record<string, any>) => Oas2Visitor;
178
+ export type Async2Decorator = (options: Record<string, any>) => Async2Visitor;
179
+ export type OasRule = Oas3Rule;
180
+ export type OasPreprocessor = Oas3Preprocessor;
181
+ export type OasDecorator = Oas3Decorator;
182
+ export type RuleInstanceConfig = {
185
183
  ruleId: string;
186
184
  severity: ProblemSeverity;
187
185
  };
package/lib/walk.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import type { Referenced } from './typings/openapi';
2
- import type { NormalizedOasVisitors } from './visitors';
2
+ import type { NormalizedOasVisitors, BaseVisitor } from './visitors';
3
3
  import type { ResolvedRefMap, Document } from './resolve';
4
4
  import type { NormalizedNodeType } from './types';
5
5
  import type { RuleSeverity } from './config';
6
6
  import { Location } from './ref-utils';
7
7
  import { ResolveError, YamlParseError, Source } from './resolve';
8
8
  import { SpecVersion } from './oas-types';
9
- declare type NonUndefined = string | number | boolean | symbol | bigint | object | Record<string, any>;
10
- export declare type ResolveResult<T extends NonUndefined> = {
9
+ export type NonUndefined = string | number | boolean | symbol | bigint | object | Record<string, any>;
10
+ export type ResolveResult<T extends NonUndefined> = {
11
11
  node: T;
12
12
  location: Location;
13
13
  error?: ResolveError | YamlParseError;
@@ -16,8 +16,8 @@ export declare type ResolveResult<T extends NonUndefined> = {
16
16
  location: undefined;
17
17
  error?: ResolveError | YamlParseError;
18
18
  };
19
- export declare type ResolveFn = <T>(node: Referenced<T>, from?: string) => ResolveResult<T>;
20
- export declare type UserContext = {
19
+ export type ResolveFn = <T extends NonUndefined>(node: Referenced<T>, from?: string) => ResolveResult<T>;
20
+ export type UserContext = {
21
21
  report(problem: Problem): void;
22
22
  location: Location;
23
23
  rawNode: any;
@@ -30,23 +30,23 @@ export declare type UserContext = {
30
30
  oasVersion: SpecVersion;
31
31
  getVisitorData: () => Record<string, unknown>;
32
32
  };
33
- export declare type Loc = {
33
+ export type Loc = {
34
34
  line: number;
35
35
  col: number;
36
36
  };
37
- export declare type PointerLocationObject = {
37
+ export type PointerLocationObject = {
38
38
  source: Source;
39
39
  reportOnKey?: boolean;
40
40
  pointer: string;
41
41
  };
42
- export declare type LineColLocationObject = Omit<PointerLocationObject, 'pointer'> & {
42
+ export type LineColLocationObject = Omit<PointerLocationObject, 'pointer'> & {
43
43
  pointer: undefined;
44
44
  start: Loc;
45
45
  end?: Loc;
46
46
  };
47
- export declare type LocationObject = LineColLocationObject | PointerLocationObject;
48
- export declare type ProblemSeverity = 'error' | 'warn';
49
- export declare type Problem = {
47
+ export type LocationObject = LineColLocationObject | PointerLocationObject;
48
+ export type ProblemSeverity = 'error' | 'warn';
49
+ export type Problem = {
50
50
  message: string;
51
51
  suggest?: string[];
52
52
  location?: Partial<LocationObject> | Array<Partial<LocationObject>>;
@@ -54,7 +54,7 @@ export declare type Problem = {
54
54
  forceSeverity?: RuleSeverity;
55
55
  ruleId?: string;
56
56
  };
57
- export declare type NormalizedProblem = {
57
+ export type NormalizedProblem = {
58
58
  message: string;
59
59
  ruleId: string;
60
60
  severity: ProblemSeverity;
@@ -63,17 +63,16 @@ export declare type NormalizedProblem = {
63
63
  suggest: string[];
64
64
  ignored?: boolean;
65
65
  };
66
- export declare type WalkContext = {
66
+ export type WalkContext = {
67
67
  problems: NormalizedProblem[];
68
68
  oasVersion: SpecVersion;
69
69
  visitorsData: Record<string, Record<string, unknown>>;
70
70
  refTypes?: Map<string, NormalizedNodeType>;
71
71
  };
72
- export declare function walkDocument<T>(opts: {
72
+ export declare function walkDocument<T extends BaseVisitor>(opts: {
73
73
  document: Document;
74
74
  rootType: NormalizedNodeType;
75
75
  normalizedVisitors: NormalizedOasVisitors<T>;
76
76
  resolvedRefMap: ResolvedRefMap;
77
77
  ctx: WalkContext;
78
78
  }): void;
79
- export {};