@redocly/openapi-core 0.0.0-snapshot.1737554067

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 (322) hide show
  1. package/README.md +268 -0
  2. package/lib/benchmark/benches/lint-with-many-rules.bench.d.ts +4 -0
  3. package/lib/benchmark/benches/lint-with-many-rules.bench.js +38 -0
  4. package/lib/benchmark/benches/lint-with-nested-rule.bench.d.ts +4 -0
  5. package/lib/benchmark/benches/lint-with-nested-rule.bench.js +44 -0
  6. package/lib/benchmark/benches/lint-with-no-rules.bench.d.ts +4 -0
  7. package/lib/benchmark/benches/lint-with-no-rules.bench.js +25 -0
  8. package/lib/benchmark/benches/lint-with-top-level-rule-report.bench.d.ts +4 -0
  9. package/lib/benchmark/benches/lint-with-top-level-rule-report.bench.js +37 -0
  10. package/lib/benchmark/benches/lint-with-top-level-rule.bench.d.ts +4 -0
  11. package/lib/benchmark/benches/lint-with-top-level-rule.bench.js +36 -0
  12. package/lib/benchmark/benches/recommended-oas3.bench.d.ts +3 -0
  13. package/lib/benchmark/benches/recommended-oas3.bench.js +21 -0
  14. package/lib/benchmark/benches/resolve-with-no-external.bench.d.ts +3 -0
  15. package/lib/benchmark/benches/resolve-with-no-external.bench.js +22 -0
  16. package/lib/benchmark/utils.d.ts +6 -0
  17. package/lib/benchmark/utils.js +34 -0
  18. package/lib/bundle.d.ts +50 -0
  19. package/lib/bundle.js +385 -0
  20. package/lib/config/all.d.ts +3 -0
  21. package/lib/config/all.js +227 -0
  22. package/lib/config/builtIn.d.ts +3 -0
  23. package/lib/config/builtIn.js +53 -0
  24. package/lib/config/config-resolvers.d.ts +30 -0
  25. package/lib/config/config-resolvers.js +447 -0
  26. package/lib/config/config.d.ts +53 -0
  27. package/lib/config/config.js +320 -0
  28. package/lib/config/index.d.ts +7 -0
  29. package/lib/config/index.js +23 -0
  30. package/lib/config/load.d.ts +38 -0
  31. package/lib/config/load.js +140 -0
  32. package/lib/config/minimal.d.ts +3 -0
  33. package/lib/config/minimal.js +203 -0
  34. package/lib/config/recommended-strict.d.ts +3 -0
  35. package/lib/config/recommended-strict.js +203 -0
  36. package/lib/config/recommended.d.ts +3 -0
  37. package/lib/config/recommended.js +203 -0
  38. package/lib/config/rules.d.ts +10 -0
  39. package/lib/config/rules.js +37 -0
  40. package/lib/config/spec.d.ts +3 -0
  41. package/lib/config/spec.js +29 -0
  42. package/lib/config/types.d.ts +189 -0
  43. package/lib/config/types.js +2 -0
  44. package/lib/config/utils.d.ts +19 -0
  45. package/lib/config/utils.js +308 -0
  46. package/lib/decorators/arazzo/index.d.ts +1 -0
  47. package/lib/decorators/arazzo/index.js +4 -0
  48. package/lib/decorators/async2/index.d.ts +1 -0
  49. package/lib/decorators/async2/index.js +4 -0
  50. package/lib/decorators/async3/index.d.ts +1 -0
  51. package/lib/decorators/async3/index.js +4 -0
  52. package/lib/decorators/common/filters/filter-helper.d.ts +3 -0
  53. package/lib/decorators/common/filters/filter-helper.js +66 -0
  54. package/lib/decorators/common/filters/filter-in.d.ts +2 -0
  55. package/lib/decorators/common/filters/filter-in.js +17 -0
  56. package/lib/decorators/common/filters/filter-out.d.ts +2 -0
  57. package/lib/decorators/common/filters/filter-out.js +17 -0
  58. package/lib/decorators/common/info-description-override.d.ts +2 -0
  59. package/lib/decorators/common/info-description-override.js +24 -0
  60. package/lib/decorators/common/info-override.d.ts +2 -0
  61. package/lib/decorators/common/info-override.js +17 -0
  62. package/lib/decorators/common/media-type-examples-override.d.ts +2 -0
  63. package/lib/decorators/common/media-type-examples-override.js +59 -0
  64. package/lib/decorators/common/operation-description-override.d.ts +2 -0
  65. package/lib/decorators/common/operation-description-override.js +29 -0
  66. package/lib/decorators/common/registry-dependencies.d.ts +2 -0
  67. package/lib/decorators/common/registry-dependencies.js +24 -0
  68. package/lib/decorators/common/remove-x-internal.d.ts +2 -0
  69. package/lib/decorators/common/remove-x-internal.js +69 -0
  70. package/lib/decorators/common/tag-description-override.d.ts +2 -0
  71. package/lib/decorators/common/tag-description-override.js +25 -0
  72. package/lib/decorators/oas2/index.d.ts +11 -0
  73. package/lib/decorators/oas2/index.js +21 -0
  74. package/lib/decorators/oas2/remove-unused-components.d.ts +2 -0
  75. package/lib/decorators/oas2/remove-unused-components.js +89 -0
  76. package/lib/decorators/oas3/index.d.ts +12 -0
  77. package/lib/decorators/oas3/index.js +23 -0
  78. package/lib/decorators/oas3/remove-unused-components.d.ts +2 -0
  79. package/lib/decorators/oas3/remove-unused-components.js +100 -0
  80. package/lib/env.d.ts +2 -0
  81. package/lib/env.js +7 -0
  82. package/lib/format/codeframes.d.ts +22 -0
  83. package/lib/format/codeframes.js +185 -0
  84. package/lib/format/format.d.ts +20 -0
  85. package/lib/format/format.js +365 -0
  86. package/lib/index.d.ts +26 -0
  87. package/lib/index.js +98 -0
  88. package/lib/js-yaml/index.d.ts +3 -0
  89. package/lib/js-yaml/index.js +15 -0
  90. package/lib/lint.d.ts +32 -0
  91. package/lib/lint.js +118 -0
  92. package/lib/logger.d.ts +10 -0
  93. package/lib/logger.js +31 -0
  94. package/lib/oas-types.d.ts +36 -0
  95. package/lib/oas-types.js +92 -0
  96. package/lib/output.d.ts +3 -0
  97. package/lib/output.js +9 -0
  98. package/lib/redocly/domains.d.ts +14 -0
  99. package/lib/redocly/domains.js +41 -0
  100. package/lib/redocly/index.d.ts +30 -0
  101. package/lib/redocly/index.js +131 -0
  102. package/lib/redocly/redocly-client-types.d.ts +8 -0
  103. package/lib/redocly/redocly-client-types.js +2 -0
  104. package/lib/redocly/registry-api-types.d.ts +29 -0
  105. package/lib/redocly/registry-api-types.js +2 -0
  106. package/lib/redocly/registry-api.d.ts +17 -0
  107. package/lib/redocly/registry-api.js +96 -0
  108. package/lib/ref-utils.d.ts +27 -0
  109. package/lib/ref-utils.js +85 -0
  110. package/lib/resolve.d.ts +66 -0
  111. package/lib/resolve.js +342 -0
  112. package/lib/rules/ajv.d.ts +10 -0
  113. package/lib/rules/ajv.js +82 -0
  114. package/lib/rules/arazzo/criteria-unique.d.ts +2 -0
  115. package/lib/rules/arazzo/criteria-unique.js +71 -0
  116. package/lib/rules/arazzo/index.d.ts +3 -0
  117. package/lib/rules/arazzo/index.js +36 -0
  118. package/lib/rules/arazzo/parameters-unique.d.ts +2 -0
  119. package/lib/rules/arazzo/parameters-unique.js +32 -0
  120. package/lib/rules/arazzo/requestBody-replacements-unique.d.ts +2 -0
  121. package/lib/rules/arazzo/requestBody-replacements-unique.js +28 -0
  122. package/lib/rules/arazzo/sourceDescription-type.d.ts +2 -0
  123. package/lib/rules/arazzo/sourceDescription-type.js +22 -0
  124. package/lib/rules/arazzo/sourceDescriptions-name-unique.d.ts +2 -0
  125. package/lib/rules/arazzo/sourceDescriptions-name-unique.js +24 -0
  126. package/lib/rules/arazzo/sourceDescriptions-not-empty.d.ts +2 -0
  127. package/lib/rules/arazzo/sourceDescriptions-not-empty.js +18 -0
  128. package/lib/rules/arazzo/step-onFailure-unique.d.ts +2 -0
  129. package/lib/rules/arazzo/step-onFailure-unique.js +32 -0
  130. package/lib/rules/arazzo/step-onSuccess-unique.d.ts +2 -0
  131. package/lib/rules/arazzo/step-onSuccess-unique.js +32 -0
  132. package/lib/rules/arazzo/stepId-unique.d.ts +2 -0
  133. package/lib/rules/arazzo/stepId-unique.js +26 -0
  134. package/lib/rules/arazzo/workflow-dependsOn.d.ts +2 -0
  135. package/lib/rules/arazzo/workflow-dependsOn.js +56 -0
  136. package/lib/rules/arazzo/workflowId-unique.d.ts +2 -0
  137. package/lib/rules/arazzo/workflowId-unique.js +22 -0
  138. package/lib/rules/async2/channels-kebab-case.d.ts +2 -0
  139. package/lib/rules/async2/channels-kebab-case.js +19 -0
  140. package/lib/rules/async2/index.d.ts +3 -0
  141. package/lib/rules/async2/index.js +27 -0
  142. package/lib/rules/async2/no-channel-trailing-slash.d.ts +2 -0
  143. package/lib/rules/async2/no-channel-trailing-slash.js +16 -0
  144. package/lib/rules/async3/channels-kebab-case.d.ts +2 -0
  145. package/lib/rules/async3/channels-kebab-case.js +19 -0
  146. package/lib/rules/async3/index.d.ts +3 -0
  147. package/lib/rules/async3/index.js +27 -0
  148. package/lib/rules/async3/no-channel-trailing-slash.d.ts +2 -0
  149. package/lib/rules/async3/no-channel-trailing-slash.js +16 -0
  150. package/lib/rules/common/assertions/asserts.d.ts +30 -0
  151. package/lib/rules/common/assertions/asserts.js +281 -0
  152. package/lib/rules/common/assertions/index.d.ts +27 -0
  153. package/lib/rules/common/assertions/index.js +24 -0
  154. package/lib/rules/common/assertions/utils.d.ts +28 -0
  155. package/lib/rules/common/assertions/utils.js +226 -0
  156. package/lib/rules/common/info-contact.d.ts +2 -0
  157. package/lib/rules/common/info-contact.js +17 -0
  158. package/lib/rules/common/info-license-strict.d.ts +2 -0
  159. package/lib/rules/common/info-license-strict.js +26 -0
  160. package/lib/rules/common/info-license-url.d.ts +2 -0
  161. package/lib/rules/common/info-license-url.js +12 -0
  162. package/lib/rules/common/info-license.d.ts +2 -0
  163. package/lib/rules/common/info-license.js +17 -0
  164. package/lib/rules/common/no-ambiguous-paths.d.ts +2 -0
  165. package/lib/rules/common/no-ambiguous-paths.js +45 -0
  166. package/lib/rules/common/no-enum-type-mismatch.d.ts +2 -0
  167. package/lib/rules/common/no-enum-type-mismatch.js +41 -0
  168. package/lib/rules/common/no-http-verbs-in-paths.d.ts +2 -0
  169. package/lib/rules/common/no-http-verbs-in-paths.js +33 -0
  170. package/lib/rules/common/no-identical-paths.d.ts +2 -0
  171. package/lib/rules/common/no-identical-paths.js +24 -0
  172. package/lib/rules/common/no-invalid-parameter-examples.d.ts +1 -0
  173. package/lib/rules/common/no-invalid-parameter-examples.js +24 -0
  174. package/lib/rules/common/no-invalid-schema-examples.d.ts +1 -0
  175. package/lib/rules/common/no-invalid-schema-examples.js +22 -0
  176. package/lib/rules/common/no-path-trailing-slash.d.ts +2 -0
  177. package/lib/rules/common/no-path-trailing-slash.js +16 -0
  178. package/lib/rules/common/no-required-schema-properties-undefined.d.ts +2 -0
  179. package/lib/rules/common/no-required-schema-properties-undefined.js +36 -0
  180. package/lib/rules/common/operation-2xx-response.d.ts +2 -0
  181. package/lib/rules/common/operation-2xx-response.js +23 -0
  182. package/lib/rules/common/operation-4xx-response.d.ts +2 -0
  183. package/lib/rules/common/operation-4xx-response.js +23 -0
  184. package/lib/rules/common/operation-description.d.ts +2 -0
  185. package/lib/rules/common/operation-description.js +12 -0
  186. package/lib/rules/common/operation-operationId-unique.d.ts +2 -0
  187. package/lib/rules/common/operation-operationId-unique.js +20 -0
  188. package/lib/rules/common/operation-operationId-url-safe.d.ts +2 -0
  189. package/lib/rules/common/operation-operationId-url-safe.js +18 -0
  190. package/lib/rules/common/operation-operationId.d.ts +2 -0
  191. package/lib/rules/common/operation-operationId.js +16 -0
  192. package/lib/rules/common/operation-parameters-unique.d.ts +2 -0
  193. package/lib/rules/common/operation-parameters-unique.js +40 -0
  194. package/lib/rules/common/operation-singular-tag.d.ts +2 -0
  195. package/lib/rules/common/operation-singular-tag.js +16 -0
  196. package/lib/rules/common/operation-summary.d.ts +2 -0
  197. package/lib/rules/common/operation-summary.js +12 -0
  198. package/lib/rules/common/operation-tag-defined.d.ts +2 -0
  199. package/lib/rules/common/operation-tag-defined.js +24 -0
  200. package/lib/rules/common/parameter-description.d.ts +2 -0
  201. package/lib/rules/common/parameter-description.js +22 -0
  202. package/lib/rules/common/path-declaration-must-exist.d.ts +2 -0
  203. package/lib/rules/common/path-declaration-must-exist.js +16 -0
  204. package/lib/rules/common/path-excludes-patterns.d.ts +2 -0
  205. package/lib/rules/common/path-excludes-patterns.js +22 -0
  206. package/lib/rules/common/path-http-verbs-order.d.ts +2 -0
  207. package/lib/rules/common/path-http-verbs-order.js +26 -0
  208. package/lib/rules/common/path-not-include-query.d.ts +2 -0
  209. package/lib/rules/common/path-not-include-query.js +18 -0
  210. package/lib/rules/common/path-params-defined.d.ts +2 -0
  211. package/lib/rules/common/path-params-defined.js +58 -0
  212. package/lib/rules/common/path-segment-plural.d.ts +2 -0
  213. package/lib/rules/common/path-segment-plural.js +33 -0
  214. package/lib/rules/common/paths-kebab-case.d.ts +2 -0
  215. package/lib/rules/common/paths-kebab-case.js +20 -0
  216. package/lib/rules/common/required-string-property-missing-min-length.d.ts +2 -0
  217. package/lib/rules/common/required-string-property-missing-min-length.js +37 -0
  218. package/lib/rules/common/response-contains-header.d.ts +2 -0
  219. package/lib/rules/common/response-contains-header.js +29 -0
  220. package/lib/rules/common/scalar-property-missing-example.d.ts +2 -0
  221. package/lib/rules/common/scalar-property-missing-example.js +42 -0
  222. package/lib/rules/common/security-defined.d.ts +2 -0
  223. package/lib/rules/common/security-defined.js +65 -0
  224. package/lib/rules/common/spec-strict-refs.d.ts +2 -0
  225. package/lib/rules/common/spec-strict-refs.js +30 -0
  226. package/lib/rules/common/struct.d.ts +2 -0
  227. package/lib/rules/common/struct.js +158 -0
  228. package/lib/rules/common/tag-description.d.ts +2 -0
  229. package/lib/rules/common/tag-description.js +12 -0
  230. package/lib/rules/common/tags-alphabetical.d.ts +2 -0
  231. package/lib/rules/common/tags-alphabetical.js +23 -0
  232. package/lib/rules/no-unresolved-refs.d.ts +5 -0
  233. package/lib/rules/no-unresolved-refs.js +46 -0
  234. package/lib/rules/oas2/boolean-parameter-prefixes.d.ts +5 -0
  235. package/lib/rules/oas2/boolean-parameter-prefixes.js +22 -0
  236. package/lib/rules/oas2/index.d.ts +3 -0
  237. package/lib/rules/oas2/index.js +98 -0
  238. package/lib/rules/oas2/request-mime-type.d.ts +2 -0
  239. package/lib/rules/oas2/request-mime-type.js +17 -0
  240. package/lib/rules/oas2/response-contains-property.d.ts +2 -0
  241. package/lib/rules/oas2/response-contains-property.js +37 -0
  242. package/lib/rules/oas2/response-mime-type.d.ts +2 -0
  243. package/lib/rules/oas2/response-mime-type.js +17 -0
  244. package/lib/rules/oas3/array-parameter-serialization.d.ts +5 -0
  245. package/lib/rules/oas3/array-parameter-serialization.js +29 -0
  246. package/lib/rules/oas3/boolean-parameter-prefixes.d.ts +5 -0
  247. package/lib/rules/oas3/boolean-parameter-prefixes.js +24 -0
  248. package/lib/rules/oas3/component-name-unique.d.ts +2 -0
  249. package/lib/rules/oas3/component-name-unique.js +133 -0
  250. package/lib/rules/oas3/index.d.ts +3 -0
  251. package/lib/rules/oas3/index.js +122 -0
  252. package/lib/rules/oas3/no-empty-servers.d.ts +2 -0
  253. package/lib/rules/oas3/no-empty-servers.js +23 -0
  254. package/lib/rules/oas3/no-example-value-and-externalValue.d.ts +2 -0
  255. package/lib/rules/oas3/no-example-value-and-externalValue.js +16 -0
  256. package/lib/rules/oas3/no-invalid-media-type-examples.d.ts +2 -0
  257. package/lib/rules/oas3/no-invalid-media-type-examples.js +39 -0
  258. package/lib/rules/oas3/no-server-example.com.d.ts +2 -0
  259. package/lib/rules/oas3/no-server-example.com.js +18 -0
  260. package/lib/rules/oas3/no-server-trailing-slash.d.ts +2 -0
  261. package/lib/rules/oas3/no-server-trailing-slash.js +18 -0
  262. package/lib/rules/oas3/no-server-variables-empty-enum.d.ts +2 -0
  263. package/lib/rules/oas3/no-server-variables-empty-enum.js +66 -0
  264. package/lib/rules/oas3/no-undefined-server-variable.d.ts +2 -0
  265. package/lib/rules/oas3/no-undefined-server-variable.js +31 -0
  266. package/lib/rules/oas3/no-unused-components.d.ts +2 -0
  267. package/lib/rules/oas3/no-unused-components.js +73 -0
  268. package/lib/rules/oas3/operation-4xx-problem-details-rfc7807.d.ts +5 -0
  269. package/lib/rules/oas3/operation-4xx-problem-details-rfc7807.js +36 -0
  270. package/lib/rules/oas3/request-mime-type.d.ts +2 -0
  271. package/lib/rules/oas3/request-mime-type.js +31 -0
  272. package/lib/rules/oas3/response-contains-property.d.ts +2 -0
  273. package/lib/rules/oas3/response-contains-property.js +39 -0
  274. package/lib/rules/oas3/response-mime-type.d.ts +2 -0
  275. package/lib/rules/oas3/response-mime-type.js +31 -0
  276. package/lib/rules/oas3/spec-components-invalid-map-name.d.ts +2 -0
  277. package/lib/rules/oas3/spec-components-invalid-map-name.js +62 -0
  278. package/lib/rules/other/stats.d.ts +41 -0
  279. package/lib/rules/other/stats.js +75 -0
  280. package/lib/rules/spot/no-criteria-xpath.d.ts +2 -0
  281. package/lib/rules/spot/no-criteria-xpath.js +21 -0
  282. package/lib/rules/spot/spot-supported-versions.d.ts +2 -0
  283. package/lib/rules/spot/spot-supported-versions.js +21 -0
  284. package/lib/rules/utils.d.ts +22 -0
  285. package/lib/rules/utils.js +183 -0
  286. package/lib/types/arazzo.d.ts +2 -0
  287. package/lib/types/arazzo.js +311 -0
  288. package/lib/types/asyncapi2.d.ts +17 -0
  289. package/lib/types/asyncapi2.js +1008 -0
  290. package/lib/types/asyncapi3.d.ts +2 -0
  291. package/lib/types/asyncapi3.js +347 -0
  292. package/lib/types/index.d.ts +57 -0
  293. package/lib/types/index.js +94 -0
  294. package/lib/types/json-schema-adapter.d.ts +3 -0
  295. package/lib/types/json-schema-adapter.js +159 -0
  296. package/lib/types/oas2.d.ts +3 -0
  297. package/lib/types/oas2.js +456 -0
  298. package/lib/types/oas3.d.ts +7 -0
  299. package/lib/types/oas3.js +554 -0
  300. package/lib/types/oas3_1.d.ts +6 -0
  301. package/lib/types/oas3_1.js +285 -0
  302. package/lib/types/redocly-yaml.d.ts +26 -0
  303. package/lib/types/redocly-yaml.js +1126 -0
  304. package/lib/typings/arazzo.d.ts +131 -0
  305. package/lib/typings/arazzo.js +5 -0
  306. package/lib/typings/asyncapi.d.ts +21 -0
  307. package/lib/typings/asyncapi.js +2 -0
  308. package/lib/typings/asyncapi3.d.ts +53 -0
  309. package/lib/typings/asyncapi3.js +2 -0
  310. package/lib/typings/common.d.ts +8 -0
  311. package/lib/typings/common.js +2 -0
  312. package/lib/typings/openapi.d.ts +355 -0
  313. package/lib/typings/openapi.js +2 -0
  314. package/lib/typings/swagger.d.ts +217 -0
  315. package/lib/typings/swagger.js +2 -0
  316. package/lib/utils.d.ts +70 -0
  317. package/lib/utils.js +301 -0
  318. package/lib/visitors.d.ts +229 -0
  319. package/lib/visitors.js +176 -0
  320. package/lib/walk.d.ts +78 -0
  321. package/lib/walk.js +290 -0
  322. package/package.json +59 -0
@@ -0,0 +1,30 @@
1
+ import { BaseResolver } from '../resolve';
2
+ import { Config } from './config';
3
+ import type { StyleguideRawConfig, Plugin, RawConfig, ResolvedApi, ResolvedStyleguideConfig } from './types';
4
+ import type { BundleOptions } from '../bundle';
5
+ import type { Document, ResolvedRefMap } from '../resolve';
6
+ export declare function resolveConfigFileAndRefs({ configPath, externalRefResolver, base, }: Omit<BundleOptions, 'config'> & {
7
+ configPath?: string;
8
+ }): Promise<{
9
+ document: Document;
10
+ resolvedRefMap: ResolvedRefMap;
11
+ }>;
12
+ export declare function resolveConfig({ rawConfig, configPath, externalRefResolver, }: {
13
+ rawConfig: RawConfig;
14
+ configPath?: string;
15
+ externalRefResolver?: BaseResolver;
16
+ }): Promise<Config>;
17
+ export declare function resolvePlugins(plugins: (string | Plugin)[] | null, configDir?: string): Promise<Plugin[]>;
18
+ export declare function resolveApis({ rawConfig, configPath, resolver, }: {
19
+ rawConfig: RawConfig;
20
+ configPath?: string;
21
+ resolver?: BaseResolver;
22
+ }): Promise<Record<string, ResolvedApi>>;
23
+ export declare function resolveStyleguideConfig(opts: {
24
+ styleguideConfig?: StyleguideRawConfig;
25
+ configPath?: string;
26
+ resolver?: BaseResolver;
27
+ parentConfigPaths?: string[];
28
+ extendPaths?: string[];
29
+ }): Promise<ResolvedStyleguideConfig>;
30
+ export declare function resolvePreset(presetName: string, plugins: Plugin[]): ResolvedStyleguideConfig;
@@ -0,0 +1,447 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveConfigFileAndRefs = resolveConfigFileAndRefs;
4
+ exports.resolveConfig = resolveConfig;
5
+ exports.resolvePlugins = resolvePlugins;
6
+ exports.resolveApis = resolveApis;
7
+ exports.resolveStyleguideConfig = resolveStyleguideConfig;
8
+ exports.resolvePreset = resolvePreset;
9
+ const path = require("path");
10
+ const url_1 = require("url");
11
+ const fs_1 = require("fs");
12
+ const ref_utils_1 = require("../ref-utils");
13
+ const utils_1 = require("../utils");
14
+ const resolve_1 = require("../resolve");
15
+ const builtIn_1 = require("./builtIn");
16
+ const utils_2 = require("./utils");
17
+ const env_1 = require("../env");
18
+ const config_1 = require("./config");
19
+ const logger_1 = require("../logger");
20
+ const asserts_1 = require("../rules/common/assertions/asserts");
21
+ const types_1 = require("../types");
22
+ const redocly_yaml_1 = require("../types/redocly-yaml");
23
+ const DEFAULT_PROJECT_PLUGIN_PATHS = ['@theme/plugin.js', '@theme/plugin.cjs', '@theme/plugin.mjs'];
24
+ // Cache instantiated plugins during a single execution
25
+ const pluginsCache = new Map();
26
+ async function resolveConfigFileAndRefs({ configPath, externalRefResolver = new resolve_1.BaseResolver(), base = null, }) {
27
+ if (!configPath) {
28
+ throw new Error('Reference to a config is required.\n');
29
+ }
30
+ const document = await externalRefResolver.resolveDocument(base, configPath, true);
31
+ if (document instanceof Error) {
32
+ throw document;
33
+ }
34
+ const types = (0, types_1.normalizeTypes)(redocly_yaml_1.ConfigTypes);
35
+ const resolvedRefMap = await (0, resolve_1.resolveDocument)({
36
+ rootDocument: document,
37
+ rootType: types.ConfigRoot,
38
+ externalRefResolver,
39
+ });
40
+ return { document, resolvedRefMap };
41
+ }
42
+ async function resolveConfig({ rawConfig, configPath, externalRefResolver, }) {
43
+ if (rawConfig.styleguide?.extends?.some(utils_1.isNotString)) {
44
+ throw new Error(`Error configuration format not detected in extends value must contain strings`);
45
+ }
46
+ const resolver = externalRefResolver ?? new resolve_1.BaseResolver((0, utils_2.getResolveConfig)(rawConfig.resolve));
47
+ const apis = await resolveApis({
48
+ rawConfig,
49
+ configPath,
50
+ resolver,
51
+ });
52
+ const styleguide = await resolveStyleguideConfig({
53
+ styleguideConfig: rawConfig.styleguide,
54
+ configPath,
55
+ resolver,
56
+ });
57
+ return new config_1.Config({
58
+ ...rawConfig,
59
+ apis,
60
+ styleguide,
61
+ }, configPath);
62
+ }
63
+ function getDefaultPluginPath(configDir) {
64
+ for (const pluginPath of DEFAULT_PROJECT_PLUGIN_PATHS) {
65
+ const absolutePluginPath = path.resolve(configDir, pluginPath);
66
+ if ((0, fs_1.existsSync)(absolutePluginPath)) {
67
+ return pluginPath;
68
+ }
69
+ }
70
+ return;
71
+ }
72
+ async function resolvePlugins(plugins, configDir = '') {
73
+ if (!plugins)
74
+ return [];
75
+ // TODO: implement or reuse Resolver approach so it will work in node and browser envs
76
+ const requireFunc = async (plugin) => {
77
+ if ((0, utils_1.isString)(plugin)) {
78
+ try {
79
+ const maybeAbsolutePluginPath = path.resolve(configDir, plugin);
80
+ const absolutePluginPath = (0, fs_1.existsSync)(maybeAbsolutePluginPath)
81
+ ? maybeAbsolutePluginPath
82
+ : // For plugins imported from packages specifically
83
+ require.resolve(plugin, {
84
+ paths: [
85
+ // Plugins imported from the node_modules in the project directory
86
+ configDir,
87
+ // Plugins imported from the node_modules in the package install directory (for example, npx cache directory)
88
+ __dirname,
89
+ ],
90
+ });
91
+ if (!pluginsCache.has(absolutePluginPath)) {
92
+ let requiredPlugin;
93
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
94
+ // @ts-ignore
95
+ if (typeof __webpack_require__ === 'function') {
96
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
97
+ // @ts-ignore
98
+ requiredPlugin = __non_webpack_require__(absolutePluginPath);
99
+ }
100
+ else {
101
+ // Workaround for dynamic imports being transpiled to require by Typescript: https://github.com/microsoft/TypeScript/issues/43329#issuecomment-811606238
102
+ const _importDynamic = new Function('modulePath', 'return import(modulePath)');
103
+ // you can import both cjs and mjs
104
+ const mod = await _importDynamic((0, url_1.pathToFileURL)(absolutePluginPath).href);
105
+ requiredPlugin = mod.default || mod;
106
+ }
107
+ const pluginCreatorOptions = { contentDir: configDir };
108
+ const pluginModule = (0, utils_2.isDeprecatedPluginFormat)(requiredPlugin)
109
+ ? requiredPlugin
110
+ : (0, utils_2.isCommonJsPlugin)(requiredPlugin)
111
+ ? await requiredPlugin(pluginCreatorOptions)
112
+ : await requiredPlugin?.default?.(pluginCreatorOptions);
113
+ if (pluginModule?.id && (0, utils_2.isDeprecatedPluginFormat)(requiredPlugin)) {
114
+ logger_1.logger.info(`Deprecated plugin format detected: ${pluginModule.id}\n`);
115
+ }
116
+ if (pluginModule) {
117
+ pluginsCache.set(absolutePluginPath, {
118
+ ...pluginModule,
119
+ path: plugin,
120
+ absolutePath: absolutePluginPath,
121
+ });
122
+ }
123
+ }
124
+ return pluginsCache.get(absolutePluginPath);
125
+ }
126
+ catch (e) {
127
+ throw new Error(`Failed to load plugin "${plugin}": ${e.message}\n\n${e.stack}`);
128
+ }
129
+ }
130
+ return plugin;
131
+ };
132
+ const seenPluginIds = new Map();
133
+ /**
134
+ * Include the default plugin automatically if it's not in configuration
135
+ */
136
+ const defaultPluginPath = getDefaultPluginPath(configDir);
137
+ if (defaultPluginPath) {
138
+ plugins.push(defaultPluginPath);
139
+ }
140
+ const resolvedPlugins = new Set();
141
+ const instances = await Promise.all(plugins.map(async (p) => {
142
+ if ((0, utils_1.isString)(p)) {
143
+ if ((0, ref_utils_1.isAbsoluteUrl)(p)) {
144
+ throw new Error(logger_1.colorize.red(`We don't support remote plugins yet.`));
145
+ }
146
+ if (resolvedPlugins.has(p)) {
147
+ return;
148
+ }
149
+ resolvedPlugins.add(p);
150
+ }
151
+ const pluginModule = await requireFunc(p);
152
+ if (!pluginModule) {
153
+ return;
154
+ }
155
+ const id = pluginModule.id;
156
+ if (typeof id !== 'string') {
157
+ throw new Error(logger_1.colorize.red(`Plugin must define \`id\` property in ${logger_1.colorize.blue(p.toString())}.`));
158
+ }
159
+ if (seenPluginIds.has(id)) {
160
+ const pluginPath = seenPluginIds.get(id);
161
+ throw new Error(logger_1.colorize.red(`Plugin "id" must be unique. Plugin ${logger_1.colorize.blue(p.toString())} uses id "${logger_1.colorize.blue(id)}" already seen in ${logger_1.colorize.blue(pluginPath)}`));
162
+ }
163
+ seenPluginIds.set(id, p.toString());
164
+ const plugin = {
165
+ id,
166
+ ...(pluginModule.configs ? { configs: pluginModule.configs } : {}),
167
+ ...(pluginModule.typeExtension ? { typeExtension: pluginModule.typeExtension } : {}),
168
+ };
169
+ if (pluginModule.rules) {
170
+ if (!pluginModule.rules.oas3 && !pluginModule.rules.oas2 && !pluginModule.rules.async2) {
171
+ throw new Error(`Plugin rules must have \`oas3\`, \`oas2\`, \`async2\`, \`async3\` or \`arazzo\` rules "${p}.`);
172
+ }
173
+ plugin.rules = {};
174
+ if (pluginModule.rules.oas3) {
175
+ plugin.rules.oas3 = (0, utils_2.prefixRules)(pluginModule.rules.oas3, id);
176
+ }
177
+ if (pluginModule.rules.oas2) {
178
+ plugin.rules.oas2 = (0, utils_2.prefixRules)(pluginModule.rules.oas2, id);
179
+ }
180
+ if (pluginModule.rules.async2) {
181
+ plugin.rules.async2 = (0, utils_2.prefixRules)(pluginModule.rules.async2, id);
182
+ }
183
+ if (pluginModule.rules.async3) {
184
+ plugin.rules.async3 = (0, utils_2.prefixRules)(pluginModule.rules.async3, id);
185
+ }
186
+ if (pluginModule.rules.arazzo1) {
187
+ plugin.rules.arazzo1 = (0, utils_2.prefixRules)(pluginModule.rules.arazzo1, id);
188
+ }
189
+ }
190
+ if (pluginModule.preprocessors) {
191
+ if (!pluginModule.preprocessors.oas3 &&
192
+ !pluginModule.preprocessors.oas2 &&
193
+ !pluginModule.preprocessors.async2 &&
194
+ !pluginModule.preprocessors.async3 &&
195
+ !pluginModule.preprocessors.arazzo1) {
196
+ throw new Error(`Plugin \`preprocessors\` must have \`oas3\`, \`oas2\` or \`async2\` preprocessors "${p}.`);
197
+ }
198
+ plugin.preprocessors = {};
199
+ if (pluginModule.preprocessors.oas3) {
200
+ plugin.preprocessors.oas3 = (0, utils_2.prefixRules)(pluginModule.preprocessors.oas3, id);
201
+ }
202
+ if (pluginModule.preprocessors.oas2) {
203
+ plugin.preprocessors.oas2 = (0, utils_2.prefixRules)(pluginModule.preprocessors.oas2, id);
204
+ }
205
+ if (pluginModule.preprocessors.async2) {
206
+ plugin.preprocessors.async2 = (0, utils_2.prefixRules)(pluginModule.preprocessors.async2, id);
207
+ }
208
+ if (pluginModule.preprocessors.async3) {
209
+ plugin.preprocessors.async3 = (0, utils_2.prefixRules)(pluginModule.preprocessors.async3, id);
210
+ }
211
+ if (pluginModule.preprocessors.arazzo1) {
212
+ plugin.preprocessors.arazzo1 = (0, utils_2.prefixRules)(pluginModule.preprocessors.arazzo1, id);
213
+ }
214
+ }
215
+ if (pluginModule.decorators) {
216
+ if (!pluginModule.decorators.oas3 &&
217
+ !pluginModule.decorators.oas2 &&
218
+ !pluginModule.decorators.async2 &&
219
+ !pluginModule.decorators.async3 &&
220
+ !pluginModule.decorators.arazzo1) {
221
+ throw new Error(`Plugin \`decorators\` must have \`oas3\`, \`oas2\`, \`async2\` or \`async3\` decorators "${p}.`);
222
+ }
223
+ plugin.decorators = {};
224
+ if (pluginModule.decorators.oas3) {
225
+ plugin.decorators.oas3 = (0, utils_2.prefixRules)(pluginModule.decorators.oas3, id);
226
+ }
227
+ if (pluginModule.decorators.oas2) {
228
+ plugin.decorators.oas2 = (0, utils_2.prefixRules)(pluginModule.decorators.oas2, id);
229
+ }
230
+ if (pluginModule.decorators.async2) {
231
+ plugin.decorators.async2 = (0, utils_2.prefixRules)(pluginModule.decorators.async2, id);
232
+ }
233
+ if (pluginModule.decorators.async3) {
234
+ plugin.decorators.async3 = (0, utils_2.prefixRules)(pluginModule.decorators.async3, id);
235
+ }
236
+ if (pluginModule.decorators.arazzo1) {
237
+ plugin.decorators.arazzo1 = (0, utils_2.prefixRules)(pluginModule.decorators.arazzo1, id);
238
+ }
239
+ }
240
+ if (pluginModule.assertions) {
241
+ plugin.assertions = pluginModule.assertions;
242
+ }
243
+ return {
244
+ ...pluginModule,
245
+ ...plugin,
246
+ };
247
+ }));
248
+ return instances.filter(utils_1.isDefined);
249
+ }
250
+ async function resolveApis({ rawConfig, configPath = '', resolver, }) {
251
+ const { apis = {}, styleguide: styleguideConfig = {} } = rawConfig;
252
+ const resolvedApis = {};
253
+ for (const [apiName, apiContent] of Object.entries(apis || {})) {
254
+ if (apiContent.styleguide?.extends?.some(utils_1.isNotString)) {
255
+ throw new Error(`Error configuration format not detected in extends value must contain strings`);
256
+ }
257
+ const rawStyleguideConfig = getMergedRawStyleguideConfig(styleguideConfig, apiContent.styleguide);
258
+ const resolvedApiConfig = await resolveStyleguideConfig({
259
+ styleguideConfig: rawStyleguideConfig,
260
+ configPath,
261
+ resolver,
262
+ });
263
+ resolvedApis[apiName] = { ...apiContent, styleguide: resolvedApiConfig };
264
+ }
265
+ return resolvedApis;
266
+ }
267
+ async function resolveAndMergeNestedStyleguideConfig({ styleguideConfig, configPath = '', resolver = new resolve_1.BaseResolver(), parentConfigPaths = [], extendPaths = [], }) {
268
+ if (parentConfigPaths.includes(configPath)) {
269
+ throw new Error(`Circular dependency in config file: "${configPath}"`);
270
+ }
271
+ const plugins = env_1.isBrowser
272
+ ? // In browser, we don't support plugins from config file yet
273
+ [builtIn_1.defaultPlugin]
274
+ : (0, utils_2.getUniquePlugins)(await resolvePlugins([...(styleguideConfig?.plugins || []), builtIn_1.defaultPlugin], path.dirname(configPath)));
275
+ const pluginPaths = styleguideConfig?.plugins
276
+ ?.filter(utils_1.isString)
277
+ .map((p) => path.resolve(path.dirname(configPath), p));
278
+ const resolvedConfigPath = (0, ref_utils_1.isAbsoluteUrl)(configPath)
279
+ ? configPath
280
+ : configPath && path.resolve(configPath);
281
+ const extendConfigs = await Promise.all(styleguideConfig?.extends?.map(async (presetItem) => {
282
+ if (!(0, ref_utils_1.isAbsoluteUrl)(presetItem) && !path.extname(presetItem)) {
283
+ return resolvePreset(presetItem, plugins);
284
+ }
285
+ const pathItem = (0, ref_utils_1.isAbsoluteUrl)(presetItem)
286
+ ? presetItem
287
+ : (0, ref_utils_1.isAbsoluteUrl)(configPath)
288
+ ? new URL(presetItem, configPath).href
289
+ : path.resolve(path.dirname(configPath), presetItem);
290
+ const extendedStyleguideConfig = await loadExtendStyleguideConfig(pathItem, resolver);
291
+ return await resolveAndMergeNestedStyleguideConfig({
292
+ styleguideConfig: extendedStyleguideConfig,
293
+ configPath: pathItem,
294
+ resolver,
295
+ parentConfigPaths: [...parentConfigPaths, resolvedConfigPath],
296
+ extendPaths,
297
+ });
298
+ }) || []);
299
+ const { plugins: mergedPlugins = [], ...styleguide } = (0, utils_2.mergeExtends)([
300
+ ...extendConfigs,
301
+ {
302
+ ...styleguideConfig,
303
+ plugins,
304
+ extends: undefined,
305
+ extendPaths: [...parentConfigPaths, resolvedConfigPath],
306
+ pluginPaths,
307
+ },
308
+ ]);
309
+ return {
310
+ ...styleguide,
311
+ extendPaths: styleguide.extendPaths?.filter((path) => path && !(0, ref_utils_1.isAbsoluteUrl)(path)),
312
+ plugins: (0, utils_2.getUniquePlugins)(mergedPlugins),
313
+ recommendedFallback: styleguideConfig?.recommendedFallback,
314
+ doNotResolveExamples: styleguideConfig?.doNotResolveExamples,
315
+ };
316
+ }
317
+ async function resolveStyleguideConfig(opts) {
318
+ const resolvedStyleguideConfig = await resolveAndMergeNestedStyleguideConfig(opts);
319
+ return {
320
+ ...resolvedStyleguideConfig,
321
+ rules: resolvedStyleguideConfig.rules && groupStyleguideAssertionRules(resolvedStyleguideConfig),
322
+ };
323
+ }
324
+ function resolvePreset(presetName, plugins) {
325
+ const { pluginId, configName } = (0, utils_2.parsePresetName)(presetName);
326
+ const plugin = plugins.find((p) => p.id === pluginId);
327
+ if (!plugin) {
328
+ throw new Error(`Invalid config ${logger_1.colorize.red(presetName)}: plugin ${pluginId} is not included.`);
329
+ }
330
+ const preset = plugin.configs?.[configName];
331
+ if (!preset) {
332
+ throw new Error(pluginId
333
+ ? `Invalid config ${logger_1.colorize.red(presetName)}: plugin ${pluginId} doesn't export config with name ${configName}.`
334
+ : `Invalid config ${logger_1.colorize.red(presetName)}: there is no such built-in config.`);
335
+ }
336
+ return preset;
337
+ }
338
+ async function loadExtendStyleguideConfig(filePath, resolver) {
339
+ try {
340
+ const { parsed } = (await resolver.resolveDocument(null, filePath));
341
+ const rawConfig = (0, utils_2.transformConfig)(parsed);
342
+ if (!rawConfig.styleguide) {
343
+ throw new Error(`Styleguide configuration format not detected: "${filePath}"`);
344
+ }
345
+ return rawConfig.styleguide;
346
+ }
347
+ catch (error) {
348
+ throw new Error(`Failed to load "${filePath}": ${error.message}`);
349
+ }
350
+ }
351
+ function getMergedRawStyleguideConfig(rootStyleguideConfig, apiStyleguideConfig) {
352
+ const resultLint = {
353
+ ...rootStyleguideConfig,
354
+ ...(0, utils_1.pickDefined)(apiStyleguideConfig),
355
+ rules: { ...rootStyleguideConfig?.rules, ...apiStyleguideConfig?.rules },
356
+ oas2Rules: { ...rootStyleguideConfig?.oas2Rules, ...apiStyleguideConfig?.oas2Rules },
357
+ oas3_0Rules: { ...rootStyleguideConfig?.oas3_0Rules, ...apiStyleguideConfig?.oas3_0Rules },
358
+ oas3_1Rules: { ...rootStyleguideConfig?.oas3_1Rules, ...apiStyleguideConfig?.oas3_1Rules },
359
+ async2Rules: { ...rootStyleguideConfig?.async2Rules, ...apiStyleguideConfig?.async2Rules },
360
+ async3Rules: { ...rootStyleguideConfig?.async3Rules, ...apiStyleguideConfig?.async3Rules },
361
+ arazzo1Rules: { ...rootStyleguideConfig?.arazzo1Rules, ...apiStyleguideConfig?.arazzo1Rules },
362
+ preprocessors: {
363
+ ...rootStyleguideConfig?.preprocessors,
364
+ ...apiStyleguideConfig?.preprocessors,
365
+ },
366
+ oas2Preprocessors: {
367
+ ...rootStyleguideConfig?.oas2Preprocessors,
368
+ ...apiStyleguideConfig?.oas2Preprocessors,
369
+ },
370
+ oas3_0Preprocessors: {
371
+ ...rootStyleguideConfig?.oas3_0Preprocessors,
372
+ ...apiStyleguideConfig?.oas3_0Preprocessors,
373
+ },
374
+ oas3_1Preprocessors: {
375
+ ...rootStyleguideConfig?.oas3_1Preprocessors,
376
+ ...apiStyleguideConfig?.oas3_1Preprocessors,
377
+ },
378
+ decorators: { ...rootStyleguideConfig?.decorators, ...apiStyleguideConfig?.decorators },
379
+ oas2Decorators: {
380
+ ...rootStyleguideConfig?.oas2Decorators,
381
+ ...apiStyleguideConfig?.oas2Decorators,
382
+ },
383
+ oas3_0Decorators: {
384
+ ...rootStyleguideConfig?.oas3_0Decorators,
385
+ ...apiStyleguideConfig?.oas3_0Decorators,
386
+ },
387
+ oas3_1Decorators: {
388
+ ...rootStyleguideConfig?.oas3_1Decorators,
389
+ ...apiStyleguideConfig?.oas3_1Decorators,
390
+ },
391
+ recommendedFallback: apiStyleguideConfig?.extends
392
+ ? false
393
+ : rootStyleguideConfig.recommendedFallback,
394
+ };
395
+ return resultLint;
396
+ }
397
+ function groupStyleguideAssertionRules({ rules, plugins, }) {
398
+ if (!rules) {
399
+ return rules;
400
+ }
401
+ // Create a new record to avoid mutating original
402
+ const transformedRules = {};
403
+ // Collect assertion rules
404
+ const assertions = [];
405
+ for (const [ruleKey, rule] of Object.entries(rules)) {
406
+ // keep the old assert/ syntax as an alias
407
+ if ((ruleKey.startsWith('rule/') || ruleKey.startsWith('assert/')) &&
408
+ typeof rule === 'object' &&
409
+ rule !== null) {
410
+ const assertion = rule;
411
+ if (plugins) {
412
+ registerCustomAssertions(plugins, assertion);
413
+ // We may have custom assertion inside where block
414
+ for (const context of assertion.where || []) {
415
+ registerCustomAssertions(plugins, context);
416
+ }
417
+ }
418
+ assertions.push({
419
+ ...assertion,
420
+ assertionId: ruleKey,
421
+ });
422
+ }
423
+ else {
424
+ // If it's not an assertion, keep it as is
425
+ transformedRules[ruleKey] = rule;
426
+ }
427
+ }
428
+ if (assertions.length > 0) {
429
+ transformedRules.assertions = assertions;
430
+ }
431
+ return transformedRules;
432
+ }
433
+ function registerCustomAssertions(plugins, assertion) {
434
+ for (const field of (0, utils_1.keysOf)(assertion.assertions)) {
435
+ const [pluginId, fn] = field.split('/');
436
+ if (!pluginId || !fn)
437
+ continue;
438
+ const plugin = plugins.find((plugin) => plugin.id === pluginId);
439
+ if (!plugin) {
440
+ throw Error(logger_1.colorize.red(`Plugin ${logger_1.colorize.blue(pluginId)} isn't found.`));
441
+ }
442
+ if (!plugin.assertions || !plugin.assertions[fn]) {
443
+ throw Error(`Plugin ${logger_1.colorize.red(pluginId)} doesn't export assertions function with name ${logger_1.colorize.red(fn)}.`);
444
+ }
445
+ asserts_1.asserts[field] = (0, asserts_1.buildAssertCustomFunction)(plugin.assertions[fn]);
446
+ }
447
+ }
@@ -0,0 +1,53 @@
1
+ import { SpecVersion, SpecMajorVersion } from '../oas-types';
2
+ import type { NormalizedProblem } from '../walk';
3
+ import type { Oas2RuleSet, Oas3RuleSet, Async3RuleSet, Arazzo1RuleSet } from '../oas-types';
4
+ import type { NodeType } from '../types';
5
+ import type { DecoratorConfig, Plugin, PreprocessorConfig, Region, ResolveConfig, ResolvedApi, ResolvedConfig, ResolvedStyleguideConfig, RuleConfig, RuleSettings, Telemetry, ThemeRawConfig } from './types';
6
+ export declare const IGNORE_FILE = ".redocly.lint-ignore.yaml";
7
+ export declare class StyleguideConfig {
8
+ rawConfig: ResolvedStyleguideConfig;
9
+ configFile?: string | undefined;
10
+ plugins: Plugin[];
11
+ ignore: Record<string, Record<string, Set<string>>>;
12
+ doNotResolveExamples: boolean;
13
+ rules: Record<SpecVersion, Record<string, RuleConfig>>;
14
+ preprocessors: Record<SpecVersion, Record<string, PreprocessorConfig>>;
15
+ decorators: Record<SpecVersion, Record<string, DecoratorConfig>>;
16
+ private _usedRules;
17
+ private _usedVersions;
18
+ recommendedFallback: boolean;
19
+ extendPaths: string[];
20
+ pluginPaths: string[];
21
+ constructor(rawConfig: ResolvedStyleguideConfig, configFile?: string | undefined);
22
+ resolveIgnore(ignoreFile?: string): void;
23
+ saveIgnore(): void;
24
+ addIgnore(problem: NormalizedProblem): void;
25
+ addProblemToIgnore(problem: NormalizedProblem): NormalizedProblem;
26
+ extendTypes(types: Record<string, NodeType>, version: SpecVersion): Record<string, NodeType>;
27
+ getRuleSettings(ruleId: string, oasVersion: SpecVersion): RuleSettings;
28
+ getPreprocessorSettings(ruleId: string, oasVersion: SpecVersion): RuleSettings;
29
+ getDecoratorSettings(ruleId: string, oasVersion: SpecVersion): RuleSettings;
30
+ getUnusedRules(): {
31
+ rules: string[];
32
+ preprocessors: string[];
33
+ decorators: string[];
34
+ };
35
+ getRulesForSpecVersion(version: SpecMajorVersion): Oas3RuleSet[] | Oas2RuleSet[] | Async3RuleSet[] | Arazzo1RuleSet[];
36
+ skipRules(rules?: string[]): void;
37
+ skipPreprocessors(preprocessors?: string[]): void;
38
+ skipDecorators(decorators?: string[]): void;
39
+ }
40
+ export declare class Config {
41
+ rawConfig: ResolvedConfig;
42
+ configFile?: string | undefined;
43
+ apis: Record<string, ResolvedApi>;
44
+ styleguide: StyleguideConfig;
45
+ resolve: ResolveConfig;
46
+ licenseKey?: string;
47
+ region?: Region;
48
+ theme: ThemeRawConfig;
49
+ organization?: string;
50
+ files: string[];
51
+ telemetry?: Telemetry;
52
+ constructor(rawConfig: ResolvedConfig, configFile?: string | undefined);
53
+ }