@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,1126 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConfigTypes = void 0;
4
+ exports.createConfigTypes = createConfigTypes;
5
+ const config_1 = require("@redocly/config");
6
+ const _1 = require(".");
7
+ const utils_1 = require("../utils");
8
+ const json_schema_adapter_1 = require("./json-schema-adapter");
9
+ const oas_types_1 = require("../oas-types");
10
+ const builtInOAS2Rules = [
11
+ 'info-contact',
12
+ 'operation-operationId',
13
+ 'tag-description',
14
+ 'tags-alphabetical',
15
+ 'info-license-url',
16
+ 'info-license-strict',
17
+ 'info-license',
18
+ 'no-ambiguous-paths',
19
+ 'no-enum-type-mismatch',
20
+ 'no-http-verbs-in-paths',
21
+ 'no-identical-paths',
22
+ 'no-invalid-parameter-examples',
23
+ 'no-invalid-schema-examples',
24
+ 'no-path-trailing-slash',
25
+ 'operation-2xx-response',
26
+ 'operation-4xx-response',
27
+ 'operation-description',
28
+ 'operation-operationId-unique',
29
+ 'operation-operationId-url-safe',
30
+ 'operation-parameters-unique',
31
+ 'operation-singular-tag',
32
+ 'operation-summary',
33
+ 'operation-tag-defined',
34
+ 'parameter-description',
35
+ 'path-declaration-must-exist',
36
+ 'path-excludes-patterns',
37
+ 'path-http-verbs-order',
38
+ 'path-not-include-query',
39
+ 'path-params-defined',
40
+ 'path-parameters-defined',
41
+ 'path-segment-plural',
42
+ 'paths-kebab-case',
43
+ 'required-string-property-missing-min-length',
44
+ 'response-contains-header',
45
+ 'scalar-property-missing-example',
46
+ 'security-defined',
47
+ 'spec-strict-refs',
48
+ 'no-unresolved-refs',
49
+ 'no-required-schema-properties-undefined',
50
+ 'boolean-parameter-prefixes',
51
+ 'request-mime-type',
52
+ 'response-contains-property',
53
+ 'response-mime-type',
54
+ ];
55
+ const builtInOAS3Rules = [
56
+ 'info-contact',
57
+ 'operation-operationId',
58
+ 'tag-description',
59
+ 'tags-alphabetical',
60
+ 'info-license-url',
61
+ 'info-license-strict',
62
+ 'info-license',
63
+ 'no-ambiguous-paths',
64
+ 'no-enum-type-mismatch',
65
+ 'no-http-verbs-in-paths',
66
+ 'no-identical-paths',
67
+ 'no-invalid-parameter-examples',
68
+ 'no-invalid-schema-examples',
69
+ 'no-path-trailing-slash',
70
+ 'operation-2xx-response',
71
+ 'operation-4xx-response',
72
+ 'operation-description',
73
+ 'operation-operationId-unique',
74
+ 'operation-operationId-url-safe',
75
+ 'operation-parameters-unique',
76
+ 'operation-singular-tag',
77
+ 'operation-summary',
78
+ 'operation-tag-defined',
79
+ 'parameter-description',
80
+ 'path-declaration-must-exist',
81
+ 'path-excludes-patterns',
82
+ 'path-http-verbs-order',
83
+ 'path-not-include-query',
84
+ 'path-params-defined',
85
+ 'path-parameters-defined',
86
+ 'path-segment-plural',
87
+ 'paths-kebab-case',
88
+ 'required-string-property-missing-min-length',
89
+ 'response-contains-header',
90
+ 'scalar-property-missing-example',
91
+ 'security-defined',
92
+ 'spec-strict-refs',
93
+ 'no-unresolved-refs',
94
+ 'no-required-schema-properties-undefined',
95
+ 'boolean-parameter-prefixes',
96
+ 'component-name-unique',
97
+ 'no-empty-servers',
98
+ 'no-example-value-and-externalValue',
99
+ 'no-invalid-media-type-examples',
100
+ 'no-server-example.com',
101
+ 'no-server-trailing-slash',
102
+ 'no-server-variables-empty-enum',
103
+ 'no-undefined-server-variable',
104
+ 'no-unused-components',
105
+ 'operation-4xx-problem-details-rfc7807',
106
+ 'request-mime-type',
107
+ 'response-contains-property',
108
+ 'response-mime-type',
109
+ 'spec-components-invalid-map-name',
110
+ 'array-parameter-serialization',
111
+ ];
112
+ const builtInAsync2Rules = [
113
+ 'info-contact',
114
+ 'info-license-strict',
115
+ 'operation-operationId',
116
+ 'tag-description',
117
+ 'tags-alphabetical',
118
+ 'channels-kebab-case',
119
+ 'no-channel-trailing-slash',
120
+ ];
121
+ const builtInAsync3Rules = [
122
+ 'info-contact',
123
+ 'info-license-strict',
124
+ 'operation-operationId',
125
+ 'tag-description',
126
+ 'tags-alphabetical',
127
+ 'channels-kebab-case',
128
+ 'no-channel-trailing-slash',
129
+ ];
130
+ const builtInArazzo1Rules = [
131
+ 'sourceDescription-type',
132
+ 'workflowId-unique',
133
+ 'stepId-unique',
134
+ 'sourceDescription-name-unique',
135
+ 'sourceDescriptions-not-empty',
136
+ 'workflow-dependsOn',
137
+ 'parameters-unique',
138
+ 'step-onSuccess-unique',
139
+ 'step-onFailure-unique',
140
+ 'spot-supported-versions',
141
+ 'requestBody-replacements-unique',
142
+ 'no-criteria-xpath',
143
+ 'criteria-unique',
144
+ ];
145
+ const builtInRules = [
146
+ ...builtInOAS2Rules,
147
+ ...builtInOAS3Rules,
148
+ ...builtInAsync2Rules,
149
+ ...builtInAsync3Rules,
150
+ ...builtInArazzo1Rules,
151
+ 'spec', // TODO: depricated in favor of struct
152
+ 'struct',
153
+ ];
154
+ const oas2NodeTypesList = [
155
+ 'Root',
156
+ 'Tag',
157
+ 'TagList',
158
+ 'ExternalDocs',
159
+ 'SecurityRequirement',
160
+ 'SecurityRequirementList',
161
+ 'Info',
162
+ 'Contact',
163
+ 'License',
164
+ 'Paths',
165
+ 'PathItem',
166
+ 'Parameter',
167
+ 'ParameterList',
168
+ 'ParameterItems',
169
+ 'Operation',
170
+ 'Example',
171
+ 'ExamplesMap',
172
+ 'Examples',
173
+ 'Header',
174
+ 'Responses',
175
+ 'Response',
176
+ 'Schema',
177
+ 'Xml',
178
+ 'SchemaProperties',
179
+ 'NamedSchemas',
180
+ 'NamedResponses',
181
+ 'NamedParameters',
182
+ 'NamedSecuritySchemes',
183
+ 'SecurityScheme',
184
+ 'TagGroup',
185
+ 'TagGroups',
186
+ 'EnumDescriptions',
187
+ 'Logo',
188
+ 'XCodeSample',
189
+ 'XCodeSampleList',
190
+ 'XServer',
191
+ 'XServerList',
192
+ ];
193
+ const oas3NodeTypesList = [
194
+ 'Root',
195
+ 'Tag',
196
+ 'TagList',
197
+ 'ExternalDocs',
198
+ 'Server',
199
+ 'ServerList',
200
+ 'ServerVariable',
201
+ 'ServerVariablesMap',
202
+ 'SecurityRequirement',
203
+ 'SecurityRequirementList',
204
+ 'Info',
205
+ 'Contact',
206
+ 'License',
207
+ 'Paths',
208
+ 'PathItem',
209
+ 'Parameter',
210
+ 'ParameterList',
211
+ 'Operation',
212
+ 'Callback',
213
+ 'CallbacksMap',
214
+ 'RequestBody',
215
+ 'MediaTypesMap',
216
+ 'MediaType',
217
+ 'Example',
218
+ 'ExamplesMap',
219
+ 'Encoding',
220
+ 'EncodingMap',
221
+ 'Header',
222
+ 'HeadersMap',
223
+ 'Responses',
224
+ 'Response',
225
+ 'Link',
226
+ 'LinksMap',
227
+ 'Schema',
228
+ 'Xml',
229
+ 'SchemaProperties',
230
+ 'DiscriminatorMapping',
231
+ 'Discriminator',
232
+ 'Components',
233
+ 'NamedSchemas',
234
+ 'NamedResponses',
235
+ 'NamedParameters',
236
+ 'NamedExamples',
237
+ 'NamedRequestBodies',
238
+ 'NamedHeaders',
239
+ 'NamedSecuritySchemes',
240
+ 'NamedLinks',
241
+ 'NamedCallbacks',
242
+ 'ImplicitFlow',
243
+ 'PasswordFlow',
244
+ 'ClientCredentials',
245
+ 'AuthorizationCode',
246
+ 'OAuth2Flows',
247
+ 'SecurityScheme',
248
+ 'TagGroup',
249
+ 'TagGroups',
250
+ 'EnumDescriptions',
251
+ 'Logo',
252
+ 'XCodeSample',
253
+ 'XCodeSampleList',
254
+ 'XUsePkce',
255
+ 'WebhooksMap',
256
+ ];
257
+ const oas3_1NodeTypesList = [
258
+ 'Root',
259
+ 'Schema',
260
+ 'SchemaProperties',
261
+ 'PatternProperties',
262
+ 'Info',
263
+ 'License',
264
+ 'Components',
265
+ 'NamedPathItems',
266
+ 'SecurityScheme',
267
+ 'Operation',
268
+ 'DependentRequired',
269
+ ];
270
+ const ConfigStyleguide = {
271
+ properties: {
272
+ extends: {
273
+ type: 'array',
274
+ items: {
275
+ type: 'string',
276
+ },
277
+ },
278
+ rules: 'Rules',
279
+ oas2Rules: 'Rules',
280
+ oas3_0Rules: 'Rules',
281
+ oas3_1Rules: 'Rules',
282
+ async2Rules: 'Rules',
283
+ arazzo1Rules: 'Rules',
284
+ preprocessors: { type: 'object' },
285
+ oas2Preprocessors: { type: 'object' },
286
+ oas3_0Preprocessors: { type: 'object' },
287
+ oas3_1Preprocessors: { type: 'object' },
288
+ async2Preprocessors: { type: 'object' },
289
+ arazzoPreprocessors: { type: 'object' },
290
+ decorators: { type: 'object' },
291
+ oas2Decorators: { type: 'object' },
292
+ oas3_0Decorators: { type: 'object' },
293
+ oas3_1Decorators: { type: 'object' },
294
+ async2Decorators: { type: 'object' },
295
+ arazzo1Decorators: { type: 'object' },
296
+ },
297
+ };
298
+ const createConfigRoot = (nodeTypes) => ({
299
+ ...nodeTypes.rootRedoclyConfigSchema,
300
+ properties: {
301
+ ...nodeTypes.rootRedoclyConfigSchema.properties,
302
+ ...ConfigStyleguide.properties,
303
+ apis: 'ConfigApis', // Override apis with internal format
304
+ 'features.openapi': 'ConfigReferenceDocs', // deprecated
305
+ 'features.mockServer': 'ConfigMockServer', // deprecated
306
+ organization: { type: 'string' },
307
+ region: { enum: ['us', 'eu'] },
308
+ telemetry: { enum: ['on', 'off'] },
309
+ resolve: {
310
+ properties: {
311
+ http: 'ConfigHTTP',
312
+ doNotResolveExamples: { type: 'boolean' },
313
+ },
314
+ },
315
+ files: {
316
+ type: 'array',
317
+ items: {
318
+ type: 'string',
319
+ },
320
+ },
321
+ },
322
+ });
323
+ const ConfigApis = {
324
+ properties: {},
325
+ additionalProperties: 'ConfigApisProperties',
326
+ };
327
+ const createConfigApisProperties = (nodeTypes) => ({
328
+ ...nodeTypes['rootRedoclyConfigSchema.apis_additionalProperties'],
329
+ properties: {
330
+ ...nodeTypes['rootRedoclyConfigSchema.apis_additionalProperties']?.properties,
331
+ labels: {
332
+ type: 'array',
333
+ items: {
334
+ type: 'string',
335
+ },
336
+ },
337
+ ...ConfigStyleguide.properties,
338
+ 'features.openapi': 'ConfigReferenceDocs', // deprecated
339
+ 'features.mockServer': 'ConfigMockServer', // deprecated
340
+ files: {
341
+ type: 'array',
342
+ items: {
343
+ type: 'string',
344
+ },
345
+ },
346
+ },
347
+ });
348
+ const ConfigHTTP = {
349
+ properties: {
350
+ headers: {
351
+ type: 'array',
352
+ items: {
353
+ type: 'string',
354
+ },
355
+ },
356
+ },
357
+ };
358
+ const Rules = {
359
+ properties: {},
360
+ additionalProperties: (value, key) => {
361
+ if (key.startsWith('rule/')) {
362
+ return 'Assert';
363
+ }
364
+ else if (key.startsWith('assert/')) {
365
+ // keep the old assert/ prefix as an alias
366
+ return 'Assert';
367
+ }
368
+ else if (builtInRules.includes(key) || (0, utils_1.isCustomRuleId)(key)) {
369
+ if (typeof value === 'string') {
370
+ return { enum: ['error', 'warn', 'off'] };
371
+ }
372
+ else {
373
+ return 'ObjectRule';
374
+ }
375
+ }
376
+ else if (key === 'metadata-schema' || key === 'custom-fields-schema') {
377
+ return 'Schema';
378
+ }
379
+ // Otherwise is considered as invalid
380
+ return;
381
+ },
382
+ };
383
+ const ObjectRule = {
384
+ properties: {
385
+ severity: { enum: ['error', 'warn', 'off'] },
386
+ },
387
+ additionalProperties: {},
388
+ required: ['severity'],
389
+ };
390
+ // TODO: add better type tree for this
391
+ const Schema = {
392
+ properties: {},
393
+ additionalProperties: {},
394
+ };
395
+ function createAssertionDefinitionSubject(nodeNames) {
396
+ return {
397
+ properties: {
398
+ type: {
399
+ enum: [...new Set(['any', ...nodeNames, 'SpecExtension'])],
400
+ },
401
+ property: (value) => {
402
+ if (Array.isArray(value)) {
403
+ return { type: 'array', items: { type: 'string' } };
404
+ }
405
+ else if (value === null) {
406
+ return null;
407
+ }
408
+ else {
409
+ return { type: 'string' };
410
+ }
411
+ },
412
+ filterInParentKeys: { type: 'array', items: { type: 'string' } },
413
+ filterOutParentKeys: { type: 'array', items: { type: 'string' } },
414
+ matchParentKeys: { type: 'string' },
415
+ },
416
+ required: ['type'],
417
+ };
418
+ }
419
+ const AssertionDefinitionAssertions = {
420
+ properties: {
421
+ enum: { type: 'array', items: { type: 'string' } },
422
+ pattern: { type: 'string' },
423
+ notPattern: { type: 'string' },
424
+ casing: {
425
+ enum: [
426
+ 'camelCase',
427
+ 'kebab-case',
428
+ 'snake_case',
429
+ 'PascalCase',
430
+ 'MACRO_CASE',
431
+ 'COBOL-CASE',
432
+ 'flatcase',
433
+ ],
434
+ },
435
+ mutuallyExclusive: { type: 'array', items: { type: 'string' } },
436
+ mutuallyRequired: { type: 'array', items: { type: 'string' } },
437
+ required: { type: 'array', items: { type: 'string' } },
438
+ requireAny: { type: 'array', items: { type: 'string' } },
439
+ disallowed: { type: 'array', items: { type: 'string' } },
440
+ defined: { type: 'boolean' },
441
+ // undefined: { type: 'boolean' }, // TODO: Remove `undefined` assertion from codebase overall
442
+ nonEmpty: { type: 'boolean' },
443
+ minLength: { type: 'integer' },
444
+ maxLength: { type: 'integer' },
445
+ ref: (value) => typeof value === 'string' ? { type: 'string' } : { type: 'boolean' },
446
+ const: (value) => {
447
+ if (typeof value === 'string') {
448
+ return { type: 'string' };
449
+ }
450
+ if (typeof value === 'number') {
451
+ return { type: 'number' };
452
+ }
453
+ if (typeof value === 'boolean') {
454
+ return { type: 'boolean' };
455
+ }
456
+ else {
457
+ return;
458
+ }
459
+ },
460
+ },
461
+ additionalProperties: (_value, key) => {
462
+ if (/^\w+\/\w+$/.test(key))
463
+ return { type: 'object' };
464
+ return;
465
+ },
466
+ };
467
+ const AssertDefinition = {
468
+ properties: {
469
+ subject: 'AssertionDefinitionSubject',
470
+ assertions: 'AssertionDefinitionAssertions',
471
+ },
472
+ required: ['subject', 'assertions'],
473
+ };
474
+ const Assert = {
475
+ properties: {
476
+ subject: 'AssertionDefinitionSubject',
477
+ assertions: 'AssertionDefinitionAssertions',
478
+ where: (0, _1.listOf)('AssertDefinition'),
479
+ message: { type: 'string' },
480
+ suggest: { type: 'array', items: { type: 'string' } },
481
+ severity: { enum: ['error', 'warn', 'off'] },
482
+ },
483
+ required: ['subject', 'assertions'],
484
+ };
485
+ const ConfigLanguage = {
486
+ properties: {
487
+ label: { type: 'string' },
488
+ lang: {
489
+ enum: [
490
+ 'curl',
491
+ 'C#',
492
+ 'Go',
493
+ 'Java',
494
+ 'Java8+Apache',
495
+ 'JavaScript',
496
+ 'Node.js',
497
+ 'PHP',
498
+ 'Python',
499
+ 'R',
500
+ 'Ruby',
501
+ ],
502
+ },
503
+ },
504
+ required: ['lang'],
505
+ };
506
+ const ConfigLabels = {
507
+ properties: {
508
+ enum: { type: 'string' },
509
+ enumSingleValue: { type: 'string' },
510
+ enumArray: { type: 'string' },
511
+ default: { type: 'string' },
512
+ deprecated: { type: 'string' },
513
+ example: { type: 'string' },
514
+ examples: { type: 'string' },
515
+ nullable: { type: 'string' },
516
+ recursive: { type: 'string' },
517
+ arrayOf: { type: 'string' },
518
+ webhook: { type: 'string' },
519
+ authorizations: { type: 'string' },
520
+ tryItAuthBasicUsername: { type: 'string' },
521
+ tryItAuthBasicPassword: { type: 'string' },
522
+ },
523
+ };
524
+ const ConfigSidebarLinks = {
525
+ properties: {
526
+ beforeInfo: (0, _1.listOf)('CommonConfigSidebarLinks'),
527
+ end: (0, _1.listOf)('CommonConfigSidebarLinks'),
528
+ },
529
+ };
530
+ const CommonConfigSidebarLinks = {
531
+ properties: {
532
+ label: { type: 'string' },
533
+ link: { type: 'string' },
534
+ target: { type: 'string' },
535
+ },
536
+ required: ['label', 'link'],
537
+ };
538
+ const CommonThemeColors = {
539
+ properties: {
540
+ main: { type: 'string' },
541
+ light: { type: 'string' },
542
+ dark: { type: 'string' },
543
+ contrastText: { type: 'string' },
544
+ },
545
+ };
546
+ const CommonColorProps = {
547
+ properties: {
548
+ backgroundColor: { type: 'string' },
549
+ borderColor: { type: 'string' },
550
+ color: { type: 'string' },
551
+ tabTextColor: { type: 'string' },
552
+ },
553
+ };
554
+ const BorderThemeColors = {
555
+ properties: (0, utils_1.pickObjectProps)(CommonThemeColors.properties, ['light', 'dark']),
556
+ };
557
+ const HttpColors = {
558
+ properties: {
559
+ basic: { type: 'string' },
560
+ delete: { type: 'string' },
561
+ get: { type: 'string' },
562
+ head: { type: 'string' },
563
+ link: { type: 'string' },
564
+ options: { type: 'string' },
565
+ patch: { type: 'string' },
566
+ post: { type: 'string' },
567
+ put: { type: 'string' },
568
+ },
569
+ };
570
+ const ResponseColors = {
571
+ properties: {
572
+ error: 'CommonColorProps',
573
+ info: 'CommonColorProps',
574
+ redirect: 'CommonColorProps',
575
+ success: 'CommonColorProps',
576
+ },
577
+ };
578
+ const SecondaryColors = {
579
+ properties: (0, utils_1.omitObjectProps)(CommonThemeColors.properties, ['dark']),
580
+ };
581
+ const TextThemeColors = {
582
+ properties: {
583
+ primary: { type: 'string' },
584
+ secondary: { type: 'string' },
585
+ light: { type: 'string' },
586
+ },
587
+ };
588
+ const ThemeColors = {
589
+ properties: {
590
+ accent: 'CommonThemeColors',
591
+ border: 'BorderThemeColors',
592
+ error: 'CommonThemeColors',
593
+ http: 'HttpColors',
594
+ primary: 'CommonThemeColors',
595
+ responses: 'ResponseColors',
596
+ secondary: 'SecondaryColors',
597
+ success: 'CommonThemeColors',
598
+ text: 'TextThemeColors',
599
+ tonalOffset: { type: 'number' },
600
+ warning: 'CommonThemeColors',
601
+ },
602
+ };
603
+ const SizeProps = {
604
+ properties: {
605
+ fontSize: { type: 'string' },
606
+ padding: { type: 'string' },
607
+ minWidth: { type: 'string' },
608
+ },
609
+ };
610
+ const Sizes = {
611
+ properties: {
612
+ small: 'SizeProps',
613
+ medium: 'SizeProps',
614
+ large: 'SizeProps',
615
+ xlarge: 'SizeProps',
616
+ },
617
+ };
618
+ const FontConfig = {
619
+ properties: {
620
+ fontFamily: { type: 'string' },
621
+ fontSize: { type: 'string' },
622
+ fontWeight: { type: 'string' },
623
+ lineHeight: { type: 'string' },
624
+ },
625
+ };
626
+ const ButtonsConfig = {
627
+ properties: {
628
+ ...(0, utils_1.omitObjectProps)(FontConfig.properties, ['fontSize', 'lineHeight']),
629
+ borderRadius: { type: 'string' },
630
+ hoverStyle: { type: 'string' },
631
+ boxShadow: { type: 'string' },
632
+ hoverBoxShadow: { type: 'string' },
633
+ sizes: 'Sizes',
634
+ },
635
+ };
636
+ const BadgeFontConfig = {
637
+ properties: (0, utils_1.pickObjectProps)(FontConfig.properties, ['fontSize', 'lineHeight']),
638
+ };
639
+ const BadgeSizes = {
640
+ properties: {
641
+ medium: 'BadgeFontConfig',
642
+ small: 'BadgeFontConfig',
643
+ },
644
+ };
645
+ const HttpBadgesConfig = {
646
+ properties: {
647
+ ...(0, utils_1.omitObjectProps)(FontConfig.properties, ['fontSize', 'lineHeight']),
648
+ borderRadius: { type: 'string' },
649
+ color: { type: 'string' },
650
+ sizes: 'BadgeSizes',
651
+ },
652
+ };
653
+ const LabelControls = {
654
+ properties: {
655
+ top: { type: 'string' },
656
+ width: { type: 'string' },
657
+ height: { type: 'string' },
658
+ },
659
+ };
660
+ const Panels = {
661
+ properties: {
662
+ borderRadius: { type: 'string' },
663
+ backgroundColor: { type: 'string' },
664
+ },
665
+ };
666
+ const TryItButton = {
667
+ properties: {
668
+ fullWidth: { type: 'boolean' },
669
+ },
670
+ };
671
+ const ConfigThemeComponents = {
672
+ properties: {
673
+ buttons: 'ButtonsConfig',
674
+ httpBadges: 'HttpBadgesConfig',
675
+ layoutControls: 'LabelControls',
676
+ panels: 'Panels',
677
+ tryItButton: 'TryItButton',
678
+ tryItSendButton: 'TryItButton',
679
+ },
680
+ };
681
+ const Breakpoints = {
682
+ properties: {
683
+ small: { type: 'string' },
684
+ medium: { type: 'string' },
685
+ large: { type: 'string' },
686
+ },
687
+ };
688
+ const StackedConfig = {
689
+ properties: {
690
+ maxWidth: 'Breakpoints',
691
+ },
692
+ };
693
+ const ThreePanelConfig = {
694
+ properties: {
695
+ maxWidth: 'Breakpoints',
696
+ middlePanelMaxWidth: 'Breakpoints',
697
+ },
698
+ };
699
+ const Layout = {
700
+ properties: {
701
+ showDarkRightPanel: { type: 'boolean' },
702
+ stacked: 'StackedConfig',
703
+ 'three-panel': 'ThreePanelConfig',
704
+ },
705
+ };
706
+ const SchemaColorsConfig = {
707
+ properties: {
708
+ backgroundColor: { type: 'string' },
709
+ border: { type: 'string' },
710
+ },
711
+ };
712
+ const ConfigThemeSchema = {
713
+ properties: {
714
+ breakFieldNames: { type: 'boolean' },
715
+ caretColor: { type: 'string' },
716
+ caretSize: { type: 'string' },
717
+ constraints: 'SchemaColorsConfig',
718
+ defaultDetailsWidth: { type: 'string' },
719
+ examples: 'SchemaColorsConfig',
720
+ labelsTextSize: { type: 'string' },
721
+ linesColor: { type: 'string' },
722
+ nestedBackground: { type: 'string' },
723
+ nestingSpacing: { type: 'string' },
724
+ requireLabelColor: { type: 'string' },
725
+ typeNameColor: { type: 'string' },
726
+ typeTitleColor: { type: 'string' },
727
+ },
728
+ };
729
+ const GroupItemsConfig = {
730
+ properties: {
731
+ subItemsColor: { type: 'string' },
732
+ textTransform: { type: 'string' },
733
+ fontWeight: { type: 'string' },
734
+ },
735
+ };
736
+ const Level1Items = {
737
+ properties: (0, utils_1.pickObjectProps)(GroupItemsConfig.properties, ['textTransform']),
738
+ };
739
+ const SpacingConfig = {
740
+ properties: {
741
+ unit: { type: 'number' },
742
+ paddingHorizontal: { type: 'string' },
743
+ paddingVertical: { type: 'string' },
744
+ offsetTop: { type: 'string' },
745
+ offsetLeft: { type: 'string' },
746
+ offsetNesting: { type: 'string' },
747
+ },
748
+ };
749
+ const Sidebar = {
750
+ properties: {
751
+ ...(0, utils_1.omitObjectProps)(FontConfig.properties, ['fontWeight', 'lineHeight']),
752
+ activeBgColor: { type: 'string' },
753
+ activeTextColor: { type: 'string' },
754
+ backgroundColor: { type: 'string' },
755
+ borderRadius: { type: 'string' },
756
+ breakPath: { type: 'boolean' },
757
+ caretColor: { type: 'string' },
758
+ caretSize: { type: 'string' },
759
+ groupItems: 'GroupItemsConfig',
760
+ level1items: 'Level1Items',
761
+ rightLineColor: { type: 'string' },
762
+ separatorLabelColor: { type: 'string' },
763
+ showAtBreakpoint: { type: 'string' },
764
+ spacing: 'SpacingConfig',
765
+ textColor: { type: 'string' },
766
+ width: { type: 'string' },
767
+ },
768
+ };
769
+ const Heading = {
770
+ properties: {
771
+ ...FontConfig.properties,
772
+ color: { type: 'string' },
773
+ transform: { type: 'string' },
774
+ },
775
+ };
776
+ const CodeConfig = {
777
+ properties: {
778
+ ...FontConfig.properties,
779
+ backgroundColor: { type: 'string' },
780
+ color: { type: 'string' },
781
+ wordBreak: {
782
+ enum: [
783
+ 'break-all',
784
+ 'break-word',
785
+ 'keep-all',
786
+ 'normal',
787
+ 'revert',
788
+ 'unset',
789
+ 'inherit',
790
+ 'initial',
791
+ ],
792
+ },
793
+ wrap: { type: 'boolean' },
794
+ },
795
+ };
796
+ const HeadingsConfig = {
797
+ properties: (0, utils_1.omitObjectProps)(FontConfig.properties, ['fontSize']),
798
+ };
799
+ const LinksConfig = {
800
+ properties: {
801
+ color: { type: 'string' },
802
+ hover: { type: 'string' },
803
+ textDecoration: { type: 'string' },
804
+ hoverTextDecoration: { type: 'string' },
805
+ visited: { type: 'string' },
806
+ },
807
+ };
808
+ const Typography = {
809
+ properties: {
810
+ code: 'CodeConfig',
811
+ fieldName: 'FontConfig',
812
+ ...(0, utils_1.pickObjectProps)(FontConfig.properties, ['fontSize', 'fontFamily']),
813
+ fontWeightBold: { type: 'string' },
814
+ fontWeightLight: { type: 'string' },
815
+ fontWeightRegular: { type: 'string' },
816
+ heading1: 'Heading',
817
+ heading2: 'Heading',
818
+ heading3: 'Heading',
819
+ headings: 'HeadingsConfig',
820
+ lineHeight: { type: 'string' },
821
+ links: 'LinksConfig',
822
+ optimizeSpeed: { type: 'boolean' },
823
+ rightPanelHeading: 'Heading',
824
+ smoothing: { enum: ['auto', 'none', 'antialiased', 'subpixel-antialiased', 'grayscale'] },
825
+ },
826
+ };
827
+ const TokenProps = {
828
+ properties: {
829
+ color: { type: 'string' },
830
+ ...(0, utils_1.omitObjectProps)(FontConfig.properties, ['fontWeight']),
831
+ },
832
+ };
833
+ const CodeBlock = {
834
+ properties: {
835
+ backgroundColor: { type: 'string' },
836
+ borderRadius: { type: 'string' },
837
+ tokens: 'TokenProps',
838
+ },
839
+ };
840
+ const ConfigThemeLogo = {
841
+ properties: {
842
+ gutter: { type: 'string' },
843
+ maxHeight: { type: 'string' },
844
+ maxWidth: { type: 'string' },
845
+ },
846
+ };
847
+ const Fab = {
848
+ properties: {
849
+ backgroundColor: { type: 'string' },
850
+ color: { type: 'string' },
851
+ },
852
+ };
853
+ const ButtonOverrides = {
854
+ properties: {
855
+ custom: { type: 'string' },
856
+ },
857
+ };
858
+ const Overrides = {
859
+ properties: {
860
+ DownloadButton: 'ButtonOverrides',
861
+ NextSectionButton: 'ButtonOverrides',
862
+ },
863
+ };
864
+ const RightPanel = {
865
+ properties: {
866
+ backgroundColor: { type: 'string' },
867
+ panelBackgroundColor: { type: 'string' },
868
+ panelControlsBackgroundColor: { type: 'string' },
869
+ showAtBreakpoint: { type: 'string' },
870
+ textColor: { type: 'string' },
871
+ width: { type: 'string' },
872
+ },
873
+ };
874
+ const Shape = {
875
+ properties: { borderRadius: { type: 'string' } },
876
+ };
877
+ const ThemeSpacing = {
878
+ properties: {
879
+ sectionHorizontal: { type: 'number' },
880
+ sectionVertical: { type: 'number' },
881
+ unit: { type: 'number' },
882
+ },
883
+ };
884
+ const ConfigTheme = {
885
+ properties: {
886
+ breakpoints: 'Breakpoints',
887
+ codeBlock: 'CodeBlock',
888
+ colors: 'ThemeColors',
889
+ components: 'ConfigThemeComponents',
890
+ layout: 'Layout',
891
+ logo: 'ConfigThemeLogo',
892
+ fab: 'Fab',
893
+ overrides: 'Overrides',
894
+ rightPanel: 'RightPanel',
895
+ schema: 'ConfigThemeSchema',
896
+ shape: 'Shape',
897
+ sidebar: 'Sidebar',
898
+ spacing: 'ThemeSpacing',
899
+ typography: 'Typography',
900
+ links: { properties: { color: { type: 'string' } } }, // deprecated
901
+ codeSample: { properties: { backgroundColor: { type: 'string' } } }, // deprecated
902
+ },
903
+ };
904
+ const GenerateCodeSamples = {
905
+ properties: {
906
+ skipOptionalParameters: { type: 'boolean' },
907
+ languages: (0, _1.listOf)('ConfigLanguage'),
908
+ },
909
+ required: ['languages'],
910
+ };
911
+ // TODO: deprecated
912
+ const ConfigReferenceDocs = {
913
+ properties: {
914
+ theme: 'ConfigTheme',
915
+ corsProxyUrl: { type: 'string' },
916
+ ctrlFHijack: { type: 'boolean' },
917
+ defaultSampleLanguage: { type: 'string' },
918
+ disableDeepLinks: { type: 'boolean' },
919
+ disableSearch: { type: 'boolean' },
920
+ disableSidebar: { type: 'boolean' },
921
+ downloadDefinitionUrl: { type: 'string' },
922
+ expandDefaultServerVariables: { type: 'boolean' },
923
+ enumSkipQuotes: { type: 'boolean' },
924
+ expandDefaultRequest: { type: 'boolean' },
925
+ expandDefaultResponse: { type: 'boolean' },
926
+ expandResponses: { type: 'string' },
927
+ expandSingleSchemaField: { type: 'boolean' },
928
+ generateCodeSamples: 'GenerateCodeSamples',
929
+ generatedPayloadSamplesMaxDepth: { type: 'number' },
930
+ hideDownloadButton: { type: 'boolean' },
931
+ hideHostname: { type: 'boolean' },
932
+ hideInfoSection: { type: 'boolean' },
933
+ hideLoading: { type: 'boolean' },
934
+ hideLogo: { type: 'boolean' },
935
+ hideRequestPayloadSample: { type: 'boolean' },
936
+ hideRightPanel: { type: 'boolean' },
937
+ hideSchemaPattern: { type: 'boolean' },
938
+ hideSchemaTitles: { type: 'boolean' },
939
+ hideSingleRequestSampleTab: { type: 'boolean' },
940
+ hideSecuritySection: { type: 'boolean' },
941
+ hideTryItPanel: { type: 'boolean' },
942
+ hideFab: { type: 'boolean' },
943
+ hideOneOfDescription: { type: 'boolean' },
944
+ htmlTemplate: { type: 'string' },
945
+ jsonSampleExpandLevel: (value) => {
946
+ if (typeof value === 'number') {
947
+ return { type: 'number', minimum: 1 };
948
+ }
949
+ else {
950
+ return { type: 'string' };
951
+ }
952
+ },
953
+ labels: 'ConfigLabels',
954
+ layout: { enum: ['stacked', 'three-panel'] },
955
+ maxDisplayedEnumValues: { type: 'number' },
956
+ menuToggle: { type: 'boolean' },
957
+ nativeScrollbars: { type: 'boolean' },
958
+ noAutoAuth: { type: 'boolean' }, // deprecated
959
+ oAuth2RedirectURI: { type: 'string' },
960
+ onDeepLinkClick: { type: 'object' },
961
+ onlyRequiredInSamples: { type: 'boolean' },
962
+ pagination: { enum: ['none', 'section', 'item'] },
963
+ pathInMiddlePanel: { type: 'boolean' },
964
+ payloadSampleIdx: { type: 'number', minimum: 0 },
965
+ requestInterceptor: { type: 'object' },
966
+ requiredPropsFirst: { type: 'boolean' },
967
+ routingBasePath: { type: 'string' },
968
+ routingStrategy: { type: 'string' }, // deprecated
969
+ samplesTabsMaxCount: { type: 'number' },
970
+ schemaExpansionLevel: (value) => {
971
+ if (typeof value === 'number') {
972
+ return { type: 'number', minimum: 0 };
973
+ }
974
+ else {
975
+ return { type: 'string' };
976
+ }
977
+ },
978
+ schemaDefinitionsTagName: { type: 'string' },
979
+ minCharacterLengthToInitSearch: { type: 'number', minimum: 1 },
980
+ maxResponseHeadersToShowInTryIt: { type: 'number', minimum: 0 },
981
+ scrollYOffset: (value) => {
982
+ if (typeof value === 'number') {
983
+ return { type: 'number' };
984
+ }
985
+ else {
986
+ return { type: 'string' };
987
+ }
988
+ },
989
+ searchAutoExpand: { type: 'boolean' },
990
+ searchFieldLevelBoost: { type: 'number', minimum: 0 },
991
+ searchMaxDepth: { type: 'number', minimum: 1 },
992
+ searchMode: { enum: ['default', 'path-only'] },
993
+ searchOperationTitleBoost: { type: 'number' },
994
+ searchTagTitleBoost: { type: 'number' },
995
+ sendXUserAgentInTryIt: { type: 'boolean' },
996
+ showChangeLayoutButton: { type: 'boolean' },
997
+ showConsole: { type: 'boolean' }, // deprecated
998
+ showExtensions: (value) => {
999
+ if (typeof value === 'boolean') {
1000
+ return { type: 'boolean' };
1001
+ }
1002
+ else {
1003
+ return {
1004
+ type: 'array',
1005
+ items: {
1006
+ type: 'string',
1007
+ },
1008
+ };
1009
+ }
1010
+ },
1011
+ showNextButton: { type: 'boolean' },
1012
+ showRightPanelToggle: { type: 'boolean' },
1013
+ showSecuritySchemeType: { type: 'boolean' },
1014
+ showWebhookVerb: { type: 'boolean' },
1015
+ showObjectSchemaExamples: { type: 'boolean' },
1016
+ disableTryItRequestUrlEncoding: { type: 'boolean' },
1017
+ sidebarLinks: 'ConfigSidebarLinks',
1018
+ sideNavStyle: { enum: ['summary-only', 'path-first', 'id-only', 'path-only'] },
1019
+ simpleOneOfTypeLabel: { type: 'boolean' },
1020
+ sortEnumValuesAlphabetically: { type: 'boolean' },
1021
+ sortOperationsAlphabetically: { type: 'boolean' },
1022
+ sortPropsAlphabetically: { type: 'boolean' },
1023
+ sortTagsAlphabetically: { type: 'boolean' },
1024
+ suppressWarnings: { type: 'boolean' }, // deprecated
1025
+ unstable_externalDescription: { type: 'boolean' }, // deprecated
1026
+ unstable_ignoreMimeParameters: { type: 'boolean' },
1027
+ untrustedDefinition: { type: 'boolean' },
1028
+ mockServer: {
1029
+ properties: {
1030
+ url: { type: 'string' },
1031
+ position: { enum: ['first', 'last', 'replace', 'off'] },
1032
+ description: { type: 'string' },
1033
+ },
1034
+ },
1035
+ showAccessMode: { type: 'boolean' },
1036
+ preserveOriginalExtensionsName: { type: 'boolean' },
1037
+ markdownHeadingsAnchorLevel: { type: 'number' },
1038
+ },
1039
+ additionalProperties: {},
1040
+ };
1041
+ const ConfigMockServer = {
1042
+ properties: {
1043
+ strictExamples: { type: 'boolean' },
1044
+ errorIfForcedExampleNotFound: { type: 'boolean' },
1045
+ },
1046
+ };
1047
+ function createConfigTypes(extraSchemas, config) {
1048
+ const nodeNames = Object.values(oas_types_1.SpecVersion).flatMap((version) => {
1049
+ const types = config?.styleguide
1050
+ ? config.styleguide.extendTypes((0, oas_types_1.getTypes)(version), version)
1051
+ : (0, oas_types_1.getTypes)(version);
1052
+ return Object.keys(types);
1053
+ });
1054
+ // Create types based on external schemas
1055
+ const nodeTypes = (0, json_schema_adapter_1.getNodeTypesFromJSONSchema)('rootRedoclyConfigSchema', extraSchemas);
1056
+ return {
1057
+ ...CoreConfigTypes,
1058
+ ConfigRoot: createConfigRoot(nodeTypes), // This is the REAL config root type
1059
+ ConfigApisProperties: createConfigApisProperties(nodeTypes),
1060
+ AssertionDefinitionSubject: createAssertionDefinitionSubject(nodeNames),
1061
+ ...nodeTypes,
1062
+ };
1063
+ }
1064
+ const CoreConfigTypes = {
1065
+ Assert,
1066
+ ConfigApis,
1067
+ ConfigStyleguide,
1068
+ ConfigReferenceDocs,
1069
+ ConfigMockServer,
1070
+ ConfigHTTP,
1071
+ ConfigLanguage,
1072
+ ConfigLabels,
1073
+ ConfigSidebarLinks,
1074
+ CommonConfigSidebarLinks,
1075
+ ConfigTheme,
1076
+ AssertDefinition,
1077
+ ThemeColors,
1078
+ CommonThemeColors,
1079
+ BorderThemeColors,
1080
+ HttpColors,
1081
+ ResponseColors,
1082
+ SecondaryColors,
1083
+ TextThemeColors,
1084
+ Sizes,
1085
+ ButtonsConfig,
1086
+ CommonColorProps,
1087
+ BadgeFontConfig,
1088
+ BadgeSizes,
1089
+ HttpBadgesConfig,
1090
+ LabelControls,
1091
+ Panels,
1092
+ TryItButton,
1093
+ Breakpoints,
1094
+ StackedConfig,
1095
+ ThreePanelConfig,
1096
+ SchemaColorsConfig,
1097
+ SizeProps,
1098
+ Level1Items,
1099
+ SpacingConfig,
1100
+ FontConfig,
1101
+ CodeConfig,
1102
+ HeadingsConfig,
1103
+ LinksConfig,
1104
+ TokenProps,
1105
+ CodeBlock,
1106
+ ConfigThemeLogo,
1107
+ Fab,
1108
+ ButtonOverrides,
1109
+ Overrides,
1110
+ ObjectRule,
1111
+ Schema,
1112
+ RightPanel,
1113
+ Rules,
1114
+ Shape,
1115
+ ThemeSpacing,
1116
+ GenerateCodeSamples,
1117
+ GroupItemsConfig,
1118
+ ConfigThemeComponents,
1119
+ Layout,
1120
+ ConfigThemeSchema,
1121
+ Sidebar,
1122
+ Heading,
1123
+ Typography,
1124
+ AssertionDefinitionAssertions,
1125
+ };
1126
+ exports.ConfigTypes = createConfigTypes(config_1.rootRedoclyConfigSchema);