@scalar/openapi-parser 0.10.16 → 0.11.0

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 (339) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +0 -27
  3. package/dist/configuration/index.js +19 -22
  4. package/dist/configuration/index.js.map +7 -0
  5. package/dist/declarations.d.js +1 -0
  6. package/dist/declarations.d.js.map +7 -0
  7. package/dist/index.d.ts +4 -4
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +5 -29
  10. package/dist/index.js.map +7 -0
  11. package/dist/lib/Validator/Validator.d.ts +2 -2
  12. package/dist/lib/Validator/Validator.d.ts.map +1 -1
  13. package/dist/lib/Validator/Validator.js +99 -119
  14. package/dist/lib/Validator/Validator.js.map +7 -0
  15. package/dist/lib/Validator/Validator.test.js +8 -0
  16. package/dist/lib/Validator/Validator.test.js.map +7 -0
  17. package/dist/lib/Validator/index.d.ts +2 -2
  18. package/dist/lib/Validator/index.d.ts.map +1 -1
  19. package/dist/lib/Validator/index.js +3 -0
  20. package/dist/lib/Validator/index.js.map +7 -0
  21. package/dist/plugins/fetch-urls/fetchUrls.d.ts +1 -1
  22. package/dist/plugins/fetch-urls/fetchUrls.d.ts.map +1 -1
  23. package/dist/plugins/fetch-urls/fetchUrls.js +36 -39
  24. package/dist/plugins/fetch-urls/fetchUrls.js.map +7 -0
  25. package/dist/plugins/fetch-urls/fetchUrls.test.js +50 -0
  26. package/dist/plugins/fetch-urls/fetchUrls.test.js.map +7 -0
  27. package/dist/plugins/fetch-urls/index.d.ts +1 -1
  28. package/dist/plugins/fetch-urls/index.d.ts.map +1 -1
  29. package/dist/plugins/fetch-urls/index.js +2 -1
  30. package/dist/plugins/fetch-urls/index.js.map +7 -0
  31. package/dist/plugins/read-files/index.d.ts +1 -1
  32. package/dist/plugins/read-files/index.d.ts.map +1 -1
  33. package/dist/plugins/read-files/index.js +2 -1
  34. package/dist/plugins/read-files/index.js.map +7 -0
  35. package/dist/plugins/read-files/readFiles.d.ts +1 -1
  36. package/dist/plugins/read-files/readFiles.d.ts.map +1 -1
  37. package/dist/plugins/read-files/readFiles.js +50 -55
  38. package/dist/plugins/read-files/readFiles.js.map +7 -0
  39. package/dist/plugins/read-files/readFiles.test.js +20 -0
  40. package/dist/plugins/read-files/readFiles.test.js.map +7 -0
  41. package/dist/polyfills/index.d.ts +1 -1
  42. package/dist/polyfills/index.d.ts.map +1 -1
  43. package/dist/polyfills/index.js +5 -0
  44. package/dist/polyfills/index.js.map +7 -0
  45. package/dist/polyfills/path.js +155 -98
  46. package/dist/polyfills/path.js.map +7 -0
  47. package/dist/schemas/v2.0/schema.d.ts +1405 -0
  48. package/dist/schemas/v2.0/schema.d.ts.map +1 -0
  49. package/dist/schemas/v2.0/schema.js +1463 -0
  50. package/dist/schemas/v2.0/schema.js.map +7 -0
  51. package/dist/schemas/v3.0/schema.d.ts +1264 -0
  52. package/dist/schemas/v3.0/schema.d.ts.map +1 -0
  53. package/dist/schemas/v3.0/schema.js +1493 -0
  54. package/dist/schemas/v3.0/schema.js.map +7 -0
  55. package/dist/schemas/v3.1/schema.d.ts +1225 -0
  56. package/dist/schemas/v3.1/schema.d.ts.map +1 -0
  57. package/dist/schemas/v3.1/schema.js +1296 -0
  58. package/dist/schemas/v3.1/schema.js.map +7 -0
  59. package/dist/types/index.d.ts +1 -1
  60. package/dist/types/index.d.ts.map +1 -1
  61. package/dist/types/index.js +1 -0
  62. package/dist/types/index.js.map +7 -0
  63. package/dist/utils/betterAjvErrors/helpers.js +88 -93
  64. package/dist/utils/betterAjvErrors/helpers.js.map +7 -0
  65. package/dist/utils/betterAjvErrors/index.js +14 -13
  66. package/dist/utils/betterAjvErrors/index.js.map +7 -0
  67. package/dist/utils/betterAjvErrors/json/get-meta-from-path.d.ts +2 -0
  68. package/dist/utils/betterAjvErrors/json/get-meta-from-path.d.ts.map +1 -0
  69. package/dist/utils/betterAjvErrors/json/get-meta-from-path.js +27 -0
  70. package/dist/utils/betterAjvErrors/json/get-meta-from-path.js.map +7 -0
  71. package/dist/utils/betterAjvErrors/json/index.d.ts +2 -0
  72. package/dist/utils/betterAjvErrors/json/index.d.ts.map +1 -0
  73. package/dist/utils/betterAjvErrors/json/index.js +5 -0
  74. package/dist/utils/betterAjvErrors/json/index.js.map +7 -0
  75. package/dist/utils/betterAjvErrors/json/utils.d.ts +2 -0
  76. package/dist/utils/betterAjvErrors/json/utils.d.ts.map +1 -0
  77. package/dist/utils/betterAjvErrors/json/utils.js +11 -0
  78. package/dist/utils/betterAjvErrors/json/utils.js.map +7 -0
  79. package/dist/utils/betterAjvErrors/utils.js +21 -14
  80. package/dist/utils/betterAjvErrors/utils.js.map +7 -0
  81. package/dist/utils/betterAjvErrors/validation-errors/additional-prop.d.ts +10 -0
  82. package/dist/utils/betterAjvErrors/validation-errors/additional-prop.d.ts.map +1 -0
  83. package/dist/utils/betterAjvErrors/validation-errors/additional-prop.js +8 -9
  84. package/dist/utils/betterAjvErrors/validation-errors/additional-prop.js.map +7 -0
  85. package/dist/utils/betterAjvErrors/validation-errors/base.d.ts +23 -0
  86. package/dist/utils/betterAjvErrors/validation-errors/base.d.ts.map +1 -0
  87. package/dist/utils/betterAjvErrors/validation-errors/base.js +6 -10
  88. package/dist/utils/betterAjvErrors/validation-errors/base.js.map +7 -0
  89. package/dist/utils/betterAjvErrors/validation-errors/default.d.ts +10 -0
  90. package/dist/utils/betterAjvErrors/validation-errors/default.d.ts.map +1 -0
  91. package/dist/utils/betterAjvErrors/validation-errors/default.js +8 -9
  92. package/dist/utils/betterAjvErrors/validation-errors/default.js.map +7 -0
  93. package/dist/utils/betterAjvErrors/validation-errors/enum.d.ts +11 -0
  94. package/dist/utils/betterAjvErrors/validation-errors/enum.d.ts.map +1 -0
  95. package/dist/utils/betterAjvErrors/validation-errors/enum.js +19 -29
  96. package/dist/utils/betterAjvErrors/validation-errors/enum.js.map +7 -0
  97. package/dist/utils/betterAjvErrors/validation-errors/index.d.ts +7 -0
  98. package/dist/utils/betterAjvErrors/validation-errors/index.d.ts.map +1 -0
  99. package/dist/utils/betterAjvErrors/validation-errors/index.js +15 -0
  100. package/dist/utils/betterAjvErrors/validation-errors/index.js.map +7 -0
  101. package/dist/utils/betterAjvErrors/validation-errors/pattern.d.ts +10 -0
  102. package/dist/utils/betterAjvErrors/validation-errors/pattern.d.ts.map +1 -0
  103. package/dist/utils/betterAjvErrors/validation-errors/pattern.js +8 -9
  104. package/dist/utils/betterAjvErrors/validation-errors/pattern.js.map +7 -0
  105. package/dist/utils/betterAjvErrors/validation-errors/required.d.ts +10 -0
  106. package/dist/utils/betterAjvErrors/validation-errors/required.d.ts.map +1 -0
  107. package/dist/utils/betterAjvErrors/validation-errors/required.js +8 -9
  108. package/dist/utils/betterAjvErrors/validation-errors/required.js.map +7 -0
  109. package/dist/utils/betterAjvErrors/validation-errors/unevaluated-prop.d.ts +10 -0
  110. package/dist/utils/betterAjvErrors/validation-errors/unevaluated-prop.d.ts.map +1 -0
  111. package/dist/utils/betterAjvErrors/validation-errors/unevaluated-prop.js +8 -9
  112. package/dist/utils/betterAjvErrors/validation-errors/unevaluated-prop.js.map +7 -0
  113. package/dist/utils/dereference.d.ts +2 -2
  114. package/dist/utils/dereference.d.ts.map +1 -1
  115. package/dist/utils/dereference.js +17 -19
  116. package/dist/utils/dereference.js.map +7 -0
  117. package/dist/utils/dereference.test.js +300 -0
  118. package/dist/utils/dereference.test.js.map +7 -0
  119. package/dist/utils/details.d.ts +1 -1
  120. package/dist/utils/details.d.ts.map +1 -1
  121. package/dist/utils/details.js +26 -28
  122. package/dist/utils/details.js.map +7 -0
  123. package/dist/utils/errors.test.js +48 -0
  124. package/dist/utils/errors.test.js.map +7 -0
  125. package/dist/utils/escapeJsonPointer.js +5 -8
  126. package/dist/utils/escapeJsonPointer.js.map +7 -0
  127. package/dist/utils/escapeJsonPointer.test.js +11 -0
  128. package/dist/utils/escapeJsonPointer.test.js.map +7 -0
  129. package/dist/utils/filter.d.ts +1 -1
  130. package/dist/utils/filter.d.ts.map +1 -1
  131. package/dist/utils/filter.js +13 -15
  132. package/dist/utils/filter.js.map +7 -0
  133. package/dist/utils/getEntrypoint.d.ts +1 -1
  134. package/dist/utils/getEntrypoint.d.ts.map +1 -1
  135. package/dist/utils/getEntrypoint.js +5 -6
  136. package/dist/utils/getEntrypoint.js.map +7 -0
  137. package/dist/utils/getEntrypoint.test.js +18 -0
  138. package/dist/utils/getEntrypoint.test.js.map +7 -0
  139. package/dist/utils/getListOfReferences.d.ts +1 -1
  140. package/dist/utils/getListOfReferences.d.ts.map +1 -1
  141. package/dist/utils/getListOfReferences.js +15 -22
  142. package/dist/utils/getListOfReferences.js.map +7 -0
  143. package/dist/utils/getSegmentsFromPath.js +8 -15
  144. package/dist/utils/getSegmentsFromPath.js.map +7 -0
  145. package/dist/utils/getSegmentsFromPath.test.js +13 -0
  146. package/dist/utils/getSegmentsFromPath.test.js.map +7 -0
  147. package/dist/utils/index.d.ts +26 -26
  148. package/dist/utils/index.d.ts.map +1 -1
  149. package/dist/utils/index.js +27 -0
  150. package/dist/utils/index.js.map +7 -0
  151. package/dist/utils/isFilesystem.d.ts +2 -1
  152. package/dist/utils/isFilesystem.d.ts.map +1 -1
  153. package/dist/utils/isFilesystem.js +5 -9
  154. package/dist/utils/isFilesystem.js.map +7 -0
  155. package/dist/utils/isJson.js +10 -9
  156. package/dist/utils/isJson.js.map +7 -0
  157. package/dist/utils/isObject.js +5 -6
  158. package/dist/utils/isObject.js.map +7 -0
  159. package/dist/utils/isObject.test.js +23 -0
  160. package/dist/utils/isObject.test.js.map +7 -0
  161. package/dist/utils/isYaml.js +16 -17
  162. package/dist/utils/isYaml.js.map +7 -0
  163. package/dist/utils/load/index.d.ts +1 -1
  164. package/dist/utils/load/index.d.ts.map +1 -1
  165. package/dist/utils/load/index.js +2 -0
  166. package/dist/utils/load/index.js.map +7 -0
  167. package/dist/utils/load/load.d.ts +1 -1
  168. package/dist/utils/load/load.d.ts.map +1 -1
  169. package/dist/utils/load/load.js +89 -110
  170. package/dist/utils/load/load.js.map +7 -0
  171. package/dist/utils/load/load.test.js +361 -0
  172. package/dist/utils/load/load.test.js.map +7 -0
  173. package/dist/utils/makeFilesystem.d.ts +1 -1
  174. package/dist/utils/makeFilesystem.d.ts.map +1 -1
  175. package/dist/utils/makeFilesystem.js +20 -22
  176. package/dist/utils/makeFilesystem.js.map +7 -0
  177. package/dist/utils/makeFilesystem.test.js +15 -0
  178. package/dist/utils/makeFilesystem.test.js.map +7 -0
  179. package/dist/utils/normalize.d.ts +1 -1
  180. package/dist/utils/normalize.d.ts.map +1 -1
  181. package/dist/utils/normalize.js +22 -27
  182. package/dist/utils/normalize.js.map +7 -0
  183. package/dist/utils/normalize.test.js +88 -0
  184. package/dist/utils/normalize.test.js.map +7 -0
  185. package/dist/utils/openapi/actions/details.d.ts +2 -2
  186. package/dist/utils/openapi/actions/details.d.ts.map +1 -1
  187. package/dist/utils/openapi/actions/details.js +9 -11
  188. package/dist/utils/openapi/actions/details.js.map +7 -0
  189. package/dist/utils/openapi/actions/files.d.ts +1 -1
  190. package/dist/utils/openapi/actions/files.d.ts.map +1 -1
  191. package/dist/utils/openapi/actions/files.js +7 -9
  192. package/dist/utils/openapi/actions/files.js.map +7 -0
  193. package/dist/utils/openapi/actions/get.d.ts +1 -1
  194. package/dist/utils/openapi/actions/get.d.ts.map +1 -1
  195. package/dist/utils/openapi/actions/get.js +9 -11
  196. package/dist/utils/openapi/actions/get.js.map +7 -0
  197. package/dist/utils/openapi/actions/toJson.d.ts +1 -1
  198. package/dist/utils/openapi/actions/toJson.d.ts.map +1 -1
  199. package/dist/utils/openapi/actions/toJson.js +9 -11
  200. package/dist/utils/openapi/actions/toJson.js.map +7 -0
  201. package/dist/utils/openapi/actions/toYaml.d.ts +1 -1
  202. package/dist/utils/openapi/actions/toYaml.d.ts.map +1 -1
  203. package/dist/utils/openapi/actions/toYaml.js +9 -11
  204. package/dist/utils/openapi/actions/toYaml.js.map +7 -0
  205. package/dist/utils/openapi/commands/dereferenceCommand.d.ts +5 -5
  206. package/dist/utils/openapi/commands/dereferenceCommand.d.ts.map +1 -1
  207. package/dist/utils/openapi/commands/dereferenceCommand.js +25 -27
  208. package/dist/utils/openapi/commands/dereferenceCommand.js.map +7 -0
  209. package/dist/utils/openapi/commands/filterCommand.d.ts +9 -9
  210. package/dist/utils/openapi/commands/filterCommand.d.ts.map +1 -1
  211. package/dist/utils/openapi/commands/filterCommand.js +24 -26
  212. package/dist/utils/openapi/commands/filterCommand.js.map +7 -0
  213. package/dist/utils/openapi/commands/loadCommand.d.ts +994 -994
  214. package/dist/utils/openapi/commands/loadCommand.d.ts.map +1 -1
  215. package/dist/utils/openapi/commands/loadCommand.js +40 -42
  216. package/dist/utils/openapi/commands/loadCommand.js.map +7 -0
  217. package/dist/utils/openapi/commands/upgradeCommand.d.ts +311 -311
  218. package/dist/utils/openapi/commands/upgradeCommand.d.ts.map +1 -1
  219. package/dist/utils/openapi/commands/upgradeCommand.js +27 -29
  220. package/dist/utils/openapi/commands/upgradeCommand.js.map +7 -0
  221. package/dist/utils/openapi/commands/validateCommand.d.ts +311 -311
  222. package/dist/utils/openapi/commands/validateCommand.d.ts.map +1 -1
  223. package/dist/utils/openapi/commands/validateCommand.js +31 -33
  224. package/dist/utils/openapi/commands/validateCommand.js.map +7 -0
  225. package/dist/utils/openapi/index.d.ts +1 -1
  226. package/dist/utils/openapi/index.d.ts.map +1 -1
  227. package/dist/utils/openapi/index.js +2 -0
  228. package/dist/utils/openapi/index.js.map +7 -0
  229. package/dist/utils/openapi/openapi.d.ts +702 -700
  230. package/dist/utils/openapi/openapi.d.ts.map +1 -1
  231. package/dist/utils/openapi/openapi.js +13 -16
  232. package/dist/utils/openapi/openapi.js.map +7 -0
  233. package/dist/utils/openapi/openapi.test-d.js +14 -0
  234. package/dist/utils/openapi/openapi.test-d.js.map +7 -0
  235. package/dist/utils/openapi/openapi.test.js +309 -0
  236. package/dist/utils/openapi/openapi.test.js.map +7 -0
  237. package/dist/utils/openapi/utils/queueTask.d.ts +1 -1
  238. package/dist/utils/openapi/utils/queueTask.d.ts.map +1 -1
  239. package/dist/utils/openapi/utils/queueTask.js +8 -9
  240. package/dist/utils/openapi/utils/queueTask.js.map +7 -0
  241. package/dist/utils/openapi/utils/workThroughQueue.d.ts +1 -1
  242. package/dist/utils/openapi/utils/workThroughQueue.d.ts.map +1 -1
  243. package/dist/utils/openapi/utils/workThroughQueue.js +49 -64
  244. package/dist/utils/openapi/utils/workThroughQueue.js.map +7 -0
  245. package/dist/utils/openapi/utils/workThroughQueue.test.js +244 -0
  246. package/dist/utils/openapi/utils/workThroughQueue.test.js.map +7 -0
  247. package/dist/utils/resolveReferences.d.ts +1 -1
  248. package/dist/utils/resolveReferences.d.ts.map +1 -1
  249. package/dist/utils/resolveReferences.js +91 -139
  250. package/dist/utils/resolveReferences.js.map +7 -0
  251. package/dist/utils/resolveReferences.test.js +567 -0
  252. package/dist/utils/resolveReferences.test.js.map +7 -0
  253. package/dist/utils/toJson.d.ts +1 -1
  254. package/dist/utils/toJson.d.ts.map +1 -1
  255. package/dist/utils/toJson.js +4 -2
  256. package/dist/utils/toJson.js.map +7 -0
  257. package/dist/utils/toYaml.d.ts +1 -1
  258. package/dist/utils/toYaml.d.ts.map +1 -1
  259. package/dist/utils/toYaml.js +5 -4
  260. package/dist/utils/toYaml.js.map +7 -0
  261. package/dist/utils/transform/index.d.ts +1 -1
  262. package/dist/utils/transform/index.d.ts.map +1 -1
  263. package/dist/utils/transform/index.js +2 -0
  264. package/dist/utils/transform/index.js.map +7 -0
  265. package/dist/utils/transform/sanitize.d.ts +3 -3
  266. package/dist/utils/transform/sanitize.d.ts.map +1 -1
  267. package/dist/utils/transform/sanitize.js +22 -21
  268. package/dist/utils/transform/sanitize.js.map +7 -0
  269. package/dist/utils/transform/sanitize.test.js +148 -0
  270. package/dist/utils/transform/sanitize.test.js.map +7 -0
  271. package/dist/utils/transform/utils/addInfoObject.d.ts +1 -1
  272. package/dist/utils/transform/utils/addInfoObject.d.ts.map +1 -1
  273. package/dist/utils/transform/utils/addInfoObject.js +14 -10
  274. package/dist/utils/transform/utils/addInfoObject.js.map +7 -0
  275. package/dist/utils/transform/utils/addLatestOpenApiVersion.d.ts +1 -1
  276. package/dist/utils/transform/utils/addLatestOpenApiVersion.d.ts.map +1 -1
  277. package/dist/utils/transform/utils/addLatestOpenApiVersion.js +8 -5
  278. package/dist/utils/transform/utils/addLatestOpenApiVersion.js.map +7 -0
  279. package/dist/utils/transform/utils/addMissingTags.d.ts +1 -1
  280. package/dist/utils/transform/utils/addMissingTags.d.ts.map +1 -1
  281. package/dist/utils/transform/utils/addMissingTags.js +26 -27
  282. package/dist/utils/transform/utils/addMissingTags.js.map +7 -0
  283. package/dist/utils/transform/utils/normalizeSecuritySchemes.d.ts +1 -1
  284. package/dist/utils/transform/utils/normalizeSecuritySchemes.d.ts.map +1 -1
  285. package/dist/utils/transform/utils/normalizeSecuritySchemes.js +36 -40
  286. package/dist/utils/transform/utils/normalizeSecuritySchemes.js.map +7 -0
  287. package/dist/utils/transform/utils/rejectSwaggerDocuments.d.ts +1 -1
  288. package/dist/utils/transform/utils/rejectSwaggerDocuments.d.ts.map +1 -1
  289. package/dist/utils/transform/utils/rejectSwaggerDocuments.js +8 -6
  290. package/dist/utils/transform/utils/rejectSwaggerDocuments.js.map +7 -0
  291. package/dist/utils/transformErrors.d.ts +1 -1
  292. package/dist/utils/transformErrors.d.ts.map +1 -1
  293. package/dist/utils/transformErrors.js +18 -21
  294. package/dist/utils/transformErrors.js.map +7 -0
  295. package/dist/utils/transformErrors.test.js +17 -0
  296. package/dist/utils/transformErrors.test.js.map +7 -0
  297. package/dist/utils/traverse.d.ts +3 -3
  298. package/dist/utils/traverse.d.ts.map +1 -1
  299. package/dist/utils/traverse.js +22 -23
  300. package/dist/utils/traverse.js.map +7 -0
  301. package/dist/utils/traverse.test.js +68 -0
  302. package/dist/utils/traverse.test.js.map +7 -0
  303. package/dist/utils/unescapeJsonPointer.js +5 -9
  304. package/dist/utils/unescapeJsonPointer.js.map +7 -0
  305. package/dist/utils/unescapeJsonPointer.test.js +19 -0
  306. package/dist/utils/unescapeJsonPointer.test.js.map +7 -0
  307. package/dist/utils/upgrade.bench.d.ts +2 -0
  308. package/dist/utils/upgrade.bench.d.ts.map +1 -0
  309. package/dist/utils/upgrade.bench.js +31 -0
  310. package/dist/utils/upgrade.bench.js.map +7 -0
  311. package/dist/utils/upgrade.d.ts +1 -1
  312. package/dist/utils/upgrade.d.ts.map +1 -1
  313. package/dist/utils/upgrade.js +28 -22
  314. package/dist/utils/upgrade.js.map +7 -0
  315. package/dist/utils/upgrade.test-d.js +16 -0
  316. package/dist/utils/upgrade.test-d.js.map +7 -0
  317. package/dist/utils/upgrade.test.js +57 -0
  318. package/dist/utils/upgrade.test.js.map +7 -0
  319. package/dist/utils/upgradeFromThreeToThreeOne.d.ts +3 -3
  320. package/dist/utils/upgradeFromThreeToThreeOne.d.ts.map +1 -1
  321. package/dist/utils/upgradeFromThreeToThreeOne.js +107 -144
  322. package/dist/utils/upgradeFromThreeToThreeOne.js.map +7 -0
  323. package/dist/utils/upgradeFromThreeToThreeOne.test.js +462 -0
  324. package/dist/utils/upgradeFromThreeToThreeOne.test.js.map +7 -0
  325. package/dist/utils/upgradeFromTwoToThree.d.ts.map +1 -1
  326. package/dist/utils/upgradeFromTwoToThree.js +212 -219
  327. package/dist/utils/upgradeFromTwoToThree.js.map +7 -0
  328. package/dist/utils/upgradeFromTwoToThree.test.js +589 -0
  329. package/dist/utils/upgradeFromTwoToThree.test.js.map +7 -0
  330. package/dist/utils/validate.d.ts +1 -1
  331. package/dist/utils/validate.d.ts.map +1 -1
  332. package/dist/utils/validate.js +14 -16
  333. package/dist/utils/validate.js.map +7 -0
  334. package/dist/utils/validate.test.js +64 -0
  335. package/dist/utils/validate.test.js.map +7 -0
  336. package/package.json +7 -8
  337. package/dist/schemas/v2.0/schema.json.js +0 -1623
  338. package/dist/schemas/v3.0/schema.json.js +0 -1673
  339. package/dist/schemas/v3.1/schema.json.js +0 -1451
@@ -0,0 +1,567 @@
1
+ import SwaggerParser from "@apidevtools/swagger-parser";
2
+ import path from "node:path";
3
+ import { describe, expect, it } from "vitest";
4
+ import { readFiles } from "../plugins/read-files/readFiles.js";
5
+ import { load } from "./load/load.js";
6
+ import { resolveReferences } from "./resolveReferences.js";
7
+ const EXAMPLE_FILE = path.join(new URL(import.meta.url).pathname, "../../../tests/filesystem/api/openapi.yaml");
8
+ describe("resolveReferences", () => {
9
+ it("resolves a single reference", async () => {
10
+ const specification = {
11
+ openapi: "3.1.0",
12
+ info: {},
13
+ paths: {
14
+ "/foobar": {
15
+ post: {
16
+ requestBody: {
17
+ $ref: "#/components/requestBodies/Foobar"
18
+ }
19
+ }
20
+ }
21
+ },
22
+ components: {
23
+ requestBodies: {
24
+ Foobar: {
25
+ content: {}
26
+ }
27
+ }
28
+ }
29
+ };
30
+ const { schema } = resolveReferences(specification);
31
+ expect(schema.paths["/foobar"].post.requestBody.content).not.toBe(void 0);
32
+ });
33
+ it("returns an error when a reference can\u2019t be found", async () => {
34
+ const specification = {
35
+ openapi: "3.1.0",
36
+ info: {},
37
+ paths: {
38
+ "/foobar": {
39
+ post: {
40
+ requestBody: {
41
+ $ref: "#/components/WrongReference"
42
+ }
43
+ }
44
+ }
45
+ }
46
+ };
47
+ const { valid, errors } = resolveReferences(specification);
48
+ expect(errors).not.toBe(void 0);
49
+ expect(errors).not.toStrictEqual([]);
50
+ expect(errors[0].message).toBe("Can\u2019t resolve reference: #/components/WrongReference");
51
+ expect(errors.length).toBe(1);
52
+ expect(valid).toBe(false);
53
+ });
54
+ it("returns an error when an external reference can\u2019t be found", async () => {
55
+ const specification = {
56
+ openapi: "3.1.0",
57
+ info: {},
58
+ paths: {
59
+ "/foobar": {
60
+ post: {
61
+ requestBody: {
62
+ $ref: "foo/bar/foobar.yaml#/components/WrongReference"
63
+ }
64
+ }
65
+ }
66
+ }
67
+ };
68
+ const { valid, errors } = resolveReferences(specification);
69
+ expect(errors).not.toBe(void 0);
70
+ expect(errors).not.toStrictEqual([]);
71
+ expect(errors[0].message).toBe("Can\u2019t resolve external reference: foo/bar/foobar.yaml");
72
+ expect(errors.length).toBe(1);
73
+ expect(valid).toBe(false);
74
+ });
75
+ it("matches output of @apidevtools/swagger-parser", async () => {
76
+ const specification = {
77
+ openapi: "3.1.0",
78
+ info: {},
79
+ paths: {
80
+ "/foobar": {
81
+ post: {
82
+ requestBody: {
83
+ $ref: "#/components/requestBodies/Foobar"
84
+ }
85
+ }
86
+ }
87
+ },
88
+ components: {
89
+ requestBodies: {
90
+ Foobar: {
91
+ content: {}
92
+ }
93
+ }
94
+ }
95
+ };
96
+ const oldSchema = await new Promise((resolve, reject) => {
97
+ SwaggerParser.dereference(structuredClone(specification), (error, result) => {
98
+ if (error) {
99
+ reject(error);
100
+ }
101
+ if (result === void 0) {
102
+ reject("Couldn\u2019t parse the Swagger file.");
103
+ return;
104
+ }
105
+ resolve(result);
106
+ });
107
+ }).catch((error) => {
108
+ console.error("[@apidevtools/swagger-parser]", error);
109
+ });
110
+ const newParser = resolveReferences(specification);
111
+ expect(newParser.schema.paths["/foobar"].post.requestBody).toMatchObject(
112
+ oldSchema.paths["/foobar"].post.requestBody
113
+ );
114
+ });
115
+ it("resolves references inside references", async () => {
116
+ const specification = {
117
+ openapi: "3.1.0",
118
+ info: {},
119
+ paths: {
120
+ "/foobar": {
121
+ post: {
122
+ requestBody: {
123
+ $ref: "#/components/requestBodies/Foobar"
124
+ }
125
+ }
126
+ }
127
+ },
128
+ components: {
129
+ requestBodies: {
130
+ CursorRequest: {
131
+ content: {}
132
+ },
133
+ Foobar: {
134
+ // This is a reference to another reference
135
+ $ref: "#/components/requestBodies/CursorRequest"
136
+ }
137
+ }
138
+ }
139
+ };
140
+ const oldSchema = await new Promise((resolve, reject) => {
141
+ SwaggerParser.dereference(structuredClone(specification), (error, result) => {
142
+ if (error) {
143
+ reject(error);
144
+ }
145
+ if (result === void 0) {
146
+ reject("Couldn\u2019t parse the Swagger file.");
147
+ return;
148
+ }
149
+ resolve(result);
150
+ });
151
+ }).catch((error) => {
152
+ console.error("[@apidevtools/swagger-parser]", error);
153
+ });
154
+ const newParser = resolveReferences(specification);
155
+ expect(newParser.schema.paths["/foobar"].post.requestBody).toMatchObject(
156
+ oldSchema.paths["/foobar"].post.requestBody
157
+ );
158
+ });
159
+ it("resolves references in arrays", async () => {
160
+ const specification = {
161
+ openapi: "3.1.0",
162
+ info: {},
163
+ paths: {
164
+ "/foobar": {
165
+ post: {
166
+ requestBody: {
167
+ $ref: "#/components/requestBodies/Foobar"
168
+ }
169
+ }
170
+ }
171
+ },
172
+ components: {
173
+ schemas: {
174
+ Barfoo: {
175
+ type: "string",
176
+ example: "barfoo"
177
+ }
178
+ },
179
+ requestBodies: {
180
+ Foobar: {
181
+ content: {
182
+ "application/json": {
183
+ schema: {
184
+ oneOf: [
185
+ {
186
+ $ref: "#/components/schemas/Barfoo"
187
+ }
188
+ ]
189
+ }
190
+ }
191
+ }
192
+ }
193
+ }
194
+ }
195
+ };
196
+ const { schema } = resolveReferences(specification);
197
+ expect(schema.paths["/foobar"].post.requestBody.content["application/json"].schema.oneOf[0]).toMatchObject({
198
+ type: "string",
199
+ example: "barfoo"
200
+ });
201
+ });
202
+ it("merges original properties and referenced content", async () => {
203
+ const specification = {
204
+ openapi: "3.1.0",
205
+ info: {},
206
+ paths: {
207
+ "/foobar": {
208
+ post: {
209
+ requestBody: {
210
+ $ref: "#/components/requestBodies/Foobar"
211
+ }
212
+ }
213
+ }
214
+ },
215
+ components: {
216
+ schemas: {
217
+ Barfoo: {
218
+ type: "string",
219
+ example: "barfoo"
220
+ }
221
+ },
222
+ requestBodies: {
223
+ Foobar: {
224
+ content: {
225
+ "application/json": {
226
+ schema: {
227
+ oneOf: [
228
+ {
229
+ description: "This is a barfoo",
230
+ $ref: "#/components/schemas/Barfoo"
231
+ }
232
+ ]
233
+ }
234
+ }
235
+ }
236
+ }
237
+ }
238
+ }
239
+ };
240
+ const { schema } = resolveReferences(specification);
241
+ expect(schema.paths["/foobar"].post.requestBody.content["application/json"].schema.oneOf[0]).toMatchObject({
242
+ type: "string",
243
+ example: "barfoo",
244
+ description: "This is a barfoo"
245
+ });
246
+ });
247
+ it("references inside references still keep the reference to the original JS object", async () => {
248
+ const specification = {
249
+ swagger: "2.0",
250
+ info: {
251
+ title: "Branded Fares Upsell",
252
+ version: "1.0.1"
253
+ },
254
+ paths: {
255
+ "/foobar": {
256
+ post: {
257
+ responses: {
258
+ "200": {
259
+ $ref: "#/responses/returnUpsell"
260
+ }
261
+ }
262
+ }
263
+ }
264
+ },
265
+ responses: {
266
+ returnUpsell: {
267
+ schema: {
268
+ type: "object",
269
+ properties: {
270
+ dictionaries: {
271
+ $ref: "#/definitions/LocationEntry"
272
+ }
273
+ }
274
+ }
275
+ }
276
+ },
277
+ definitions: {
278
+ Dictionaries: {
279
+ type: "object",
280
+ properties: {
281
+ locations: {
282
+ $ref: "#/definitions/LocationEntry"
283
+ }
284
+ }
285
+ },
286
+ LocationEntry: {
287
+ additionalProperties: {
288
+ $ref: "#/definitions/LocationValue"
289
+ }
290
+ },
291
+ LocationValue: {
292
+ properties: {
293
+ cityCode: {
294
+ description: "City code associated to the airport",
295
+ example: "PAR",
296
+ type: "string"
297
+ }
298
+ }
299
+ }
300
+ }
301
+ };
302
+ const { schema } = resolveReferences(specification);
303
+ expect(schema.swagger).toBe("2.0");
304
+ expect(
305
+ schema.paths["/foobar"].post.responses[200].schema.properties.dictionaries.additionalProperties
306
+ ).toMatchObject({
307
+ properties: {
308
+ cityCode: {
309
+ description: "City code associated to the airport",
310
+ example: "PAR",
311
+ type: "string"
312
+ }
313
+ }
314
+ });
315
+ });
316
+ it("resolves a simple circular reference", async () => {
317
+ const partialSpecification = {
318
+ foo: {
319
+ bar: {
320
+ $ref: "#/foo"
321
+ }
322
+ }
323
+ };
324
+ const { schema } = resolveReferences(partialSpecification);
325
+ expect(() => JSON.stringify(schema, null, 2)).toThrow();
326
+ expect(schema.foo.bar.bar.bar.bar.bar.bar.bar.bar).toBeTypeOf("object");
327
+ });
328
+ it("resolves a more advanced circular reference", async () => {
329
+ const partialSpecification = {
330
+ type: "object",
331
+ properties: {
332
+ element: { $ref: "#/schemas/element" },
333
+ foobar: { $ref: "#/schemas/foobar" }
334
+ },
335
+ schemas: {
336
+ element: {
337
+ type: "object",
338
+ properties: {
339
+ element: { $ref: "#/schemas/element" }
340
+ }
341
+ },
342
+ foobar: {
343
+ type: "object",
344
+ properties: {
345
+ foobar: { $ref: "#/schemas/foobar" }
346
+ }
347
+ }
348
+ }
349
+ };
350
+ const { schema } = resolveReferences(partialSpecification);
351
+ expect(() => JSON.stringify(schema, null, 2)).toThrow();
352
+ expect(schema.schemas.element.properties.element.properties.element.properties.element).toBeTypeOf("object");
353
+ });
354
+ it("resolves an OpenAPI-like circular reference", async () => {
355
+ const specification = {
356
+ type: "object",
357
+ properties: {
358
+ element: { $ref: "#/schemas/element" }
359
+ },
360
+ schemas: {
361
+ element: {
362
+ type: "object",
363
+ properties: {
364
+ element: { $ref: "#/schemas/element" }
365
+ }
366
+ }
367
+ }
368
+ };
369
+ const { schema } = resolveReferences(specification);
370
+ expect(specification.properties.element.$ref).toBeTypeOf("string");
371
+ expect(schema.properties.element.type).toBe("object");
372
+ expect(schema.properties.element.properties.element.type).toBe("object");
373
+ expect(schema.properties.element.properties.element.properties.element.type).toBe("object");
374
+ expect(() => JSON.stringify(schema, null, 2)).toThrow();
375
+ });
376
+ it("composes two files", async () => {
377
+ const filesystem = [
378
+ {
379
+ dir: "/Foobar",
380
+ isEntrypoint: true,
381
+ references: ["other/folder/foobar.json"],
382
+ filename: "openapi.json",
383
+ specification: {
384
+ openapi: "3.1.0",
385
+ info: {},
386
+ paths: {
387
+ "/foobar": {
388
+ post: {
389
+ requestBody: {
390
+ $ref: "other/folder/foobar.json"
391
+ }
392
+ }
393
+ }
394
+ }
395
+ }
396
+ },
397
+ {
398
+ dir: "/Foobar/other/folder",
399
+ isEntrypoint: false,
400
+ references: [],
401
+ filename: "other/folder/foobar.json",
402
+ specification: {
403
+ content: {
404
+ "application/json": {
405
+ schema: {
406
+ type: "string",
407
+ example: "foobar"
408
+ }
409
+ }
410
+ }
411
+ }
412
+ }
413
+ ];
414
+ const { schema } = resolveReferences(filesystem);
415
+ expect(schema.paths["/foobar"].post.requestBody.content["application/json"].schema.example).toBe("foobar");
416
+ });
417
+ it("resolves reference to a part of an external file", async () => {
418
+ const filesystem = [
419
+ {
420
+ dir: "/Foobar",
421
+ isEntrypoint: true,
422
+ references: ["other/folder/foobar.json"],
423
+ filename: "openapi.json",
424
+ specification: {
425
+ openapi: "3.1.0",
426
+ info: {},
427
+ paths: {
428
+ "/foobar": {
429
+ post: {
430
+ requestBody: {
431
+ $ref: "other/folder/foobar.json#/components/requestBodies/Foobar"
432
+ }
433
+ }
434
+ }
435
+ }
436
+ }
437
+ },
438
+ {
439
+ dir: "/Foobar/other/folder",
440
+ isEntrypoint: false,
441
+ references: [],
442
+ filename: "other/folder/foobar.json",
443
+ specification: {
444
+ components: {
445
+ requestBodies: {
446
+ Foobar: {
447
+ content: {
448
+ "application/json": {
449
+ schema: {
450
+ type: "string",
451
+ example: "foobar"
452
+ }
453
+ }
454
+ }
455
+ }
456
+ }
457
+ }
458
+ }
459
+ }
460
+ ];
461
+ const { schema } = resolveReferences(filesystem);
462
+ expect(schema.paths["/foobar"].post.requestBody.content["application/json"].schema.example).toBe("foobar");
463
+ });
464
+ it("resolves references in external files", async () => {
465
+ const filesystem = [
466
+ {
467
+ dir: "/Foobar",
468
+ isEntrypoint: true,
469
+ references: ["other/folder/foobar.json"],
470
+ filename: "openapi.json",
471
+ specification: {
472
+ openapi: "3.1.0",
473
+ info: {},
474
+ paths: {
475
+ "/foobar": {
476
+ post: {
477
+ requestBody: {
478
+ $ref: "other/folder/foobar.json#/components/requestBodies/Foobar"
479
+ }
480
+ }
481
+ }
482
+ }
483
+ }
484
+ },
485
+ {
486
+ dir: "/Foobar/other/folder",
487
+ isEntrypoint: false,
488
+ references: ["barfoo.json"],
489
+ filename: "other/folder/foobar.json",
490
+ specification: {
491
+ components: {
492
+ requestBodies: {
493
+ Foobar: {
494
+ $ref: "barfoo.json"
495
+ }
496
+ }
497
+ }
498
+ }
499
+ },
500
+ {
501
+ dir: "/Foobar/other/folder",
502
+ isEntrypoint: false,
503
+ references: [],
504
+ filename: "barfoo.json",
505
+ specification: {
506
+ content: {
507
+ "application/json": {
508
+ schema: {
509
+ type: "string",
510
+ example: "foobar"
511
+ }
512
+ }
513
+ }
514
+ }
515
+ }
516
+ ];
517
+ const { schema } = resolveReferences(filesystem);
518
+ expect(schema.paths["/foobar"].post.requestBody.content["application/json"].schema.example).toBe("foobar");
519
+ });
520
+ it("resolves from filesystem", async () => {
521
+ const { filesystem } = await load(EXAMPLE_FILE, {
522
+ plugins: [readFiles()]
523
+ });
524
+ const { schema } = resolveReferences(filesystem);
525
+ expect(schema.components.schemas.Upload.allOf[0].title).toBe("Coordinates");
526
+ });
527
+ it("resolves reference to self by filename", async () => {
528
+ const filesystem = [
529
+ {
530
+ dir: "/Foobar",
531
+ isEntrypoint: true,
532
+ references: [],
533
+ filename: "openapi.json",
534
+ specification: {
535
+ openapi: "3.1.0",
536
+ info: {},
537
+ paths: {
538
+ "/foobar": {
539
+ post: {
540
+ requestBody: {
541
+ $ref: "openapi.json#/components/requestBodies/Foobar"
542
+ }
543
+ }
544
+ }
545
+ },
546
+ components: {
547
+ requestBodies: {
548
+ Foobar: {
549
+ content: {
550
+ "application/json": {
551
+ schema: {
552
+ type: "string",
553
+ example: "foobar"
554
+ }
555
+ }
556
+ }
557
+ }
558
+ }
559
+ }
560
+ }
561
+ }
562
+ ];
563
+ const { schema } = resolveReferences(filesystem);
564
+ expect(schema.paths["/foobar"].post.requestBody.content["application/json"].schema.example).toBe("foobar");
565
+ });
566
+ });
567
+ //# sourceMappingURL=resolveReferences.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/resolveReferences.test.ts"],
4
+ "sourcesContent": ["/**\n * This file has some simple tests to cover the basics of the resolveReferences function.\n * Doesn\u2019t cover all edge cases, doesn\u2019t have big files, but if this works you\u2019re almost there.\n */\nimport SwaggerParser from '@apidevtools/swagger-parser'\nimport path from 'node:path'\nimport { describe, expect, it } from 'vitest'\n\nimport { readFiles } from '../plugins/read-files/readFiles'\nimport type { AnyObject } from '../types/index'\nimport { load } from './load/load'\nimport { resolveReferences } from './resolveReferences'\n\nconst EXAMPLE_FILE = path.join(new URL(import.meta.url).pathname, '../../../tests/filesystem/api/openapi.yaml')\n\ndescribe('resolveReferences', () => {\n it('resolves a single reference', async () => {\n const specification = {\n openapi: '3.1.0',\n info: {},\n paths: {\n '/foobar': {\n post: {\n requestBody: {\n $ref: '#/components/requestBodies/Foobar',\n },\n },\n },\n },\n components: {\n requestBodies: {\n Foobar: {\n content: {},\n },\n },\n },\n }\n\n // Run the specification through our new parser\n const { schema } = resolveReferences(specification)\n\n // Assertion\n expect(schema.paths['/foobar'].post.requestBody.content).not.toBe(undefined)\n })\n\n it('returns an error when a reference can\u2019t be found', async () => {\n const specification = {\n openapi: '3.1.0',\n info: {},\n paths: {\n '/foobar': {\n post: {\n requestBody: {\n $ref: '#/components/WrongReference',\n },\n },\n },\n },\n }\n\n // Run the specification through our new parser\n const { valid, errors } = resolveReferences(specification)\n\n // Assertion\n expect(errors).not.toBe(undefined)\n expect(errors).not.toStrictEqual([])\n expect(errors[0].message).toBe('Can\u2019t resolve reference: #/components/WrongReference')\n expect(errors.length).toBe(1)\n expect(valid).toBe(false)\n })\n\n it('returns an error when an external reference can\u2019t be found', async () => {\n const specification = {\n openapi: '3.1.0',\n info: {},\n paths: {\n '/foobar': {\n post: {\n requestBody: {\n $ref: 'foo/bar/foobar.yaml#/components/WrongReference',\n },\n },\n },\n },\n }\n\n // Run the specification through our new parser\n const { valid, errors } = resolveReferences(specification)\n\n // Assertion\n expect(errors).not.toBe(undefined)\n expect(errors).not.toStrictEqual([])\n expect(errors[0].message).toBe('Can\u2019t resolve external reference: foo/bar/foobar.yaml')\n expect(errors.length).toBe(1)\n expect(valid).toBe(false)\n })\n\n it('matches output of @apidevtools/swagger-parser', async () => {\n const specification = {\n openapi: '3.1.0',\n info: {},\n paths: {\n '/foobar': {\n post: {\n requestBody: {\n $ref: '#/components/requestBodies/Foobar',\n },\n },\n },\n },\n components: {\n requestBodies: {\n Foobar: {\n content: {},\n },\n },\n },\n }\n\n // Run the specification through the old parser\n const oldSchema = (await new Promise((resolve, reject) => {\n SwaggerParser.dereference(structuredClone(specification) as never, (error, result) => {\n if (error) {\n reject(error)\n }\n\n if (result === undefined) {\n reject('Couldn\u2019t parse the Swagger file.')\n\n return\n }\n resolve(result)\n })\n }).catch((error) => {\n console.error('[@apidevtools/swagger-parser]', error)\n })) as any\n\n // Run the specification through our new parser\n const newParser = resolveReferences(specification)\n\n // Assertion\n expect(newParser.schema.paths['/foobar'].post.requestBody).toMatchObject(\n oldSchema.paths['/foobar'].post.requestBody,\n )\n })\n\n it('resolves references inside references', async () => {\n const specification = {\n openapi: '3.1.0',\n info: {},\n paths: {\n '/foobar': {\n post: {\n requestBody: {\n $ref: '#/components/requestBodies/Foobar',\n },\n },\n },\n },\n\n components: {\n requestBodies: {\n CursorRequest: {\n content: {},\n },\n Foobar: {\n // This is a reference to another reference\n $ref: '#/components/requestBodies/CursorRequest',\n },\n },\n },\n }\n\n // Run the specification through the old parser\n const oldSchema = (await new Promise((resolve, reject) => {\n SwaggerParser.dereference(structuredClone(specification) as never, (error, result) => {\n if (error) {\n reject(error)\n }\n\n if (result === undefined) {\n reject('Couldn\u2019t parse the Swagger file.')\n\n return\n }\n resolve(result)\n })\n }).catch((error) => {\n console.error('[@apidevtools/swagger-parser]', error)\n })) as any\n\n // Run the specification through our new parser\n const newParser = resolveReferences(specification)\n\n // Assertion\n expect(newParser.schema.paths['/foobar'].post.requestBody).toMatchObject(\n oldSchema.paths['/foobar'].post.requestBody,\n )\n })\n\n it('resolves references in arrays', async () => {\n const specification = {\n openapi: '3.1.0',\n info: {},\n paths: {\n '/foobar': {\n post: {\n requestBody: {\n $ref: '#/components/requestBodies/Foobar',\n },\n },\n },\n },\n\n components: {\n schemas: {\n Barfoo: {\n type: 'string',\n example: 'barfoo',\n },\n },\n requestBodies: {\n Foobar: {\n content: {\n 'application/json': {\n schema: {\n oneOf: [\n {\n $ref: '#/components/schemas/Barfoo',\n },\n ],\n },\n },\n },\n },\n },\n },\n }\n\n // Run the specification through our new parser\n const { schema } = resolveReferences(specification)\n\n // Assertion\n expect(schema.paths['/foobar'].post.requestBody.content['application/json'].schema.oneOf[0]).toMatchObject({\n type: 'string',\n example: 'barfoo',\n })\n })\n\n it('merges original properties and referenced content', async () => {\n const specification = {\n openapi: '3.1.0',\n info: {},\n paths: {\n '/foobar': {\n post: {\n requestBody: {\n $ref: '#/components/requestBodies/Foobar',\n },\n },\n },\n },\n components: {\n schemas: {\n Barfoo: {\n type: 'string',\n example: 'barfoo',\n },\n },\n requestBodies: {\n Foobar: {\n content: {\n 'application/json': {\n schema: {\n oneOf: [\n {\n description: 'This is a barfoo',\n $ref: '#/components/schemas/Barfoo',\n },\n ],\n },\n },\n },\n },\n },\n },\n }\n\n // Run the specification through our new parser\n const { schema } = resolveReferences(specification)\n\n // Assertion\n expect(schema.paths['/foobar'].post.requestBody.content['application/json'].schema.oneOf[0]).toMatchObject({\n type: 'string',\n example: 'barfoo',\n description: 'This is a barfoo',\n })\n })\n\n it('references inside references still keep the reference to the original JS object', async () => {\n const specification = {\n swagger: '2.0',\n info: {\n title: 'Branded Fares Upsell',\n version: '1.0.1',\n },\n paths: {\n '/foobar': {\n post: {\n responses: {\n '200': {\n $ref: '#/responses/returnUpsell',\n },\n },\n },\n },\n },\n responses: {\n returnUpsell: {\n schema: {\n type: 'object',\n properties: {\n dictionaries: {\n $ref: '#/definitions/LocationEntry',\n },\n },\n },\n },\n },\n definitions: {\n Dictionaries: {\n type: 'object',\n properties: {\n locations: {\n $ref: '#/definitions/LocationEntry',\n },\n },\n },\n LocationEntry: {\n additionalProperties: {\n $ref: '#/definitions/LocationValue',\n },\n },\n LocationValue: {\n properties: {\n cityCode: {\n description: 'City code associated to the airport',\n example: 'PAR',\n type: 'string',\n },\n },\n },\n },\n }\n\n // Run the specification through our new parser\n const { schema } = resolveReferences(specification)\n\n // Assertion\n expect(schema.swagger).toBe('2.0')\n expect(\n schema.paths['/foobar'].post.responses[200].schema.properties.dictionaries.additionalProperties,\n ).toMatchObject({\n properties: {\n cityCode: {\n description: 'City code associated to the airport',\n example: 'PAR',\n type: 'string',\n },\n },\n })\n })\n\n it('resolves a simple circular reference', async () => {\n const partialSpecification: AnyObject = {\n foo: {\n bar: {\n $ref: '#/foo',\n },\n },\n }\n\n const { schema } = resolveReferences(partialSpecification)\n\n // Circular references can\u2019t be JSON.stringify\u2019d (easily)\n expect(() => JSON.stringify(schema, null, 2)).toThrow()\n\n // Sky is the limit\n expect(schema.foo.bar.bar.bar.bar.bar.bar.bar.bar).toBeTypeOf('object')\n })\n\n it('resolves a more advanced circular reference', async () => {\n const partialSpecification: AnyObject = {\n type: 'object',\n properties: {\n element: { $ref: '#/schemas/element' },\n foobar: { $ref: '#/schemas/foobar' },\n },\n schemas: {\n element: {\n type: 'object',\n properties: {\n element: { $ref: '#/schemas/element' },\n },\n },\n foobar: {\n type: 'object',\n properties: {\n foobar: { $ref: '#/schemas/foobar' },\n },\n },\n },\n }\n\n // Typecasting: We\u2019re misusing the function and pass a partial specification only.\n const { schema } = resolveReferences(partialSpecification) as any\n\n // Circular references can\u2019t be JSON.stringify\u2019d (easily)\n expect(() => JSON.stringify(schema, null, 2)).toThrow()\n\n // Sky is the liit\n expect(schema.schemas.element.properties.element.properties.element.properties.element).toBeTypeOf('object')\n })\n\n it('resolves an OpenAPI-like circular reference', async () => {\n const specification = {\n type: 'object',\n properties: {\n element: { $ref: '#/schemas/element' },\n },\n schemas: {\n element: {\n type: 'object',\n properties: {\n element: { $ref: '#/schemas/element' },\n },\n },\n },\n }\n\n const { schema } = resolveReferences(specification)\n\n // Original specification should not be mutated\n expect(specification.properties.element.$ref).toBeTypeOf('string')\n\n // Circular dependency should be resolved\n expect(schema.properties.element.type).toBe('object')\n expect(schema.properties.element.properties.element.type).toBe('object')\n expect(schema.properties.element.properties.element.properties.element.type).toBe('object')\n\n // Circular references can\u2019t be JSON.stringify\u2019d (easily)\n expect(() => JSON.stringify(schema, null, 2)).toThrow()\n })\n\n it('composes two files', async () => {\n const filesystem = [\n {\n dir: '/Foobar',\n isEntrypoint: true,\n references: ['other/folder/foobar.json'],\n filename: 'openapi.json',\n specification: {\n openapi: '3.1.0',\n info: {},\n paths: {\n '/foobar': {\n post: {\n requestBody: {\n $ref: 'other/folder/foobar.json',\n },\n },\n },\n },\n },\n },\n {\n dir: '/Foobar/other/folder',\n isEntrypoint: false,\n references: [],\n filename: 'other/folder/foobar.json',\n specification: {\n content: {\n 'application/json': {\n schema: {\n type: 'string',\n example: 'foobar',\n },\n },\n },\n },\n },\n ]\n\n const { schema } = resolveReferences(filesystem)\n\n expect(schema.paths['/foobar'].post.requestBody.content['application/json'].schema.example).toBe('foobar')\n })\n\n it('resolves reference to a part of an external file', async () => {\n const filesystem = [\n {\n dir: '/Foobar',\n isEntrypoint: true,\n references: ['other/folder/foobar.json'],\n filename: 'openapi.json',\n specification: {\n openapi: '3.1.0',\n info: {},\n paths: {\n '/foobar': {\n post: {\n requestBody: {\n $ref: 'other/folder/foobar.json#/components/requestBodies/Foobar',\n },\n },\n },\n },\n },\n },\n {\n dir: '/Foobar/other/folder',\n isEntrypoint: false,\n references: [],\n filename: 'other/folder/foobar.json',\n specification: {\n components: {\n requestBodies: {\n Foobar: {\n content: {\n 'application/json': {\n schema: {\n type: 'string',\n example: 'foobar',\n },\n },\n },\n },\n },\n },\n },\n },\n ]\n\n const { schema } = resolveReferences(filesystem)\n expect(schema.paths['/foobar'].post.requestBody.content['application/json'].schema.example).toBe('foobar')\n })\n\n it('resolves references in external files', async () => {\n const filesystem = [\n {\n dir: '/Foobar',\n isEntrypoint: true,\n references: ['other/folder/foobar.json'],\n filename: 'openapi.json',\n specification: {\n openapi: '3.1.0',\n info: {},\n paths: {\n '/foobar': {\n post: {\n requestBody: {\n $ref: 'other/folder/foobar.json#/components/requestBodies/Foobar',\n },\n },\n },\n },\n },\n },\n {\n dir: '/Foobar/other/folder',\n isEntrypoint: false,\n references: ['barfoo.json'],\n filename: 'other/folder/foobar.json',\n specification: {\n components: {\n requestBodies: {\n Foobar: {\n $ref: 'barfoo.json',\n },\n },\n },\n },\n },\n {\n dir: '/Foobar/other/folder',\n isEntrypoint: false,\n references: [],\n filename: 'barfoo.json',\n specification: {\n content: {\n 'application/json': {\n schema: {\n type: 'string',\n example: 'foobar',\n },\n },\n },\n },\n },\n ]\n\n const { schema } = resolveReferences(filesystem)\n expect(schema.paths['/foobar'].post.requestBody.content['application/json'].schema.example).toBe('foobar')\n })\n\n it('resolves from filesystem', async () => {\n const { filesystem } = await load(EXAMPLE_FILE, {\n plugins: [readFiles()],\n })\n\n const { schema } = resolveReferences(filesystem)\n\n // Resolve the *path* from the given file\n expect(schema.components.schemas.Upload.allOf[0].title).toBe('Coordinates')\n })\n\n it('resolves reference to self by filename', async () => {\n const filesystem = [\n {\n dir: '/Foobar',\n isEntrypoint: true,\n references: [],\n filename: 'openapi.json',\n specification: {\n openapi: '3.1.0',\n info: {},\n paths: {\n '/foobar': {\n post: {\n requestBody: {\n $ref: 'openapi.json#/components/requestBodies/Foobar',\n },\n },\n },\n },\n components: {\n requestBodies: {\n Foobar: {\n content: {\n 'application/json': {\n schema: {\n type: 'string',\n example: 'foobar',\n },\n },\n },\n },\n },\n },\n },\n },\n ]\n\n const { schema } = resolveReferences(filesystem)\n expect(schema.paths['/foobar'].post.requestBody.content['application/json'].schema.example).toBe('foobar')\n })\n})\n"],
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AM,CAAC;AAAA,UACP,OAAO;AAAA,YACL,WAAW;AAAA,cACT,MAAM;AAAA,gBACJ,aAAa;AAAA,kBACX,MAAM;AAAA,gBACR;AAAA,cACF;AAAA,YACF;AAAA,UACF;AAAA,UACA,YAAY;AAAA,YACV,eAAe;AAAA,cACb,QAAQ;AAAA,gBACN,SAAS;AAAA,kBACP,oBAAoB;AAAA,oBAClB,QAAQ;AAAA,sBACN,MAAM;AAAA,sBACN,SAAS;AAAA,oBACX;AAAA,kBACF;AAAA,gBACF;AAAA,cACF;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,UAAM,EAAE,OAAO,IAAI,kBAAkB,UAAU;AAC/C,WAAO,OAAO,MAAM,SAAS,EAAE,KAAK,YAAY,QAAQ,kBAAkB,EAAE,OAAO,OAAO,EAAE,KAAK,QAAQ;AAAA,EAC3G,CAAC;AACH,CAAC;",
6
+ "names": []
7
+ }
@@ -1,3 +1,3 @@
1
- import type { AnyObject } from '../types/index.ts';
1
+ import type { AnyObject } from '../types/index.js';
2
2
  export declare const toJson: (value: AnyObject) => string;
3
3
  //# sourceMappingURL=toJson.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toJson.d.ts","sourceRoot":"","sources":["../../src/utils/toJson.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAElD,eAAO,MAAM,MAAM,UAAW,SAAS,WAAmC,CAAA"}
1
+ {"version":3,"file":"toJson.d.ts","sourceRoot":"","sources":["../../src/utils/toJson.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,eAAO,MAAM,MAAM,UAAW,SAAS,WAAmC,CAAA"}
@@ -1,3 +1,5 @@
1
1
  const toJson = (value) => JSON.stringify(value, null, 2);
2
-
3
- export { toJson };
2
+ export {
3
+ toJson
4
+ };
5
+ //# sourceMappingURL=toJson.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/toJson.ts"],
4
+ "sourcesContent": ["import type { AnyObject } from '../types/index'\n\nexport const toJson = (value: AnyObject) => JSON.stringify(value, null, 2)\n"],
5
+ "mappings": "AAEO,MAAM,SAAS,CAAC,UAAqB,KAAK,UAAU,OAAO,MAAM,CAAC;",
6
+ "names": []
7
+ }
@@ -1,3 +1,3 @@
1
- import type { AnyObject } from '../types/index.ts';
1
+ import type { AnyObject } from '../types/index.js';
2
2
  export declare const toYaml: (value: AnyObject) => string;
3
3
  //# sourceMappingURL=toYaml.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toYaml.d.ts","sourceRoot":"","sources":["../../src/utils/toYaml.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAElD,eAAO,MAAM,MAAM,UAAW,SAAS,WAAqB,CAAA"}
1
+ {"version":3,"file":"toYaml.d.ts","sourceRoot":"","sources":["../../src/utils/toYaml.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,eAAO,MAAM,MAAM,UAAW,SAAS,WAAqB,CAAA"}