@scalar/openapi-parser 0.11.1 → 0.13.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 (290) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/configuration/index.d.ts +2 -2
  3. package/dist/configuration/index.js +2 -2
  4. package/dist/configuration/index.js.map +1 -1
  5. package/dist/index.d.ts +17 -4
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +34 -4
  8. package/dist/index.js.map +2 -2
  9. package/dist/lib/Validator/Validator.d.ts.map +1 -1
  10. package/dist/lib/Validator/Validator.js +2 -2
  11. package/dist/lib/Validator/Validator.js.map +1 -1
  12. package/dist/lib/Validator/index.d.ts +1 -2
  13. package/dist/lib/Validator/index.d.ts.map +1 -1
  14. package/dist/lib/Validator/index.js +4 -2
  15. package/dist/lib/Validator/index.js.map +2 -2
  16. package/dist/plugins/fetch-urls/{fetchUrls.d.ts → fetch-urls.d.ts} +1 -1
  17. package/dist/plugins/fetch-urls/fetch-urls.d.ts.map +1 -0
  18. package/dist/plugins/fetch-urls/{fetchUrls.js → fetch-urls.js} +1 -1
  19. package/dist/plugins/fetch-urls/fetch-urls.js.map +7 -0
  20. package/dist/plugins/fetch-urls/index.d.ts +1 -1
  21. package/dist/plugins/fetch-urls/index.d.ts.map +1 -1
  22. package/dist/plugins/fetch-urls/index.js +5 -1
  23. package/dist/plugins/fetch-urls/index.js.map +2 -2
  24. package/dist/plugins/read-files/index.d.ts +1 -1
  25. package/dist/plugins/read-files/index.d.ts.map +1 -1
  26. package/dist/plugins/read-files/index.js +4 -1
  27. package/dist/plugins/read-files/index.js.map +2 -2
  28. package/dist/plugins/read-files/{readFiles.d.ts → read-files.d.ts} +1 -1
  29. package/dist/plugins/read-files/read-files.d.ts.map +1 -0
  30. package/dist/plugins/read-files/{readFiles.js → read-files.js} +3 -3
  31. package/dist/plugins/read-files/read-files.js.map +7 -0
  32. package/dist/polyfills/index.d.ts +1 -1
  33. package/dist/polyfills/index.d.ts.map +1 -1
  34. package/dist/polyfills/index.js +22 -2
  35. package/dist/polyfills/index.js.map +2 -2
  36. package/dist/types/index.d.ts.map +1 -1
  37. package/dist/utils/betterAjvErrors/validation-errors/base.js.map +1 -1
  38. package/dist/utils/dereference.d.ts +1 -1
  39. package/dist/utils/dereference.d.ts.map +1 -1
  40. package/dist/utils/dereference.js +3 -3
  41. package/dist/utils/dereference.js.map +1 -1
  42. package/dist/utils/details.d.ts +1 -2
  43. package/dist/utils/details.d.ts.map +1 -1
  44. package/dist/utils/details.js +12 -9
  45. package/dist/utils/details.js.map +2 -2
  46. package/dist/utils/{escapeJsonPointer.d.ts → escape-json-pointer.d.ts} +1 -1
  47. package/dist/utils/escape-json-pointer.d.ts.map +1 -0
  48. package/dist/utils/{escapeJsonPointer.js → escape-json-pointer.js} +1 -1
  49. package/dist/utils/{escapeJsonPointer.js.map → escape-json-pointer.js.map} +1 -1
  50. package/dist/utils/filter.d.ts.map +1 -1
  51. package/dist/utils/filter.js +2 -2
  52. package/dist/utils/filter.js.map +1 -1
  53. package/dist/utils/{getEntrypoint.d.ts → get-entrypoint.d.ts} +1 -1
  54. package/dist/utils/get-entrypoint.d.ts.map +1 -0
  55. package/dist/utils/{getEntrypoint.js → get-entrypoint.js} +1 -1
  56. package/dist/utils/get-entrypoint.js.map +7 -0
  57. package/dist/utils/{getListOfReferences.d.ts → get-list-of-references.d.ts} +1 -1
  58. package/dist/utils/get-list-of-references.d.ts.map +1 -0
  59. package/dist/utils/{getListOfReferences.js → get-list-of-references.js} +1 -1
  60. package/dist/utils/get-list-of-references.js.map +7 -0
  61. package/dist/utils/{getSegmentsFromPath.d.ts → get-segments-from-path.d.ts} +1 -1
  62. package/dist/utils/get-segments-from-path.d.ts.map +1 -0
  63. package/dist/utils/{getSegmentsFromPath.js → get-segments-from-path.js} +2 -2
  64. package/dist/utils/get-segments-from-path.js.map +7 -0
  65. package/dist/utils/{isFilesystem.d.ts → is-filesystem.d.ts} +1 -1
  66. package/dist/utils/is-filesystem.d.ts.map +1 -0
  67. package/dist/utils/{isFilesystem.js → is-filesystem.js} +1 -1
  68. package/dist/utils/is-filesystem.js.map +7 -0
  69. package/dist/utils/{isJson.d.ts → is-json.d.ts} +1 -1
  70. package/dist/utils/is-json.d.ts.map +1 -0
  71. package/dist/utils/{isJson.js → is-json.js} +1 -1
  72. package/dist/utils/{isJson.js.map → is-json.js.map} +1 -1
  73. package/dist/utils/{isObject.d.ts → is-object.d.ts} +1 -1
  74. package/dist/utils/is-object.d.ts.map +1 -0
  75. package/dist/utils/{isObject.js → is-object.js} +1 -1
  76. package/dist/utils/{isObject.js.map → is-object.js.map} +1 -1
  77. package/dist/utils/{isYaml.d.ts → is-yaml.d.ts} +1 -1
  78. package/dist/utils/is-yaml.d.ts.map +1 -0
  79. package/dist/utils/{isYaml.js → is-yaml.js} +1 -1
  80. package/dist/utils/{isYaml.js.map → is-yaml.js.map} +1 -1
  81. package/dist/utils/load/index.d.ts +1 -1
  82. package/dist/utils/load/index.d.ts.map +1 -1
  83. package/dist/utils/load/index.js +4 -1
  84. package/dist/utils/load/index.js.map +2 -2
  85. package/dist/utils/load/load.d.ts.map +1 -1
  86. package/dist/utils/load/load.js +4 -4
  87. package/dist/utils/load/load.js.map +1 -1
  88. package/dist/utils/{makeFilesystem.d.ts → make-filesystem.d.ts} +1 -1
  89. package/dist/utils/make-filesystem.d.ts.map +1 -0
  90. package/dist/utils/{makeFilesystem.js → make-filesystem.js} +3 -3
  91. package/dist/utils/make-filesystem.js.map +7 -0
  92. package/dist/utils/normalize.d.ts +1 -1
  93. package/dist/utils/normalize.d.ts.map +1 -1
  94. package/dist/utils/normalize.js +17 -12
  95. package/dist/utils/normalize.js.map +2 -2
  96. package/dist/utils/{resolveReferences.d.ts → resolve-references.d.ts} +1 -1
  97. package/dist/utils/resolve-references.d.ts.map +1 -0
  98. package/dist/utils/{resolveReferences.js → resolve-references.js} +15 -4
  99. package/dist/utils/resolve-references.js.map +7 -0
  100. package/dist/utils/{toJson.d.ts → to-json.d.ts} +1 -1
  101. package/dist/utils/to-json.d.ts.map +1 -0
  102. package/dist/utils/{toJson.js → to-json.js} +1 -1
  103. package/dist/utils/to-json.js.map +7 -0
  104. package/dist/utils/{toYaml.d.ts → to-yaml.d.ts} +1 -1
  105. package/dist/utils/to-yaml.d.ts.map +1 -0
  106. package/dist/utils/{toYaml.js → to-yaml.js} +1 -1
  107. package/dist/utils/{toYaml.js.map → to-yaml.js.map} +2 -2
  108. package/dist/utils/transform/sanitize.d.ts +2 -0
  109. package/dist/utils/transform/sanitize.d.ts.map +1 -1
  110. package/dist/utils/transform/sanitize.js.map +2 -2
  111. package/dist/utils/transform/utils/addInfoObject.d.ts.map +1 -1
  112. package/dist/utils/transform/utils/addInfoObject.js.map +1 -1
  113. package/dist/utils/transform/utils/addLatestOpenApiVersion.d.ts.map +1 -1
  114. package/dist/utils/transform/utils/addLatestOpenApiVersion.js.map +1 -1
  115. package/dist/utils/transform/utils/addMissingTags.d.ts.map +1 -1
  116. package/dist/utils/transform/utils/addMissingTags.js.map +1 -1
  117. package/dist/utils/transform/utils/normalizeSecuritySchemes.d.ts.map +1 -1
  118. package/dist/utils/transform/utils/normalizeSecuritySchemes.js.map +1 -1
  119. package/dist/utils/transform/utils/rejectSwaggerDocuments.d.ts.map +1 -1
  120. package/dist/utils/transform/utils/rejectSwaggerDocuments.js.map +1 -1
  121. package/dist/utils/{transformErrors.d.ts → transform-errors.d.ts} +1 -1
  122. package/dist/utils/transform-errors.d.ts.map +1 -0
  123. package/dist/utils/{transformErrors.js → transform-errors.js} +1 -1
  124. package/dist/utils/transform-errors.js.map +7 -0
  125. package/dist/utils/traverse.d.ts.map +1 -1
  126. package/dist/utils/traverse.js.map +1 -1
  127. package/dist/utils/{unescapeJsonPointer.d.ts → unescape-json-pointer.d.ts} +1 -1
  128. package/dist/utils/unescape-json-pointer.d.ts.map +1 -0
  129. package/dist/utils/{unescapeJsonPointer.js → unescape-json-pointer.js} +1 -1
  130. package/dist/utils/{unescapeJsonPointer.js.map → unescape-json-pointer.js.map} +1 -1
  131. package/dist/utils/{upgradeFromThreeToThreeOne.d.ts → upgrade-from-three-to-three-one.d.ts} +1 -1
  132. package/dist/utils/upgrade-from-three-to-three-one.d.ts.map +1 -0
  133. package/dist/utils/{upgradeFromThreeToThreeOne.js → upgrade-from-three-to-three-one.js} +1 -2
  134. package/dist/utils/upgrade-from-three-to-three-one.js.map +7 -0
  135. package/dist/utils/{upgradeFromTwoToThree.d.ts → upgrade-from-two-to-three.d.ts} +1 -1
  136. package/dist/utils/upgrade-from-two-to-three.d.ts.map +1 -0
  137. package/dist/utils/{upgradeFromTwoToThree.js → upgrade-from-two-to-three.js} +1 -1
  138. package/dist/utils/{upgradeFromTwoToThree.js.map → upgrade-from-two-to-three.js.map} +1 -1
  139. package/dist/utils/upgrade.bench.js +1 -1
  140. package/dist/utils/upgrade.bench.js.map +1 -1
  141. package/dist/utils/upgrade.d.ts.map +1 -1
  142. package/dist/utils/upgrade.js +4 -4
  143. package/dist/utils/upgrade.js.map +1 -1
  144. package/dist/utils/validate.d.ts.map +1 -1
  145. package/dist/utils/validate.js +1 -1
  146. package/dist/utils/validate.js.map +1 -1
  147. package/package.json +3 -3
  148. package/dist/lib/Validator/Validator.test.js +0 -8
  149. package/dist/lib/Validator/Validator.test.js.map +0 -7
  150. package/dist/plugins/fetch-urls/fetchUrls.d.ts.map +0 -1
  151. package/dist/plugins/fetch-urls/fetchUrls.js.map +0 -7
  152. package/dist/plugins/fetch-urls/fetchUrls.test.js +0 -50
  153. package/dist/plugins/fetch-urls/fetchUrls.test.js.map +0 -7
  154. package/dist/plugins/read-files/readFiles.d.ts.map +0 -1
  155. package/dist/plugins/read-files/readFiles.js.map +0 -7
  156. package/dist/plugins/read-files/readFiles.test.js +0 -20
  157. package/dist/plugins/read-files/readFiles.test.js.map +0 -7
  158. package/dist/utils/dereference.test.js +0 -300
  159. package/dist/utils/dereference.test.js.map +0 -7
  160. package/dist/utils/errors.test.js +0 -48
  161. package/dist/utils/errors.test.js.map +0 -7
  162. package/dist/utils/escapeJsonPointer.d.ts.map +0 -1
  163. package/dist/utils/escapeJsonPointer.test.js +0 -11
  164. package/dist/utils/escapeJsonPointer.test.js.map +0 -7
  165. package/dist/utils/getEntrypoint.d.ts.map +0 -1
  166. package/dist/utils/getEntrypoint.js.map +0 -7
  167. package/dist/utils/getEntrypoint.test.js +0 -18
  168. package/dist/utils/getEntrypoint.test.js.map +0 -7
  169. package/dist/utils/getListOfReferences.d.ts.map +0 -1
  170. package/dist/utils/getListOfReferences.js.map +0 -7
  171. package/dist/utils/getSegmentsFromPath.d.ts.map +0 -1
  172. package/dist/utils/getSegmentsFromPath.js.map +0 -7
  173. package/dist/utils/getSegmentsFromPath.test.js +0 -13
  174. package/dist/utils/getSegmentsFromPath.test.js.map +0 -7
  175. package/dist/utils/index.d.ts +0 -27
  176. package/dist/utils/index.d.ts.map +0 -1
  177. package/dist/utils/index.js +0 -27
  178. package/dist/utils/index.js.map +0 -7
  179. package/dist/utils/isFilesystem.d.ts.map +0 -1
  180. package/dist/utils/isFilesystem.js.map +0 -7
  181. package/dist/utils/isJson.d.ts.map +0 -1
  182. package/dist/utils/isObject.d.ts.map +0 -1
  183. package/dist/utils/isObject.test.js +0 -23
  184. package/dist/utils/isObject.test.js.map +0 -7
  185. package/dist/utils/isYaml.d.ts.map +0 -1
  186. package/dist/utils/load/load.test.js +0 -361
  187. package/dist/utils/load/load.test.js.map +0 -7
  188. package/dist/utils/makeFilesystem.d.ts.map +0 -1
  189. package/dist/utils/makeFilesystem.js.map +0 -7
  190. package/dist/utils/makeFilesystem.test.js +0 -15
  191. package/dist/utils/makeFilesystem.test.js.map +0 -7
  192. package/dist/utils/normalize.test.js +0 -88
  193. package/dist/utils/normalize.test.js.map +0 -7
  194. package/dist/utils/openapi/actions/details.d.ts +0 -7
  195. package/dist/utils/openapi/actions/details.d.ts.map +0 -1
  196. package/dist/utils/openapi/actions/details.js +0 -11
  197. package/dist/utils/openapi/actions/details.js.map +0 -7
  198. package/dist/utils/openapi/actions/files.d.ts +0 -6
  199. package/dist/utils/openapi/actions/files.d.ts.map +0 -1
  200. package/dist/utils/openapi/actions/files.js +0 -9
  201. package/dist/utils/openapi/actions/files.js.map +0 -7
  202. package/dist/utils/openapi/actions/get.d.ts +0 -6
  203. package/dist/utils/openapi/actions/get.d.ts.map +0 -1
  204. package/dist/utils/openapi/actions/get.js +0 -11
  205. package/dist/utils/openapi/actions/get.js.map +0 -7
  206. package/dist/utils/openapi/actions/toJson.d.ts +0 -6
  207. package/dist/utils/openapi/actions/toJson.d.ts.map +0 -1
  208. package/dist/utils/openapi/actions/toJson.js +0 -11
  209. package/dist/utils/openapi/actions/toJson.js.map +0 -7
  210. package/dist/utils/openapi/actions/toYaml.d.ts +0 -6
  211. package/dist/utils/openapi/actions/toYaml.d.ts.map +0 -1
  212. package/dist/utils/openapi/actions/toYaml.js +0 -11
  213. package/dist/utils/openapi/actions/toYaml.js.map +0 -7
  214. package/dist/utils/openapi/commands/dereferenceCommand.d.ts +0 -27
  215. package/dist/utils/openapi/commands/dereferenceCommand.d.ts.map +0 -1
  216. package/dist/utils/openapi/commands/dereferenceCommand.js +0 -27
  217. package/dist/utils/openapi/commands/dereferenceCommand.js.map +0 -7
  218. package/dist/utils/openapi/commands/filterCommand.d.ts +0 -41
  219. package/dist/utils/openapi/commands/filterCommand.d.ts.map +0 -1
  220. package/dist/utils/openapi/commands/filterCommand.js +0 -26
  221. package/dist/utils/openapi/commands/filterCommand.js.map +0 -7
  222. package/dist/utils/openapi/commands/loadCommand.d.ts +0 -8321
  223. package/dist/utils/openapi/commands/loadCommand.d.ts.map +0 -1
  224. package/dist/utils/openapi/commands/loadCommand.js +0 -42
  225. package/dist/utils/openapi/commands/loadCommand.js.map +0 -7
  226. package/dist/utils/openapi/commands/upgradeCommand.d.ts +0 -3406
  227. package/dist/utils/openapi/commands/upgradeCommand.d.ts.map +0 -1
  228. package/dist/utils/openapi/commands/upgradeCommand.js +0 -29
  229. package/dist/utils/openapi/commands/upgradeCommand.js.map +0 -7
  230. package/dist/utils/openapi/commands/validateCommand.d.ts +0 -3451
  231. package/dist/utils/openapi/commands/validateCommand.d.ts.map +0 -1
  232. package/dist/utils/openapi/commands/validateCommand.js +0 -33
  233. package/dist/utils/openapi/commands/validateCommand.js.map +0 -7
  234. package/dist/utils/openapi/index.d.ts +0 -2
  235. package/dist/utils/openapi/index.d.ts.map +0 -1
  236. package/dist/utils/openapi/index.js +0 -2
  237. package/dist/utils/openapi/index.js.map +0 -7
  238. package/dist/utils/openapi/openapi.d.ts +0 -1272
  239. package/dist/utils/openapi/openapi.d.ts.map +0 -1
  240. package/dist/utils/openapi/openapi.js +0 -15
  241. package/dist/utils/openapi/openapi.js.map +0 -7
  242. package/dist/utils/openapi/openapi.test-d.d.ts +0 -2
  243. package/dist/utils/openapi/openapi.test-d.d.ts.map +0 -1
  244. package/dist/utils/openapi/openapi.test-d.js +0 -14
  245. package/dist/utils/openapi/openapi.test-d.js.map +0 -7
  246. package/dist/utils/openapi/openapi.test.js +0 -309
  247. package/dist/utils/openapi/openapi.test.js.map +0 -7
  248. package/dist/utils/openapi/utils/queueTask.d.ts +0 -6
  249. package/dist/utils/openapi/utils/queueTask.d.ts.map +0 -1
  250. package/dist/utils/openapi/utils/queueTask.js +0 -10
  251. package/dist/utils/openapi/utils/queueTask.js.map +0 -7
  252. package/dist/utils/openapi/utils/workThroughQueue.d.ts +0 -6
  253. package/dist/utils/openapi/utils/workThroughQueue.d.ts.map +0 -1
  254. package/dist/utils/openapi/utils/workThroughQueue.js +0 -52
  255. package/dist/utils/openapi/utils/workThroughQueue.js.map +0 -7
  256. package/dist/utils/openapi/utils/workThroughQueue.test.js +0 -244
  257. package/dist/utils/openapi/utils/workThroughQueue.test.js.map +0 -7
  258. package/dist/utils/resolveReferences.d.ts.map +0 -1
  259. package/dist/utils/resolveReferences.js.map +0 -7
  260. package/dist/utils/resolveReferences.test.js +0 -567
  261. package/dist/utils/resolveReferences.test.js.map +0 -7
  262. package/dist/utils/toJson.d.ts.map +0 -1
  263. package/dist/utils/toJson.js.map +0 -7
  264. package/dist/utils/toYaml.d.ts.map +0 -1
  265. package/dist/utils/transform/index.d.ts +0 -2
  266. package/dist/utils/transform/index.d.ts.map +0 -1
  267. package/dist/utils/transform/index.js +0 -2
  268. package/dist/utils/transform/index.js.map +0 -7
  269. package/dist/utils/transform/sanitize.test.js +0 -148
  270. package/dist/utils/transform/sanitize.test.js.map +0 -7
  271. package/dist/utils/transformErrors.d.ts.map +0 -1
  272. package/dist/utils/transformErrors.js.map +0 -7
  273. package/dist/utils/transformErrors.test.js +0 -17
  274. package/dist/utils/transformErrors.test.js.map +0 -7
  275. package/dist/utils/traverse.test.js +0 -68
  276. package/dist/utils/traverse.test.js.map +0 -7
  277. package/dist/utils/unescapeJsonPointer.d.ts.map +0 -1
  278. package/dist/utils/unescapeJsonPointer.test.js +0 -19
  279. package/dist/utils/unescapeJsonPointer.test.js.map +0 -7
  280. package/dist/utils/upgrade.test.js +0 -57
  281. package/dist/utils/upgrade.test.js.map +0 -7
  282. package/dist/utils/upgradeFromThreeToThreeOne.d.ts.map +0 -1
  283. package/dist/utils/upgradeFromThreeToThreeOne.js.map +0 -7
  284. package/dist/utils/upgradeFromThreeToThreeOne.test.js +0 -462
  285. package/dist/utils/upgradeFromThreeToThreeOne.test.js.map +0 -7
  286. package/dist/utils/upgradeFromTwoToThree.d.ts.map +0 -1
  287. package/dist/utils/upgradeFromTwoToThree.test.js +0 -589
  288. package/dist/utils/upgradeFromTwoToThree.test.js.map +0 -7
  289. package/dist/utils/validate.test.js +0 -64
  290. package/dist/utils/validate.test.js.map +0 -7
@@ -1,567 +0,0 @@
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
@@ -1,7 +0,0 @@
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"],
5
- "mappings": "AAIA,OAAO,mBAAmB;AAC1B,OAAO,UAAU;AACjB,SAAS,UAAU,QAAQ,UAAU;AAErC,SAAS,iBAAiB;AAE1B,SAAS,YAAY;AACrB,SAAS,yBAAyB;AAElC,MAAM,eAAe,KAAK,KAAK,IAAI,IAAI,YAAY,GAAG,EAAE,UAAU,4CAA4C;AAE9G,SAAS,qBAAqB,MAAM;AAClC,KAAG,+BAA+B,YAAY;AAC5C,UAAM,gBAAgB;AAAA,MACpB,SAAS;AAAA,MACT,MAAM,CAAC;AAAA,MACP,OAAO;AAAA,QACL,WAAW;AAAA,UACT,MAAM;AAAA,YACJ,aAAa;AAAA,cACX,MAAM;AAAA,YACR;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,MACA,YAAY;AAAA,QACV,eAAe;AAAA,UACb,QAAQ;AAAA,YACN,SAAS,CAAC;AAAA,UACZ;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAGA,UAAM,EAAE,OAAO,IAAI,kBAAkB,aAAa;AAGlD,WAAO,OAAO,MAAM,SAAS,EAAE,KAAK,YAAY,OAAO,EAAE,IAAI,KAAK,MAAS;AAAA,EAC7E,CAAC;AAED,KAAG,yDAAoD,YAAY;AACjE,UAAM,gBAAgB;AAAA,MACpB,SAAS;AAAA,MACT,MAAM,CAAC;AAAA,MACP,OAAO;AAAA,QACL,WAAW;AAAA,UACT,MAAM;AAAA,YACJ,aAAa;AAAA,cACX,MAAM;AAAA,YACR;AAAA,UACF;A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AM,EAAE,OAAO,IAAI,kBAAkB,UAAU;AAG/C,WAAO,OAAO,WAAW,QAAQ,OAAO,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,aAAa;AAAA,EAC5E,CAAC;AAED,KAAG,0CAA0C,YAAY;AACvD,UAAM,aAAa;AAAA,MACjB;AAAA,QACE,KAAK;AAAA,QACL,cAAc;AAAA,QACd,YAAY,CAAC;AAAA,QACb,UAAU;AAAA,QACV,eAAe;AAAA,UACb,SAAS;AAAA,UACT,MAAM,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 +0,0 @@
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,7 +0,0 @@
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 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- export * from './sanitize.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/transform/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from "./sanitize.js";
2
- //# sourceMappingURL=index.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/utils/transform/index.ts"],
4
- "sourcesContent": ["export * from './sanitize'\n"],
5
- "mappings": "AAAA,cAAc;",
6
- "names": []
7
- }