@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,589 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { upgradeFromTwoToThree } from "./upgradeFromTwoToThree.js";
3
- describe("upgradeFromTwoToThree", () => {
4
- it("changes the version to from 3.0.0 to 3.1.0", async () => {
5
- const result = upgradeFromTwoToThree({
6
- swagger: "2.0",
7
- info: {
8
- title: "Hello World",
9
- version: "1.0.0"
10
- },
11
- paths: {}
12
- });
13
- expect(result.openapi).toBe("3.0.4");
14
- expect(result.swagger).toBeUndefined();
15
- });
16
- it("upgrades URLs to new server syntax", async () => {
17
- const result = upgradeFromTwoToThree({
18
- swagger: "2.0",
19
- basePath: "/v1",
20
- schemes: ["http"],
21
- host: "api.example.com"
22
- });
23
- expect(result.servers).toStrictEqual([
24
- {
25
- url: "http://api.example.com/v1"
26
- }
27
- ]);
28
- expect(result.basePath).toBeUndefined();
29
- expect(result.schemes).toBeUndefined();
30
- expect(result.host).toBeUndefined();
31
- });
32
- it("upgrades basePath to new server syntax", async () => {
33
- const result = upgradeFromTwoToThree({
34
- swagger: "2.0",
35
- basePath: "/v2"
36
- });
37
- expect(result.servers).toStrictEqual([
38
- {
39
- url: "/v2"
40
- }
41
- ]);
42
- expect(result.basePath).toBeUndefined();
43
- expect(result.schemes).toBeUndefined();
44
- expect(result.host).toBeUndefined();
45
- });
46
- it("upgrades host to new server syntax", async () => {
47
- const result = upgradeFromTwoToThree({
48
- swagger: "2.0",
49
- host: "api.example.com"
50
- });
51
- expect(result.servers).toStrictEqual([
52
- {
53
- url: "http://api.example.com"
54
- }
55
- ]);
56
- expect(result.basePath).toBeUndefined();
57
- expect(result.schemes).toBeUndefined();
58
- expect(result.host).toBeUndefined();
59
- });
60
- it("moves definitions to components", async () => {
61
- const result = upgradeFromTwoToThree({
62
- swagger: "2.0",
63
- definitions: {
64
- Category: {
65
- type: "object",
66
- properties: {
67
- id: {
68
- type: "integer",
69
- format: "int64"
70
- }
71
- }
72
- }
73
- }
74
- });
75
- expect(result.components?.schemas).toStrictEqual({
76
- Category: {
77
- type: "object",
78
- properties: {
79
- id: {
80
- type: "integer",
81
- format: "int64"
82
- }
83
- }
84
- }
85
- });
86
- expect(result.definitions).toBeUndefined();
87
- });
88
- it("rewrites $refs to definitions", async () => {
89
- const result = upgradeFromTwoToThree({
90
- swagger: "2.0",
91
- paths: {
92
- "/planets": {
93
- get: {
94
- responses: {
95
- "200": {
96
- schema: {
97
- $ref: "#/definitions/Planet"
98
- }
99
- }
100
- }
101
- }
102
- }
103
- },
104
- definitions: {
105
- Planet: {
106
- type: "object",
107
- properties: {
108
- name: { type: "string" }
109
- }
110
- }
111
- }
112
- });
113
- expect(result.paths["/planets"].get.responses["200"].content["application/json"].schema.$ref).toBe(
114
- "#/components/schemas/Planet"
115
- );
116
- });
117
- it("transforms responses", async () => {
118
- const result = upgradeFromTwoToThree({
119
- swagger: "2.0",
120
- paths: {
121
- "/planets": {
122
- get: {
123
- description: "Returns all planets from the system that the user has access to",
124
- produces: ["application/json", "application/xml"],
125
- responses: {
126
- "200": {
127
- description: "A list of planets.",
128
- schema: {
129
- type: "array",
130
- items: {
131
- $ref: "#/definitions/planet"
132
- }
133
- }
134
- }
135
- }
136
- }
137
- }
138
- }
139
- });
140
- expect(result.paths).toStrictEqual({
141
- "/planets": {
142
- get: {
143
- description: "Returns all planets from the system that the user has access to",
144
- responses: {
145
- "200": {
146
- description: "A list of planets.",
147
- content: {
148
- "application/json": {
149
- schema: {
150
- type: "array",
151
- items: {
152
- $ref: "#/definitions/planet"
153
- }
154
- }
155
- },
156
- "application/xml": {
157
- schema: {
158
- type: "array",
159
- items: {
160
- $ref: "#/definitions/planet"
161
- }
162
- }
163
- }
164
- }
165
- }
166
- }
167
- }
168
- }
169
- });
170
- expect(result.paths["/planets"].get.produces).toBeUndefined();
171
- });
172
- it("uses global produces for responses", async () => {
173
- const result = upgradeFromTwoToThree({
174
- swagger: "2.0",
175
- produces: ["application/json", "application/xml"],
176
- paths: {
177
- "/planets": {
178
- get: {
179
- description: "Returns all planets from the system that the user has access to",
180
- responses: {
181
- "200": {
182
- description: "A list of planets.",
183
- schema: {
184
- type: "array",
185
- items: {
186
- $ref: "#/definitions/Planet"
187
- }
188
- }
189
- }
190
- }
191
- }
192
- }
193
- }
194
- });
195
- expect(result.paths).toStrictEqual({
196
- "/planets": {
197
- get: {
198
- description: "Returns all planets from the system that the user has access to",
199
- responses: {
200
- "200": {
201
- description: "A list of planets.",
202
- content: {
203
- "application/json": {
204
- schema: {
205
- type: "array",
206
- items: {
207
- $ref: "#/definitions/Planet"
208
- }
209
- }
210
- },
211
- "application/xml": {
212
- schema: {
213
- type: "array",
214
- items: {
215
- $ref: "#/definitions/Planet"
216
- }
217
- }
218
- }
219
- }
220
- }
221
- }
222
- }
223
- }
224
- });
225
- expect(result.paths["/planets"].get.produces).toBeUndefined();
226
- });
227
- it("transforms requestBody", async () => {
228
- const result = upgradeFromTwoToThree({
229
- swagger: "2.0",
230
- paths: {
231
- "/planets": {
232
- get: {
233
- description: "Returns all planets from the system that the user has access to",
234
- consumes: ["application/json", "application/xml"],
235
- parameters: [
236
- {
237
- in: "body",
238
- name: "body",
239
- description: "Planet object that needs to be added to the store",
240
- required: true,
241
- schema: {
242
- $ref: "#/definitions/Planet"
243
- }
244
- }
245
- ]
246
- }
247
- }
248
- }
249
- });
250
- expect(result.paths).toStrictEqual({
251
- "/planets": {
252
- get: {
253
- description: "Returns all planets from the system that the user has access to",
254
- requestBody: {
255
- description: "Planet object that needs to be added to the store",
256
- content: {
257
- "application/json": {
258
- schema: {
259
- $ref: "#/definitions/Planet"
260
- }
261
- },
262
- "application/xml": {
263
- schema: {
264
- $ref: "#/definitions/Planet"
265
- }
266
- }
267
- },
268
- required: true
269
- }
270
- }
271
- }
272
- });
273
- expect(result.paths["/planets"].get.produces).toBeUndefined();
274
- });
275
- it("uses global consumes for requestBody", async () => {
276
- const result = upgradeFromTwoToThree({
277
- swagger: "2.0",
278
- produces: ["application/json", "application/xml"],
279
- paths: {
280
- "/planets": {
281
- get: {
282
- description: "Returns all planets from the system that the user has access to",
283
- consumes: ["application/json", "application/xml"],
284
- parameters: [
285
- {
286
- in: "body",
287
- name: "body",
288
- description: "Planet object that needs to be added to the store",
289
- required: true,
290
- schema: {
291
- $ref: "#/definitions/Planet"
292
- }
293
- }
294
- ]
295
- }
296
- }
297
- }
298
- });
299
- expect(result.paths).toStrictEqual({
300
- "/planets": {
301
- get: {
302
- description: "Returns all planets from the system that the user has access to",
303
- requestBody: {
304
- description: "Planet object that needs to be added to the store",
305
- content: {
306
- "application/json": {
307
- schema: {
308
- $ref: "#/definitions/Planet"
309
- }
310
- },
311
- "application/xml": {
312
- schema: {
313
- $ref: "#/definitions/Planet"
314
- }
315
- }
316
- },
317
- required: true
318
- }
319
- }
320
- }
321
- });
322
- expect(result.paths["/planets"].get.produces).toBeUndefined();
323
- });
324
- it("migrates formData", async () => {
325
- const result = upgradeFromTwoToThree({
326
- swagger: "2.0",
327
- paths: {
328
- "/planets": {
329
- get: {
330
- description: "Returns all planets from the system that the user has access to",
331
- parameters: [
332
- {
333
- name: "additionalMetadata",
334
- in: "formData",
335
- description: "Additional data to pass to server",
336
- required: true,
337
- type: "string"
338
- }
339
- ]
340
- }
341
- }
342
- }
343
- });
344
- expect(result.paths).toStrictEqual({
345
- "/planets": {
346
- get: {
347
- description: "Returns all planets from the system that the user has access to",
348
- requestBody: {
349
- content: {
350
- "application/x-www-form-urlencoded": {
351
- schema: {
352
- required: ["additionalMetadata"],
353
- properties: {
354
- additionalMetadata: {
355
- description: "Additional data to pass to server",
356
- type: "string"
357
- }
358
- },
359
- type: "object"
360
- }
361
- }
362
- }
363
- }
364
- }
365
- }
366
- });
367
- expect(result.paths["/planets"].get.produces).toBeUndefined();
368
- });
369
- it("upgrades securityDefinitions from Swagger 2.0 to OpenAPI 3.0", () => {
370
- const input = {
371
- swagger: "2.0",
372
- securityDefinitions: {
373
- api_key: {
374
- type: "apiKey",
375
- name: "api_key",
376
- in: "header"
377
- },
378
- petstore_auth: {
379
- type: "oauth2",
380
- authorizationUrl: "https://petstore.swagger.io/oauth/authorize",
381
- flow: "implicit",
382
- scopes: {
383
- "read:pets": "read your pets",
384
- "write:pets": "modify pets in your account"
385
- }
386
- }
387
- },
388
- paths: {
389
- "/pets": {
390
- get: {
391
- summary: "List all pets",
392
- security: [
393
- {
394
- petstore_auth: ["read:pets"]
395
- }
396
- ]
397
- }
398
- }
399
- }
400
- };
401
- const result = upgradeFromTwoToThree(input);
402
- expect(result.components.securitySchemes).toStrictEqual({
403
- api_key: {
404
- type: "apiKey",
405
- name: "api_key",
406
- in: "header"
407
- },
408
- petstore_auth: {
409
- type: "oauth2",
410
- flows: {
411
- implicit: {
412
- authorizationUrl: "https://petstore.swagger.io/oauth/authorize",
413
- scopes: {
414
- "read:pets": "read your pets",
415
- "write:pets": "modify pets in your account"
416
- }
417
- }
418
- }
419
- }
420
- });
421
- expect(result.securityDefinitions).toBeUndefined();
422
- expect(result.paths["/pets"].get.security).toStrictEqual([
423
- {
424
- petstore_auth: ["read:pets"]
425
- }
426
- ]);
427
- });
428
- it("transforms parameter schemas", () => {
429
- const result = upgradeFromTwoToThree({
430
- swagger: "2.0",
431
- produces: ["application/json", "application/xml"],
432
- paths: {
433
- "/planets": {
434
- get: {
435
- description: "Returns all planets from the system that the user has access to",
436
- consumes: ["application/json", "application/xml"],
437
- parameters: [
438
- {
439
- in: "header",
440
- name: "x-custom-header",
441
- required: true,
442
- type: "string",
443
- format: "date-time",
444
- allowEmptyValue: true
445
- },
446
- {
447
- in: "query",
448
- name: "size",
449
- required: false,
450
- type: "integer",
451
- multipleOf: 2,
452
- minimum: 1,
453
- maximum: 100
454
- }
455
- ]
456
- }
457
- }
458
- }
459
- });
460
- expect(result.paths["/planets"].get.parameters).toHaveLength(2);
461
- expect(result.paths["/planets"].get.parameters[0]).toStrictEqual({
462
- in: "header",
463
- name: "x-custom-header",
464
- required: true,
465
- allowEmptyValue: true,
466
- schema: {
467
- type: "string",
468
- format: "date-time"
469
- }
470
- });
471
- expect(result.paths["/planets"].get.parameters[1]).toStrictEqual({
472
- in: "query",
473
- name: "size",
474
- required: false,
475
- schema: {
476
- type: "integer",
477
- multipleOf: 2,
478
- minimum: 1,
479
- maximum: 100
480
- }
481
- });
482
- });
483
- it("transforms basic security scheme", () => {
484
- const result = upgradeFromTwoToThree({
485
- swagger: "2.0",
486
- paths: {},
487
- securityDefinitions: {
488
- basic_auth: {
489
- type: "basic",
490
- name: "basic_auth",
491
- in: "header"
492
- }
493
- }
494
- });
495
- expect(result.components.securitySchemes.basic_auth).toStrictEqual({
496
- type: "http",
497
- scheme: "basic"
498
- });
499
- });
500
- it("transforms file type", () => {
501
- const result = upgradeFromTwoToThree({
502
- swagger: "2.0",
503
- produces: ["image/png"],
504
- paths: {
505
- "/planets": {
506
- post: {
507
- description: "Creates planet.",
508
- consumes: ["image/png"],
509
- parameters: [
510
- {
511
- in: "body",
512
- required: true,
513
- schema: {
514
- type: "file"
515
- }
516
- }
517
- ]
518
- }
519
- }
520
- }
521
- });
522
- expect(result.paths["/planets"].post.requestBody).toStrictEqual({
523
- required: true,
524
- content: {
525
- "image/png": {
526
- schema: {
527
- type: "string",
528
- format: "binary"
529
- }
530
- }
531
- }
532
- });
533
- });
534
- it("transform response headers", () => {
535
- const result = upgradeFromTwoToThree({
536
- swagger: "2.0",
537
- produces: ["application/json"],
538
- paths: {
539
- "/planets": {
540
- get: {
541
- description: "Get all planets from the system that the user has access to.",
542
- consumes: ["application/json"],
543
- responses: {
544
- "200": {
545
- description: "A list of planets.",
546
- headers: {
547
- next: {
548
- description: "link to next page",
549
- type: "string",
550
- maxLength: 100
551
- }
552
- },
553
- schema: {
554
- type: "array",
555
- items: {
556
- $ref: "#/definitions/planet"
557
- }
558
- }
559
- }
560
- }
561
- }
562
- }
563
- }
564
- });
565
- expect(result.paths["/planets"].get.responses["200"]).toStrictEqual({
566
- description: "A list of planets.",
567
- content: {
568
- "application/json": {
569
- schema: {
570
- type: "array",
571
- items: {
572
- $ref: "#/definitions/planet"
573
- }
574
- }
575
- }
576
- },
577
- headers: {
578
- next: {
579
- description: "link to next page",
580
- schema: {
581
- type: "string",
582
- maxLength: 100
583
- }
584
- }
585
- }
586
- });
587
- });
588
- });
589
- //# sourceMappingURL=upgradeFromTwoToThree.test.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/utils/upgradeFromTwoToThree.test.ts"],
4
- "sourcesContent": ["import { describe, expect, it } from 'vitest'\n\nimport { upgradeFromTwoToThree } from './upgradeFromTwoToThree'\n\ndescribe('upgradeFromTwoToThree', () => {\n it('changes the version to from 3.0.0 to 3.1.0', async () => {\n const result = upgradeFromTwoToThree({\n swagger: '2.0',\n info: {\n title: 'Hello World',\n version: '1.0.0',\n },\n paths: {},\n })\n\n expect(result.openapi).toBe('3.0.4')\n expect(result.swagger).toBeUndefined()\n })\n\n it('upgrades URLs to new server syntax', async () => {\n const result = upgradeFromTwoToThree({\n swagger: '2.0',\n basePath: '/v1',\n schemes: ['http'],\n host: 'api.example.com',\n })\n\n expect(result.servers).toStrictEqual([\n {\n url: 'http://api.example.com/v1',\n },\n ])\n\n expect(result.basePath).toBeUndefined()\n expect(result.schemes).toBeUndefined()\n expect(result.host).toBeUndefined()\n })\n\n it('upgrades basePath to new server syntax', async () => {\n const result = upgradeFromTwoToThree({\n swagger: '2.0',\n basePath: '/v2',\n })\n\n expect(result.servers).toStrictEqual([\n {\n url: '/v2',\n },\n ])\n\n expect(result.basePath).toBeUndefined()\n expect(result.schemes).toBeUndefined()\n expect(result.host).toBeUndefined()\n })\n\n it('upgrades host to new server syntax', async () => {\n const result = upgradeFromTwoToThree({\n swagger: '2.0',\n host: 'api.example.com',\n })\n\n expect(result.servers).toStrictEqual([\n {\n url: 'http://api.example.com',\n },\n ])\n\n expect(result.basePath).toBeUndefined()\n expect(result.schemes).toBeUndefined()\n expect(result.host).toBeUndefined()\n })\n\n it('moves definitions to components', async () => {\n const result = upgradeFromTwoToThree({\n swagger: '2.0',\n definitions: {\n Category: {\n type: 'object',\n properties: {\n id: {\n type: 'integer',\n format: 'int64',\n },\n },\n },\n },\n })\n\n // @ts-expect-error it\u2019s fine\n expect(result.components?.schemas).toStrictEqual({\n Category: {\n type: 'object',\n properties: {\n id: {\n type: 'integer',\n format: 'int64',\n },\n },\n },\n })\n\n expect(result.definitions).toBeUndefined()\n })\n\n it('rewrites $refs to definitions', async () => {\n const result = upgradeFromTwoToThree({\n swagger: '2.0',\n paths: {\n '/planets': {\n get: {\n responses: {\n '200': {\n schema: {\n $ref: '#/definitions/Planet',\n },\n },\n },\n },\n },\n },\n definitions: {\n Planet: {\n type: 'object',\n properties: {\n name: { type: 'string' },\n },\n },\n },\n })\n expect(result.paths['/planets'].get.responses['200'].content['application/json'].schema.$ref).toBe(\n '#/components/schemas/Planet',\n )\n })\n\n it('transforms responses', async () => {\n const result = upgradeFromTwoToThree({\n swagger: '2.0',\n paths: {\n '/planets': {\n get: {\n description: 'Returns all planets from the system that the user has access to',\n produces: ['application/json', 'application/xml'],\n responses: {\n '200': {\n description: 'A list of planets.',\n schema: {\n type: 'array',\n items: {\n $ref: '#/definitions/planet',\n },\n },\n },\n },\n },\n },\n },\n })\n\n expect(result.paths).toStrictEqual({\n '/planets': {\n get: {\n description: 'Returns all planets from the system that the user has access to',\n responses: {\n '200': {\n description: 'A list of planets.',\n content: {\n 'application/json': {\n schema: {\n type: 'array',\n items: {\n $ref: '#/definitions/planet',\n },\n },\n },\n 'application/xml': {\n schema: {\n type: 'array',\n items: {\n $ref: '#/definitions/planet',\n },\n },\n },\n },\n },\n },\n },\n },\n })\n\n expect(result.paths['/planets'].get.produces).toBeUndefined()\n })\n\n it('uses global produces for responses', async () => {\n const result = upgradeFromTwoToThree({\n swagger: '2.0',\n produces: ['application/json', 'application/xml'],\n paths: {\n '/planets': {\n get: {\n description: 'Returns all planets from the system that the user has access to',\n responses: {\n '200': {\n description: 'A list of planets.',\n schema: {\n type: 'array',\n items: {\n $ref: '#/definitions/Planet',\n },\n },\n },\n },\n },\n },\n },\n })\n\n expect(result.paths).toStrictEqual({\n '/planets': {\n get: {\n description: 'Returns all planets from the system that the user has access to',\n responses: {\n '200': {\n description: 'A list of planets.',\n content: {\n 'application/json': {\n schema: {\n type: 'array',\n items: {\n $ref: '#/definitions/Planet',\n },\n },\n },\n 'application/xml': {\n schema: {\n type: 'array',\n items: {\n $ref: '#/definitions/Planet',\n },\n },\n },\n },\n },\n },\n },\n },\n })\n\n expect(result.paths['/planets'].get.produces).toBeUndefined()\n })\n\n it('transforms requestBody', async () => {\n const result = upgradeFromTwoToThree({\n swagger: '2.0',\n\n paths: {\n '/planets': {\n get: {\n description: 'Returns all planets from the system that the user has access to',\n consumes: ['application/json', 'application/xml'],\n parameters: [\n {\n in: 'body',\n name: 'body',\n description: 'Planet object that needs to be added to the store',\n required: true,\n schema: {\n $ref: '#/definitions/Planet',\n },\n },\n ],\n },\n },\n },\n })\n\n expect(result.paths).toStrictEqual({\n '/planets': {\n get: {\n description: 'Returns all planets from the system that the user has access to',\n requestBody: {\n description: 'Planet object that needs to be added to the store',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/definitions/Planet',\n },\n },\n 'application/xml': {\n schema: {\n $ref: '#/definitions/Planet',\n },\n },\n },\n required: true,\n },\n },\n },\n })\n\n expect(result.paths['/planets'].get.produces).toBeUndefined()\n })\n\n it('uses global consumes for requestBody', async () => {\n const result = upgradeFromTwoToThree({\n swagger: '2.0',\n produces: ['application/json', 'application/xml'],\n paths: {\n '/planets': {\n get: {\n description: 'Returns all planets from the system that the user has access to',\n consumes: ['application/json', 'application/xml'],\n parameters: [\n {\n in: 'body',\n name: 'body',\n description: 'Planet object that needs to be added to the store',\n required: true,\n schema: {\n $ref: '#/definitions/Planet',\n },\n },\n ],\n },\n },\n },\n })\n\n expect(result.paths).toStrictEqual({\n '/planets': {\n get: {\n description: 'Returns all planets from the system that the user has access to',\n requestBody: {\n description: 'Planet object that needs to be added to the store',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/definitions/Planet',\n },\n },\n 'application/xml': {\n schema: {\n $ref: '#/definitions/Planet',\n },\n },\n },\n required: true,\n },\n },\n },\n })\n\n expect(result.paths['/planets'].get.produces).toBeUndefined()\n })\n\n it('migrates formData', async () => {\n const result = upgradeFromTwoToThree({\n swagger: '2.0',\n paths: {\n '/planets': {\n get: {\n description: 'Returns all planets from the system that the user has access to',\n parameters: [\n {\n name: 'additionalMetadata',\n in: 'formData',\n description: 'Additional data to pass to server',\n required: true,\n type: 'string',\n },\n ],\n },\n },\n },\n })\n\n expect(result.paths).toStrictEqual({\n '/planets': {\n get: {\n description: 'Returns all planets from the system that the user has access to',\n requestBody: {\n content: {\n 'application/x-www-form-urlencoded': {\n schema: {\n required: ['additionalMetadata'],\n properties: {\n additionalMetadata: {\n description: 'Additional data to pass to server',\n type: 'string',\n },\n },\n type: 'object',\n },\n },\n },\n },\n },\n },\n })\n\n expect(result.paths['/planets'].get.produces).toBeUndefined()\n })\n\n it('upgrades securityDefinitions from Swagger 2.0 to OpenAPI 3.0', () => {\n const input = {\n swagger: '2.0',\n securityDefinitions: {\n api_key: {\n type: 'apiKey',\n name: 'api_key',\n in: 'header',\n },\n petstore_auth: {\n type: 'oauth2',\n authorizationUrl: 'https://petstore.swagger.io/oauth/authorize',\n flow: 'implicit',\n scopes: {\n 'read:pets': 'read your pets',\n 'write:pets': 'modify pets in your account',\n },\n },\n },\n paths: {\n '/pets': {\n get: {\n summary: 'List all pets',\n security: [\n {\n petstore_auth: ['read:pets'],\n },\n ],\n },\n },\n },\n }\n\n const result = upgradeFromTwoToThree(input)\n\n // @ts-expect-error it\u2019s fine\n expect(result.components.securitySchemes).toStrictEqual({\n api_key: {\n type: 'apiKey',\n name: 'api_key',\n in: 'header',\n },\n petstore_auth: {\n type: 'oauth2',\n flows: {\n implicit: {\n authorizationUrl: 'https://petstore.swagger.io/oauth/authorize',\n scopes: {\n 'read:pets': 'read your pets',\n 'write:pets': 'modify pets in your account',\n },\n },\n },\n },\n })\n\n expect(result.securityDefinitions).toBeUndefined()\n\n // Check if the security attribute in the operation is upgraded\n expect(result.paths['/pets'].get.security).toStrictEqual([\n {\n petstore_auth: ['read:pets'],\n },\n ])\n })\n\n it('transforms parameter schemas', () => {\n const result = upgradeFromTwoToThree({\n swagger: '2.0',\n produces: ['application/json', 'application/xml'],\n paths: {\n '/planets': {\n get: {\n description: 'Returns all planets from the system that the user has access to',\n consumes: ['application/json', 'application/xml'],\n parameters: [\n {\n in: 'header',\n name: 'x-custom-header',\n required: true,\n type: 'string',\n format: 'date-time',\n allowEmptyValue: true,\n },\n {\n in: 'query',\n name: 'size',\n required: false,\n type: 'integer',\n multipleOf: 2,\n minimum: 1,\n maximum: 100,\n },\n ],\n },\n },\n },\n })\n\n expect(result.paths['/planets'].get.parameters).toHaveLength(2)\n expect(result.paths['/planets'].get.parameters[0]).toStrictEqual({\n in: 'header',\n name: 'x-custom-header',\n required: true,\n allowEmptyValue: true,\n schema: {\n type: 'string',\n format: 'date-time',\n },\n })\n expect(result.paths['/planets'].get.parameters[1]).toStrictEqual({\n in: 'query',\n name: 'size',\n required: false,\n schema: {\n type: 'integer',\n multipleOf: 2,\n minimum: 1,\n maximum: 100,\n },\n })\n })\n\n it('transforms basic security scheme', () => {\n const result = upgradeFromTwoToThree({\n swagger: '2.0',\n paths: {},\n securityDefinitions: {\n basic_auth: {\n type: 'basic',\n name: 'basic_auth',\n in: 'header',\n },\n },\n })\n\n // @ts-expect-error it\u2019s fine\n expect(result.components.securitySchemes.basic_auth).toStrictEqual({\n type: 'http',\n scheme: 'basic',\n })\n })\n\n it('transforms file type', () => {\n const result = upgradeFromTwoToThree({\n swagger: '2.0',\n produces: ['image/png'],\n paths: {\n '/planets': {\n post: {\n description: 'Creates planet.',\n consumes: ['image/png'],\n parameters: [\n {\n in: 'body',\n required: true,\n schema: {\n type: 'file',\n },\n },\n ],\n },\n },\n },\n })\n\n expect(result.paths['/planets'].post.requestBody).toStrictEqual({\n required: true,\n content: {\n 'image/png': {\n schema: {\n type: 'string',\n format: 'binary',\n },\n },\n },\n })\n })\n\n it('transform response headers', () => {\n const result = upgradeFromTwoToThree({\n swagger: '2.0',\n produces: ['application/json'],\n paths: {\n '/planets': {\n get: {\n description: 'Get all planets from the system that the user has access to.',\n consumes: ['application/json'],\n responses: {\n '200': {\n description: 'A list of planets.',\n headers: {\n next: {\n description: 'link to next page',\n type: 'string',\n maxLength: 100,\n },\n },\n schema: {\n type: 'array',\n items: {\n $ref: '#/definitions/planet',\n },\n },\n },\n },\n },\n },\n },\n })\n\n expect(result.paths['/planets'].get.responses['200']).toStrictEqual({\n description: 'A list of planets.',\n content: {\n 'application/json': {\n schema: {\n type: 'array',\n items: {\n $ref: '#/definitions/planet',\n },\n },\n },\n },\n headers: {\n next: {\n description: 'link to next page',\n schema: {\n type: 'string',\n maxLength: 100,\n },\n },\n },\n })\n })\n})\n"],
5
- "mappings": "AAAA,SAAS,UAAU,QAAQ,UAAU;AAErC,SAAS,6BAA6B;AAEtC,SAAS,yBAAyB,MAAM;AACtC,KAAG,8CAA8C,YAAY;AAC3D,UAAM,SAAS,sBAAsB;AAAA,MACnC,SAAS;AAAA,MACT,MAAM;AAAA,QACJ,OAAO;AAAA,QACP,SAAS;AAAA,MACX;AAAA,MACA,OAAO,CAAC;AAAA,IACV,CAAC;AAED,WAAO,OAAO,OAAO,EAAE,KAAK,OAAO;AACnC,WAAO,OAAO,OAAO,EAAE,cAAc;AAAA,EACvC,CAAC;AAED,KAAG,sCAAsC,YAAY;AACnD,UAAM,SAAS,sBAAsB;AAAA,MACnC,SAAS;AAAA,MACT,UAAU;AAAA,MACV,SAAS,CAAC,MAAM;AAAA,MAChB,MAAM;AAAA,IACR,CAAC;AAED,WAAO,OAAO,OAAO,EAAE,cAAc;AAAA,MACnC;AAAA,QACE,KAAK;AAAA,MACP;AAAA,IACF,CAAC;AAED,WAAO,OAAO,QAAQ,EAAE,cAAc;AACtC,WAAO,OAAO,OAAO,EAAE,cAAc;AACrC,WAAO,OAAO,IAAI,EAAE,cAAc;AAAA,EACpC,CAAC;AAED,KAAG,0CAA0C,YAAY;AACvD,UAAM,SAAS,sBAAsB;AAAA,MACnC,SAAS;AAAA,MACT,UAAU;AAAA,I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