@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
@@ -1,119 +1,98 @@
1
- import { ERRORS } from '../../configuration/index.js';
2
- import { getEntrypoint } from '../getEntrypoint.js';
3
- import { getListOfReferences } from '../getListOfReferences.js';
4
- import { makeFilesystem } from '../makeFilesystem.js';
5
- import { normalize } from '../normalize.js';
6
-
7
- /**
8
- * Loads an OpenAPI document, including any external references.
9
- *
10
- * This function handles loading content from various sources, normalizes the content,
11
- * and recursively loads any external references found within the definition.
12
- *
13
- * It builds a filesystem representation of all loaded content and collects any errors
14
- * encountered during the process.
15
- */
1
+ import { ERRORS } from "../../configuration/index.js";
2
+ import { getEntrypoint } from "../getEntrypoint.js";
3
+ import { getListOfReferences } from "../getListOfReferences.js";
4
+ import { makeFilesystem } from "../makeFilesystem.js";
5
+ import { normalize } from "../normalize.js";
16
6
  async function load(value, options) {
17
- const errors = [];
18
- // Don’t load a reference twice, check the filesystem before fetching something
19
- if (options?.filesystem?.find((entry) => entry.filename === value)) {
20
- return {
21
- specification: getEntrypoint(options.filesystem)?.specification,
22
- filesystem: options.filesystem,
23
- errors,
24
- };
7
+ const errors = [];
8
+ if (options?.filesystem?.find((entry) => entry.filename === value)) {
9
+ return {
10
+ specification: getEntrypoint(options.filesystem)?.specification,
11
+ filesystem: options.filesystem,
12
+ errors
13
+ };
14
+ }
15
+ const plugin = options?.plugins?.find((thisPlugin) => thisPlugin.check(value));
16
+ let content;
17
+ if (plugin) {
18
+ try {
19
+ content = normalize(await plugin.get(value));
20
+ } catch (_error) {
21
+ if (options?.throwOnError) {
22
+ throw new Error(ERRORS.EXTERNAL_REFERENCE_NOT_FOUND.replace("%s", value));
23
+ }
24
+ errors.push({
25
+ code: "EXTERNAL_REFERENCE_NOT_FOUND",
26
+ message: ERRORS.EXTERNAL_REFERENCE_NOT_FOUND.replace("%s", value)
27
+ });
28
+ return {
29
+ specification: null,
30
+ filesystem: [],
31
+ errors
32
+ };
25
33
  }
26
- // Check whether the value is an URL or file path
27
- const plugin = options?.plugins?.find((thisPlugin) => thisPlugin.check(value));
28
- let content;
29
- if (plugin) {
30
- try {
31
- content = normalize(await plugin.get(value));
32
- }
33
- catch (_error) {
34
- if (options?.throwOnError) {
35
- throw new Error(ERRORS.EXTERNAL_REFERENCE_NOT_FOUND.replace('%s', value));
36
- }
37
- errors.push({
38
- code: 'EXTERNAL_REFERENCE_NOT_FOUND',
39
- message: ERRORS.EXTERNAL_REFERENCE_NOT_FOUND.replace('%s', value),
40
- });
41
- return {
42
- specification: null,
43
- filesystem: [],
44
- errors,
45
- };
46
- }
34
+ } else {
35
+ content = normalize(value);
36
+ }
37
+ if (content === void 0) {
38
+ if (options?.throwOnError) {
39
+ throw new Error("No content to load");
47
40
  }
48
- else {
49
- content = normalize(value);
41
+ errors.push({
42
+ code: "NO_CONTENT",
43
+ message: ERRORS.NO_CONTENT
44
+ });
45
+ return {
46
+ specification: null,
47
+ filesystem: [],
48
+ errors
49
+ };
50
+ }
51
+ let filesystem = makeFilesystem(content, {
52
+ filename: options?.filename ?? null
53
+ });
54
+ const newEntry = options?.filename ? filesystem.find((entry) => entry.filename === options?.filename) : getEntrypoint(filesystem);
55
+ const listOfReferences = newEntry.references ?? getListOfReferences(content);
56
+ if (listOfReferences.length === 0) {
57
+ return {
58
+ specification: getEntrypoint(filesystem)?.specification,
59
+ filesystem,
60
+ errors
61
+ };
62
+ }
63
+ for (const reference of listOfReferences) {
64
+ const otherPlugin = options?.plugins?.find((thisPlugin) => thisPlugin.check(reference));
65
+ if (!otherPlugin) {
66
+ continue;
50
67
  }
51
- // No content
52
- if (content === undefined) {
53
- if (options?.throwOnError) {
54
- throw new Error('No content to load');
55
- }
56
- errors.push({
57
- code: 'NO_CONTENT',
58
- message: ERRORS.NO_CONTENT,
59
- });
60
- return {
61
- specification: null,
62
- filesystem: [],
63
- errors,
64
- };
68
+ const target = otherPlugin.check(reference) && otherPlugin.resolvePath ? otherPlugin.resolvePath(value, reference) : reference;
69
+ if (filesystem.find((entry) => entry.filename === reference)) {
70
+ continue;
65
71
  }
66
- let filesystem = makeFilesystem(content, {
67
- filename: options?.filename ?? null,
72
+ const { filesystem: referencedFiles, errors: newErrors } = await load(target, {
73
+ ...options,
74
+ // Make the filename the exact same value as the $ref
75
+ // TODO: This leads to problems, if there are multiple references with the same file name but in different folders
76
+ filename: reference
68
77
  });
69
- // Get references from file system entry, or from the content
70
- const newEntry = options?.filename
71
- ? filesystem.find((entry) => entry.filename === options?.filename)
72
- : getEntrypoint(filesystem);
73
- const listOfReferences = newEntry.references ?? getListOfReferences(content);
74
- // No other references
75
- if (listOfReferences.length === 0) {
78
+ errors.push(...newErrors);
79
+ filesystem = [
80
+ ...filesystem,
81
+ ...referencedFiles.map((file) => {
76
82
  return {
77
- specification: getEntrypoint(filesystem)?.specification,
78
- filesystem,
79
- errors,
83
+ ...file,
84
+ isEntrypoint: false
80
85
  };
81
- }
82
- // Load other external references
83
- for (const reference of listOfReferences) {
84
- // Find a matching plugin
85
- const otherPlugin = options?.plugins?.find((thisPlugin) => thisPlugin.check(reference));
86
- // Skip if no plugin is found (internal references don’t need a plugin for example)
87
- if (!otherPlugin) {
88
- continue;
89
- }
90
- const target = otherPlugin.check(reference) && otherPlugin.resolvePath ? otherPlugin.resolvePath(value, reference) : reference;
91
- // Don’t load a reference twice, check the filesystem before fetching something
92
- if (filesystem.find((entry) => entry.filename === reference)) {
93
- continue;
94
- }
95
- const { filesystem: referencedFiles, errors: newErrors } = await load(target, {
96
- ...options,
97
- // Make the filename the exact same value as the $ref
98
- // TODO: This leads to problems, if there are multiple references with the same file name but in different folders
99
- filename: reference,
100
- });
101
- errors.push(...newErrors);
102
- filesystem = [
103
- ...filesystem,
104
- ...referencedFiles.map((file) => {
105
- return {
106
- ...file,
107
- isEntrypoint: false,
108
- };
109
- }),
110
- ];
111
- }
112
- return {
113
- specification: getEntrypoint(filesystem)?.specification,
114
- filesystem,
115
- errors,
116
- };
86
+ })
87
+ ];
88
+ }
89
+ return {
90
+ specification: getEntrypoint(filesystem)?.specification,
91
+ filesystem,
92
+ errors
93
+ };
117
94
  }
118
-
119
- export { load };
95
+ export {
96
+ load
97
+ };
98
+ //# sourceMappingURL=load.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/utils/load/load.ts"],
4
+ "sourcesContent": ["import { ERRORS } from '../../configuration/index'\nimport type {\n AnyApiDefinitionFormat,\n AnyObject,\n ErrorObject,\n Filesystem,\n LoadResult,\n ThrowOnErrorOption,\n} from '../../types/index'\nimport { getEntrypoint } from '../getEntrypoint'\nimport { getListOfReferences } from '../getListOfReferences'\nimport { makeFilesystem } from '../makeFilesystem'\nimport { normalize } from '../normalize'\n\nexport type LoadPlugin = {\n check: (value?: any) => boolean\n get: (value: any) => any\n resolvePath?: (value: any, reference: string) => string\n getDir?: (value: any) => string\n getFilename?: (value: any) => string\n}\n\nexport type LoadOptions = {\n plugins?: LoadPlugin[]\n filename?: string\n filesystem?: Filesystem\n} & ThrowOnErrorOption\n\n/**\n * Loads an OpenAPI document, including any external references.\n *\n * This function handles loading content from various sources, normalizes the content,\n * and recursively loads any external references found within the definition.\n *\n * It builds a filesystem representation of all loaded content and collects any errors\n * encountered during the process.\n */\nexport async function load(value: AnyApiDefinitionFormat, options?: LoadOptions): Promise<LoadResult> {\n const errors: ErrorObject[] = []\n\n // Don\u2019t load a reference twice, check the filesystem before fetching something\n if (options?.filesystem?.find((entry) => entry.filename === value)) {\n return {\n specification: getEntrypoint(options.filesystem)?.specification,\n filesystem: options.filesystem,\n errors,\n }\n }\n\n // Check whether the value is an URL or file path\n const plugin = options?.plugins?.find((thisPlugin) => thisPlugin.check(value))\n\n let content: AnyObject\n\n if (plugin) {\n try {\n content = normalize(await plugin.get(value))\n } catch (_error) {\n if (options?.throwOnError) {\n throw new Error(ERRORS.EXTERNAL_REFERENCE_NOT_FOUND.replace('%s', value as string))\n }\n\n errors.push({\n code: 'EXTERNAL_REFERENCE_NOT_FOUND',\n message: ERRORS.EXTERNAL_REFERENCE_NOT_FOUND.replace('%s', value as string),\n })\n\n return {\n specification: null,\n filesystem: [],\n errors,\n }\n }\n } else {\n content = normalize(value)\n }\n\n // No content\n if (content === undefined) {\n if (options?.throwOnError) {\n throw new Error('No content to load')\n }\n\n errors.push({\n code: 'NO_CONTENT',\n message: ERRORS.NO_CONTENT,\n })\n\n return {\n specification: null,\n filesystem: [],\n errors,\n }\n }\n\n let filesystem = makeFilesystem(content, {\n filename: options?.filename ?? null,\n })\n\n // Get references from file system entry, or from the content\n const newEntry = options?.filename\n ? filesystem.find((entry) => entry.filename === options?.filename)\n : getEntrypoint(filesystem)\n\n const listOfReferences = newEntry.references ?? getListOfReferences(content)\n\n // No other references\n if (listOfReferences.length === 0) {\n return {\n specification: getEntrypoint(filesystem)?.specification,\n filesystem,\n errors,\n }\n }\n\n // Load other external references\n for (const reference of listOfReferences) {\n // Find a matching plugin\n const otherPlugin = options?.plugins?.find((thisPlugin) => thisPlugin.check(reference))\n\n // Skip if no plugin is found (internal references don\u2019t need a plugin for example)\n if (!otherPlugin) {\n continue\n }\n\n const target =\n otherPlugin.check(reference) && otherPlugin.resolvePath ? otherPlugin.resolvePath(value, reference) : reference\n\n // Don\u2019t load a reference twice, check the filesystem before fetching something\n if (filesystem.find((entry) => entry.filename === reference)) {\n continue\n }\n\n const { filesystem: referencedFiles, errors: newErrors } = await load(target, {\n ...options,\n // Make the filename the exact same value as the $ref\n // TODO: This leads to problems, if there are multiple references with the same file name but in different folders\n filename: reference,\n })\n\n errors.push(...newErrors)\n\n filesystem = [\n ...filesystem,\n ...referencedFiles.map((file) => {\n return {\n ...file,\n isEntrypoint: false,\n }\n }),\n ]\n }\n\n return {\n specification: getEntrypoint(filesystem)?.specification,\n filesystem,\n errors,\n }\n}\n"],
5
+ "mappings": "AAAA,SAAS,cAAc;AASvB,SAAS,qBAAqB;AAC9B,SAAS,2BAA2B;AACpC,SAAS,sBAAsB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AAM,mBAAmB,SAAS,cAAc,oBAAoB,OAAO;AAG3E,MAAI,iBAAiB,WAAW,GAAG;AACjC,WAAO;AAAA,MACL,eAAe,cAAc,UAAU,GAAG;AAAA,MAC1C;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAGA,aAAW,aAAa,kBAAkB;AAExC,UAAM,cAAc,SAAS,SAAS,KAAK,CAAC,eAAe,WAAW,MAAM,SAAS,CAAC;AAGtF,QAAI,CAAC,aAAa;AAChB;AAAA,IACF;AAEA,UAAM,SACJ,YAAY,MAAM,SAAS,KAAK,YAAY,cAAc,YAAY,YAAY,OAAO,SAAS,IAAI;AAGxG,QAAI,WAAW,KAAK,CAAC,UAAU,MAAM,aAAa,SAAS,GAAG;AAC5D;AAAA,IACF;AAEA,UAAM,EAAE,YAAY,iBAAiB,QAAQ,UAAU,IAAI,MAAM,KAAK,QAAQ;AAAA,MAC5E,GAAG;AAAA;AAAA;AAAA,MAGH,UAAU;AAAA,IACZ,CAAC;AAED,WAAO,KAAK,GAAG,SAAS;AAExB,iBAAa;AAAA,MACX,GAAG;AAAA,MACH,GAAG,gBAAgB,IAAI,CAAC,SAAS;AAC/B,eAAO;AAAA,UACL,GAAG;AAAA,UACH,cAAc;AAAA,QAChB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AAAA,IACL,eAAe,cAAc,UAAU,GAAG;AAAA,IAC1C;AAAA,IACA;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,361 @@
1
+ import path from "node:path";
2
+ import { beforeEach, describe, expect, it, vi } from "vitest";
3
+ import { stringify } from "yaml";
4
+ import { fetchUrls } from "../../plugins/fetch-urls/fetchUrls.js";
5
+ import { readFiles } from "../../plugins/read-files/readFiles.js";
6
+ import { getEntrypoint } from "../getEntrypoint.js";
7
+ import { load } from "./load.js";
8
+ global.fetch = vi.fn();
9
+ describe("load", async () => {
10
+ beforeEach(() => {
11
+ global.fetch.mockReset();
12
+ });
13
+ it("loads JS object", async () => {
14
+ const { filesystem } = await load(
15
+ {
16
+ openapi: "3.1.0",
17
+ info: {
18
+ title: "Hello World",
19
+ version: "1.0.0"
20
+ },
21
+ paths: {}
22
+ },
23
+ {
24
+ plugins: [readFiles(), fetchUrls()]
25
+ }
26
+ );
27
+ expect(getEntrypoint(filesystem).specification).toMatchObject({
28
+ openapi: "3.1.0",
29
+ info: {
30
+ title: "Hello World",
31
+ version: "1.0.0"
32
+ },
33
+ paths: {}
34
+ });
35
+ });
36
+ it("loads JSON string", async () => {
37
+ const { filesystem } = await load(
38
+ JSON.stringify({
39
+ openapi: "3.1.0",
40
+ info: {
41
+ title: "Hello World",
42
+ version: "1.0.0"
43
+ },
44
+ paths: {}
45
+ }),
46
+ {
47
+ plugins: [readFiles(), fetchUrls()]
48
+ }
49
+ );
50
+ expect(getEntrypoint(filesystem).specification).toMatchObject({
51
+ openapi: "3.1.0",
52
+ info: {
53
+ title: "Hello World",
54
+ version: "1.0.0"
55
+ },
56
+ paths: {}
57
+ });
58
+ });
59
+ it("loads YAML string", async () => {
60
+ const { filesystem } = await load(
61
+ stringify({
62
+ openapi: "3.1.0",
63
+ info: {
64
+ title: "Hello World",
65
+ version: "1.0.0"
66
+ },
67
+ paths: {}
68
+ }),
69
+ {
70
+ plugins: [readFiles(), fetchUrls()]
71
+ }
72
+ );
73
+ expect(getEntrypoint(filesystem).specification).toMatchObject({
74
+ openapi: "3.1.0",
75
+ info: {
76
+ title: "Hello World",
77
+ version: "1.0.0"
78
+ },
79
+ paths: {}
80
+ });
81
+ });
82
+ it("loads file", async () => {
83
+ const EXAMPLE_FILE = path.join(new URL(import.meta.url).pathname, "../../examples/openapi.yaml");
84
+ const { filesystem } = await load(EXAMPLE_FILE, {
85
+ plugins: [readFiles(), fetchUrls()]
86
+ });
87
+ expect(getEntrypoint(filesystem).specification).toMatchObject({
88
+ openapi: "3.1.0",
89
+ info: {
90
+ title: "Hello World",
91
+ version: "1.0.0"
92
+ },
93
+ paths: {}
94
+ });
95
+ });
96
+ it("loads referenced files in files", async () => {
97
+ const EXAMPLE_FILE = path.join(new URL(import.meta.url).pathname, "../../../../tests/filesystem/api/openapi.yaml");
98
+ const { filesystem } = await load(EXAMPLE_FILE, {
99
+ plugins: [readFiles()]
100
+ });
101
+ expect(filesystem.map((entry) => entry.filename)).toStrictEqual([
102
+ null,
103
+ "schemas/problem.yaml",
104
+ "schemas/upload.yaml",
105
+ "./components/coordinates.yaml"
106
+ ]);
107
+ expect(filesystem[0].specification).toBeTypeOf("object");
108
+ expect(filesystem.filter((entry) => entry.isEntrypoint).length).toBe(1);
109
+ });
110
+ it("loads url", async () => {
111
+ fetch.mockResolvedValue({
112
+ text: async () => stringify({
113
+ openapi: "3.1.0",
114
+ info: {
115
+ title: "Hello World",
116
+ version: "1.0.0"
117
+ },
118
+ paths: {}
119
+ })
120
+ });
121
+ const { filesystem } = await load("https://example.com/openapi.yaml", {
122
+ plugins: [readFiles(), fetchUrls()]
123
+ });
124
+ expect(getEntrypoint(filesystem).specification).toMatchObject({
125
+ openapi: "3.1.0",
126
+ info: {
127
+ title: "Hello World",
128
+ version: "1.0.0"
129
+ },
130
+ paths: {}
131
+ });
132
+ });
133
+ it("handles failed requests", async () => {
134
+ fetch.mockImplementation(() => {
135
+ throw new TypeError("[load.test.ts] fetch failed");
136
+ });
137
+ const { filesystem } = await load(
138
+ {
139
+ openapi: "3.1.0",
140
+ info: {
141
+ title: "Hello World",
142
+ version: "1.0.0"
143
+ },
144
+ paths: {
145
+ "/foobar": {
146
+ post: {
147
+ requestBody: {
148
+ content: {
149
+ "application/json": {
150
+ schema: {
151
+ $ref: "https://DOES_NOT_EXIST"
152
+ }
153
+ }
154
+ }
155
+ }
156
+ }
157
+ }
158
+ }
159
+ },
160
+ {
161
+ plugins: [readFiles(), fetchUrls()]
162
+ }
163
+ );
164
+ expect(getEntrypoint(filesystem).specification).toMatchObject({
165
+ openapi: "3.1.0",
166
+ info: {
167
+ title: "Hello World",
168
+ version: "1.0.0"
169
+ },
170
+ paths: {}
171
+ });
172
+ });
173
+ it("limits the number of requests", async () => {
174
+ fetch.mockResolvedValue({
175
+ text: async () => "FOOBAR"
176
+ });
177
+ const { filesystem } = await load(
178
+ {
179
+ openapi: "3.1.0",
180
+ info: {
181
+ title: "Hello World",
182
+ version: "1.0.0"
183
+ },
184
+ paths: {
185
+ "/foobar": {
186
+ post: {
187
+ requestBody: {
188
+ content: {
189
+ "application/json": {
190
+ schema: {
191
+ $ref: "https://DOES_NOT_EXIST"
192
+ }
193
+ }
194
+ }
195
+ }
196
+ }
197
+ }
198
+ }
199
+ },
200
+ {
201
+ plugins: [
202
+ fetchUrls({
203
+ limit: 0
204
+ })
205
+ ]
206
+ }
207
+ );
208
+ expect(filesystem.length).toBe(1);
209
+ });
210
+ it("loads referenced urls", async () => {
211
+ fetch.mockImplementation((url) => {
212
+ if (url === "https://example.com/openapi.yaml") {
213
+ return Promise.resolve({
214
+ text: () => Promise.resolve(
215
+ stringify({
216
+ openapi: "3.1.0",
217
+ info: {
218
+ title: "Hello World",
219
+ version: "1.0.0"
220
+ },
221
+ paths: {
222
+ "/foobar": {
223
+ post: {
224
+ requestBody: {
225
+ $ref: "https://example.com/foobar.json"
226
+ }
227
+ }
228
+ }
229
+ }
230
+ })
231
+ )
232
+ });
233
+ }
234
+ if (url === "https://example.com/foobar.json") {
235
+ return {
236
+ text: async () => JSON.stringify({
237
+ content: {
238
+ "application/json": {
239
+ schema: {
240
+ type: "string",
241
+ example: "foobar"
242
+ }
243
+ }
244
+ }
245
+ })
246
+ };
247
+ }
248
+ });
249
+ const { filesystem } = await load("https://example.com/openapi.yaml", {
250
+ plugins: [readFiles(), fetchUrls()]
251
+ });
252
+ expect(filesystem[0].specification).toMatchObject({
253
+ openapi: "3.1.0",
254
+ info: {
255
+ title: "Hello World",
256
+ version: "1.0.0"
257
+ },
258
+ paths: {
259
+ "/foobar": {
260
+ post: {
261
+ requestBody: {
262
+ $ref: "https://example.com/foobar.json"
263
+ }
264
+ }
265
+ }
266
+ }
267
+ });
268
+ expect(filesystem[1].specification).toMatchObject({
269
+ content: {
270
+ "application/json": {
271
+ schema: {
272
+ type: "string",
273
+ example: "foobar"
274
+ }
275
+ }
276
+ }
277
+ });
278
+ });
279
+ it("loads string with url reference", async () => {
280
+ fetch.mockResolvedValue({
281
+ text: async () => JSON.stringify({
282
+ content: {
283
+ "application/json": {
284
+ schema: {
285
+ type: "string",
286
+ example: "foobar"
287
+ }
288
+ }
289
+ }
290
+ })
291
+ });
292
+ const { filesystem } = await load(
293
+ stringify({
294
+ openapi: "3.1.0",
295
+ info: {
296
+ title: "Hello World",
297
+ version: "1.0.0"
298
+ },
299
+ paths: {
300
+ "/foobar": {
301
+ post: {
302
+ requestBody: {
303
+ $ref: "https://example.com/foobar.json"
304
+ }
305
+ }
306
+ }
307
+ }
308
+ }),
309
+ {
310
+ plugins: [readFiles(), fetchUrls()]
311
+ }
312
+ );
313
+ expect(filesystem.map((entry) => entry.filename)).toStrictEqual([null, "https://example.com/foobar.json"]);
314
+ expect(filesystem[0].specification).toMatchObject({
315
+ openapi: "3.1.0",
316
+ info: {
317
+ title: "Hello World",
318
+ version: "1.0.0"
319
+ },
320
+ paths: {
321
+ "/foobar": {
322
+ post: {
323
+ requestBody: {
324
+ $ref: "https://example.com/foobar.json"
325
+ }
326
+ }
327
+ }
328
+ }
329
+ });
330
+ expect(filesystem[1].specification).toMatchObject({
331
+ content: {
332
+ "application/json": {
333
+ schema: {
334
+ type: "string",
335
+ example: "foobar"
336
+ }
337
+ }
338
+ }
339
+ });
340
+ });
341
+ it("returns an error", async () => {
342
+ const { errors } = await load("INVALID", {
343
+ plugins: [readFiles(), fetchUrls()]
344
+ });
345
+ expect(errors).toMatchObject([
346
+ {
347
+ code: "EXTERNAL_REFERENCE_NOT_FOUND",
348
+ message: "Can\u2019t resolve external reference: INVALID"
349
+ }
350
+ ]);
351
+ });
352
+ it("throws an error", async () => {
353
+ expect(async () => {
354
+ await load("INVALID", {
355
+ plugins: [readFiles(), fetchUrls()],
356
+ throwOnError: true
357
+ });
358
+ }).rejects.toThrowError("Can\u2019t resolve external reference: INVALID");
359
+ });
360
+ });
361
+ //# sourceMappingURL=load.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/utils/load/load.test.ts"],
4
+ "sourcesContent": ["import path from 'node:path'\nimport { beforeEach, describe, expect, it, vi } from 'vitest'\nimport { stringify } from 'yaml'\n\nimport { fetchUrls } from '../../plugins/fetch-urls/fetchUrls'\nimport { readFiles } from '../../plugins/read-files/readFiles'\nimport { getEntrypoint } from '../getEntrypoint'\nimport { load } from './load'\n\nglobal.fetch = vi.fn()\n\ndescribe('load', async () => {\n beforeEach(() => {\n // @ts-expect-error\n global.fetch.mockReset()\n })\n\n it('loads JS object', async () => {\n const { filesystem } = await load(\n {\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {},\n },\n {\n plugins: [readFiles(), fetchUrls()],\n },\n )\n\n expect(getEntrypoint(filesystem).specification).toMatchObject({\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {},\n })\n })\n\n it('loads JSON string', async () => {\n const { filesystem } = await load(\n JSON.stringify({\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {},\n }),\n {\n plugins: [readFiles(), fetchUrls()],\n },\n )\n\n expect(getEntrypoint(filesystem).specification).toMatchObject({\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {},\n })\n })\n\n it('loads YAML string', async () => {\n const { filesystem } = await load(\n stringify({\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {},\n }),\n {\n plugins: [readFiles(), fetchUrls()],\n },\n )\n\n expect(getEntrypoint(filesystem).specification).toMatchObject({\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {},\n })\n })\n\n it('loads file', async () => {\n const EXAMPLE_FILE = path.join(new URL(import.meta.url).pathname, '../../examples/openapi.yaml')\n\n const { filesystem } = await load(EXAMPLE_FILE, {\n plugins: [readFiles(), fetchUrls()],\n })\n\n expect(getEntrypoint(filesystem).specification).toMatchObject({\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {},\n })\n })\n\n it('loads referenced files in files', async () => {\n const EXAMPLE_FILE = path.join(new URL(import.meta.url).pathname, '../../../../tests/filesystem/api/openapi.yaml')\n\n const { filesystem } = await load(EXAMPLE_FILE, {\n plugins: [readFiles()],\n })\n\n // filenames\n expect(filesystem.map((entry) => entry.filename)).toStrictEqual([\n null,\n 'schemas/problem.yaml',\n 'schemas/upload.yaml',\n './components/coordinates.yaml',\n ])\n\n // specification\n expect(filesystem[0].specification).toBeTypeOf('object')\n\n // only one entrypoint\n expect(filesystem.filter((entry) => entry.isEntrypoint).length).toBe(1)\n })\n\n it('loads url', async () => {\n // @ts-expect-error\n fetch.mockResolvedValue({\n text: async () =>\n stringify({\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {},\n }),\n })\n\n const { filesystem } = await load('https://example.com/openapi.yaml', {\n plugins: [readFiles(), fetchUrls()],\n })\n\n expect(getEntrypoint(filesystem).specification).toMatchObject({\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {},\n })\n })\n\n it('handles failed requests', async () => {\n // Failed request\n // @ts-expect-error\n fetch.mockImplementation(() => {\n throw new TypeError('[load.test.ts] fetch failed')\n })\n\n const { filesystem } = await load(\n {\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {\n '/foobar': {\n post: {\n requestBody: {\n content: {\n 'application/json': {\n schema: {\n $ref: 'https://DOES_NOT_EXIST',\n },\n },\n },\n },\n },\n },\n },\n },\n {\n plugins: [readFiles(), fetchUrls()],\n },\n )\n\n expect(getEntrypoint(filesystem).specification).toMatchObject({\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {},\n })\n })\n\n it('limits the number of requests', async () => {\n // @ts-expect-error\n fetch.mockResolvedValue({\n text: async () => 'FOOBAR',\n })\n\n const { filesystem } = await load(\n {\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {\n '/foobar': {\n post: {\n requestBody: {\n content: {\n 'application/json': {\n schema: {\n $ref: 'https://DOES_NOT_EXIST',\n },\n },\n },\n },\n },\n },\n },\n },\n {\n plugins: [\n fetchUrls({\n limit: 0,\n }),\n ],\n },\n )\n\n expect(filesystem.length).toBe(1)\n })\n\n it('loads referenced urls', async () => {\n // @ts-expect-error\n fetch.mockImplementation((url: string) => {\n if (url === 'https://example.com/openapi.yaml') {\n return Promise.resolve({\n text: () =>\n Promise.resolve(\n stringify({\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {\n '/foobar': {\n post: {\n requestBody: {\n $ref: 'https://example.com/foobar.json',\n },\n },\n },\n },\n }),\n ),\n } as Response)\n }\n\n if (url === 'https://example.com/foobar.json') {\n return {\n text: async () =>\n JSON.stringify({\n content: {\n 'application/json': {\n schema: {\n type: 'string',\n example: 'foobar',\n },\n },\n },\n }),\n } as Response\n }\n })\n\n const { filesystem } = await load('https://example.com/openapi.yaml', {\n plugins: [readFiles(), fetchUrls()],\n })\n\n expect(filesystem[0].specification).toMatchObject({\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {\n '/foobar': {\n post: {\n requestBody: {\n $ref: 'https://example.com/foobar.json',\n },\n },\n },\n },\n })\n\n expect(filesystem[1].specification).toMatchObject({\n content: {\n 'application/json': {\n schema: {\n type: 'string',\n example: 'foobar',\n },\n },\n },\n })\n })\n\n it('loads string with url reference', async () => {\n // @ts-expect-error\n fetch.mockResolvedValue({\n text: async () =>\n JSON.stringify({\n content: {\n 'application/json': {\n schema: {\n type: 'string',\n example: 'foobar',\n },\n },\n },\n }),\n })\n\n const { filesystem } = await load(\n stringify({\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {\n '/foobar': {\n post: {\n requestBody: {\n $ref: 'https://example.com/foobar.json',\n },\n },\n },\n },\n }),\n {\n plugins: [readFiles(), fetchUrls()],\n },\n )\n\n expect(filesystem.map((entry) => entry.filename)).toStrictEqual([null, 'https://example.com/foobar.json'])\n\n expect(filesystem[0].specification).toMatchObject({\n openapi: '3.1.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {\n '/foobar': {\n post: {\n requestBody: {\n $ref: 'https://example.com/foobar.json',\n },\n },\n },\n },\n })\n\n expect(filesystem[1].specification).toMatchObject({\n content: {\n 'application/json': {\n schema: {\n type: 'string',\n example: 'foobar',\n },\n },\n },\n })\n })\n\n it('returns an error', async () => {\n const { errors } = await load('INVALID', {\n plugins: [readFiles(), fetchUrls()],\n })\n\n expect(errors).toMatchObject([\n {\n code: 'EXTERNAL_REFERENCE_NOT_FOUND',\n message: 'Can\u2019t resolve external reference: INVALID',\n },\n ])\n })\n\n it('throws an error', async () => {\n expect(async () => {\n await load('INVALID', {\n plugins: [readFiles(), fetchUrls()],\n throwOnError: true,\n })\n }).rejects.toThrowError('Can\u2019t resolve external reference: INVALID')\n })\n})\n"],
5
+ "mappings": "AAAA,OAAO,UAAU;AACjB,SAAS,YAAY,UAAU,QAAQ,IAAI,UAAU;AACrD,SAAS,iBAAiB;AAE1B,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AAErB,OAAO,QAAQ,GAAG,GAAG;AAErB,SAAS,QAAQ,YAAY;AAC3B,aAAW,MAAM;AAEf,WAAO,MAAM,UAAU;AAAA,EACzB,CAAC;AAED,KAAG,mBAAmB,YAAY;AAChC,UAAM,EAAE,WAAW,IAAI,MAAM;AAAA,MAC3B;AA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AAA,QACP,SAAS;AAAA,MACX;AAAA,MACA,OAAO;AAAA,QACL,WAAW;AAAA,UACT,MAAM;AAAA,YACJ,aAAa;AAAA,cACX,MAAM;AAAA,YACR;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAED,WAAO,WAAW,CAAC,EAAE,aAAa,EAAE,cAAc;AAAA,MAChD,SAAS;AAAA,QACP,oBAAoB;AAAA,UAClB,QAAQ;AAAA,YACN,MAAM;AAAA,YACN,SAAS;AAAA,UACX;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AAED,KAAG,oBAAoB,YAAY;AACjC,UAAM,EAAE,OAAO,IAAI,MAAM,KAAK,WAAW;AAAA,MACvC,SAAS,CAAC,UAAU,GAAG,UAAU,CAAC;AAAA,IACpC,CAAC;AAED,WAAO,MAAM,EAAE,cAAc;AAAA,MAC3B;AAAA,QACE,MAAM;AAAA,QACN,SAAS;AAAA,MACX;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AAED,KAAG,mBAAmB,YAAY;AAChC,WAAO,YAAY;AACjB,YAAM,KAAK,WAAW;AAAA,QACpB,SAAS,CAAC,UAAU,GAAG,UAAU,CAAC;AAAA,QAClC,cAAc;AAAA,MAChB,CAAC;AAAA,IACH,CAAC,EAAE,QAAQ,aAAa,gDAA2C;AAAA,EACrE,CAAC;AACH,CAAC;",
6
+ "names": []
7
+ }
@@ -1,3 +1,3 @@
1
- import type { AnyObject, Filesystem, FilesystemEntry } from '../types/index.ts';
1
+ import type { AnyObject, Filesystem, FilesystemEntry } from '../types/index.js';
2
2
  export declare function makeFilesystem(value: string | AnyObject | Filesystem, overwrites?: Partial<FilesystemEntry>): Filesystem;
3
3
  //# sourceMappingURL=makeFilesystem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"makeFilesystem.d.ts","sourceRoot":"","sources":["../../src/utils/makeFilesystem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAK/E,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,EACtC,UAAU,GAAE,OAAO,CAAC,eAAe,CAAM,GACxC,UAAU,CAoBZ"}
1
+ {"version":3,"file":"makeFilesystem.d.ts","sourceRoot":"","sources":["../../src/utils/makeFilesystem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAK5E,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,EACtC,UAAU,GAAE,OAAO,CAAC,eAAe,CAAM,GACxC,UAAU,CAoBZ"}