@scalar/openapi-parser 0.10.16 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +0 -27
- package/dist/configuration/index.js +19 -22
- package/dist/configuration/index.js.map +7 -0
- package/dist/declarations.d.js +1 -0
- package/dist/declarations.d.js.map +7 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -29
- package/dist/index.js.map +7 -0
- package/dist/lib/Validator/Validator.d.ts +2 -2
- package/dist/lib/Validator/Validator.d.ts.map +1 -1
- package/dist/lib/Validator/Validator.js +99 -119
- package/dist/lib/Validator/Validator.js.map +7 -0
- package/dist/lib/Validator/Validator.test.js +8 -0
- package/dist/lib/Validator/Validator.test.js.map +7 -0
- package/dist/lib/Validator/index.d.ts +2 -2
- package/dist/lib/Validator/index.d.ts.map +1 -1
- package/dist/lib/Validator/index.js +3 -0
- package/dist/lib/Validator/index.js.map +7 -0
- package/dist/plugins/fetch-urls/fetchUrls.d.ts +1 -1
- package/dist/plugins/fetch-urls/fetchUrls.d.ts.map +1 -1
- package/dist/plugins/fetch-urls/fetchUrls.js +36 -39
- package/dist/plugins/fetch-urls/fetchUrls.js.map +7 -0
- package/dist/plugins/fetch-urls/fetchUrls.test.js +50 -0
- package/dist/plugins/fetch-urls/fetchUrls.test.js.map +7 -0
- package/dist/plugins/fetch-urls/index.d.ts +1 -1
- package/dist/plugins/fetch-urls/index.d.ts.map +1 -1
- package/dist/plugins/fetch-urls/index.js +2 -1
- package/dist/plugins/fetch-urls/index.js.map +7 -0
- package/dist/plugins/read-files/index.d.ts +1 -1
- package/dist/plugins/read-files/index.d.ts.map +1 -1
- package/dist/plugins/read-files/index.js +2 -1
- package/dist/plugins/read-files/index.js.map +7 -0
- package/dist/plugins/read-files/readFiles.d.ts +1 -1
- package/dist/plugins/read-files/readFiles.d.ts.map +1 -1
- package/dist/plugins/read-files/readFiles.js +50 -55
- package/dist/plugins/read-files/readFiles.js.map +7 -0
- package/dist/plugins/read-files/readFiles.test.js +20 -0
- package/dist/plugins/read-files/readFiles.test.js.map +7 -0
- package/dist/polyfills/index.d.ts +1 -1
- package/dist/polyfills/index.d.ts.map +1 -1
- package/dist/polyfills/index.js +5 -0
- package/dist/polyfills/index.js.map +7 -0
- package/dist/polyfills/path.js +155 -98
- package/dist/polyfills/path.js.map +7 -0
- package/dist/schemas/v2.0/schema.d.ts +1405 -0
- package/dist/schemas/v2.0/schema.d.ts.map +1 -0
- package/dist/schemas/v2.0/schema.js +1463 -0
- package/dist/schemas/v2.0/schema.js.map +7 -0
- package/dist/schemas/v3.0/schema.d.ts +1264 -0
- package/dist/schemas/v3.0/schema.d.ts.map +1 -0
- package/dist/schemas/v3.0/schema.js +1493 -0
- package/dist/schemas/v3.0/schema.js.map +7 -0
- package/dist/schemas/v3.1/schema.d.ts +1225 -0
- package/dist/schemas/v3.1/schema.d.ts.map +1 -0
- package/dist/schemas/v3.1/schema.js +1296 -0
- package/dist/schemas/v3.1/schema.js.map +7 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +7 -0
- package/dist/utils/betterAjvErrors/helpers.js +88 -93
- package/dist/utils/betterAjvErrors/helpers.js.map +7 -0
- package/dist/utils/betterAjvErrors/index.js +14 -13
- package/dist/utils/betterAjvErrors/index.js.map +7 -0
- package/dist/utils/betterAjvErrors/json/get-meta-from-path.d.ts +2 -0
- package/dist/utils/betterAjvErrors/json/get-meta-from-path.d.ts.map +1 -0
- package/dist/utils/betterAjvErrors/json/get-meta-from-path.js +27 -0
- package/dist/utils/betterAjvErrors/json/get-meta-from-path.js.map +7 -0
- package/dist/utils/betterAjvErrors/json/index.d.ts +2 -0
- package/dist/utils/betterAjvErrors/json/index.d.ts.map +1 -0
- package/dist/utils/betterAjvErrors/json/index.js +5 -0
- package/dist/utils/betterAjvErrors/json/index.js.map +7 -0
- package/dist/utils/betterAjvErrors/json/utils.d.ts +2 -0
- package/dist/utils/betterAjvErrors/json/utils.d.ts.map +1 -0
- package/dist/utils/betterAjvErrors/json/utils.js +11 -0
- package/dist/utils/betterAjvErrors/json/utils.js.map +7 -0
- package/dist/utils/betterAjvErrors/utils.js +21 -14
- package/dist/utils/betterAjvErrors/utils.js.map +7 -0
- package/dist/utils/betterAjvErrors/validation-errors/additional-prop.d.ts +10 -0
- package/dist/utils/betterAjvErrors/validation-errors/additional-prop.d.ts.map +1 -0
- package/dist/utils/betterAjvErrors/validation-errors/additional-prop.js +8 -9
- package/dist/utils/betterAjvErrors/validation-errors/additional-prop.js.map +7 -0
- package/dist/utils/betterAjvErrors/validation-errors/base.d.ts +23 -0
- package/dist/utils/betterAjvErrors/validation-errors/base.d.ts.map +1 -0
- package/dist/utils/betterAjvErrors/validation-errors/base.js +6 -10
- package/dist/utils/betterAjvErrors/validation-errors/base.js.map +7 -0
- package/dist/utils/betterAjvErrors/validation-errors/default.d.ts +10 -0
- package/dist/utils/betterAjvErrors/validation-errors/default.d.ts.map +1 -0
- package/dist/utils/betterAjvErrors/validation-errors/default.js +8 -9
- package/dist/utils/betterAjvErrors/validation-errors/default.js.map +7 -0
- package/dist/utils/betterAjvErrors/validation-errors/enum.d.ts +11 -0
- package/dist/utils/betterAjvErrors/validation-errors/enum.d.ts.map +1 -0
- package/dist/utils/betterAjvErrors/validation-errors/enum.js +19 -29
- package/dist/utils/betterAjvErrors/validation-errors/enum.js.map +7 -0
- package/dist/utils/betterAjvErrors/validation-errors/index.d.ts +7 -0
- package/dist/utils/betterAjvErrors/validation-errors/index.d.ts.map +1 -0
- package/dist/utils/betterAjvErrors/validation-errors/index.js +15 -0
- package/dist/utils/betterAjvErrors/validation-errors/index.js.map +7 -0
- package/dist/utils/betterAjvErrors/validation-errors/pattern.d.ts +10 -0
- package/dist/utils/betterAjvErrors/validation-errors/pattern.d.ts.map +1 -0
- package/dist/utils/betterAjvErrors/validation-errors/pattern.js +8 -9
- package/dist/utils/betterAjvErrors/validation-errors/pattern.js.map +7 -0
- package/dist/utils/betterAjvErrors/validation-errors/required.d.ts +10 -0
- package/dist/utils/betterAjvErrors/validation-errors/required.d.ts.map +1 -0
- package/dist/utils/betterAjvErrors/validation-errors/required.js +8 -9
- package/dist/utils/betterAjvErrors/validation-errors/required.js.map +7 -0
- package/dist/utils/betterAjvErrors/validation-errors/unevaluated-prop.d.ts +10 -0
- package/dist/utils/betterAjvErrors/validation-errors/unevaluated-prop.d.ts.map +1 -0
- package/dist/utils/betterAjvErrors/validation-errors/unevaluated-prop.js +8 -9
- package/dist/utils/betterAjvErrors/validation-errors/unevaluated-prop.js.map +7 -0
- package/dist/utils/dereference.d.ts +2 -2
- package/dist/utils/dereference.d.ts.map +1 -1
- package/dist/utils/dereference.js +17 -19
- package/dist/utils/dereference.js.map +7 -0
- package/dist/utils/dereference.test.js +300 -0
- package/dist/utils/dereference.test.js.map +7 -0
- package/dist/utils/details.d.ts +1 -1
- package/dist/utils/details.d.ts.map +1 -1
- package/dist/utils/details.js +26 -28
- package/dist/utils/details.js.map +7 -0
- package/dist/utils/errors.test.js +48 -0
- package/dist/utils/errors.test.js.map +7 -0
- package/dist/utils/escapeJsonPointer.js +5 -8
- package/dist/utils/escapeJsonPointer.js.map +7 -0
- package/dist/utils/escapeJsonPointer.test.js +11 -0
- package/dist/utils/escapeJsonPointer.test.js.map +7 -0
- package/dist/utils/filter.d.ts +1 -1
- package/dist/utils/filter.d.ts.map +1 -1
- package/dist/utils/filter.js +13 -15
- package/dist/utils/filter.js.map +7 -0
- package/dist/utils/getEntrypoint.d.ts +1 -1
- package/dist/utils/getEntrypoint.d.ts.map +1 -1
- package/dist/utils/getEntrypoint.js +5 -6
- package/dist/utils/getEntrypoint.js.map +7 -0
- package/dist/utils/getEntrypoint.test.js +18 -0
- package/dist/utils/getEntrypoint.test.js.map +7 -0
- package/dist/utils/getListOfReferences.d.ts +1 -1
- package/dist/utils/getListOfReferences.d.ts.map +1 -1
- package/dist/utils/getListOfReferences.js +15 -22
- package/dist/utils/getListOfReferences.js.map +7 -0
- package/dist/utils/getSegmentsFromPath.js +8 -15
- package/dist/utils/getSegmentsFromPath.js.map +7 -0
- package/dist/utils/getSegmentsFromPath.test.js +13 -0
- package/dist/utils/getSegmentsFromPath.test.js.map +7 -0
- package/dist/utils/index.d.ts +26 -26
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +27 -0
- package/dist/utils/index.js.map +7 -0
- package/dist/utils/isFilesystem.d.ts +2 -1
- package/dist/utils/isFilesystem.d.ts.map +1 -1
- package/dist/utils/isFilesystem.js +5 -9
- package/dist/utils/isFilesystem.js.map +7 -0
- package/dist/utils/isJson.js +10 -9
- package/dist/utils/isJson.js.map +7 -0
- package/dist/utils/isObject.js +5 -6
- package/dist/utils/isObject.js.map +7 -0
- package/dist/utils/isObject.test.js +23 -0
- package/dist/utils/isObject.test.js.map +7 -0
- package/dist/utils/isYaml.js +16 -17
- package/dist/utils/isYaml.js.map +7 -0
- package/dist/utils/load/index.d.ts +1 -1
- package/dist/utils/load/index.d.ts.map +1 -1
- package/dist/utils/load/index.js +2 -0
- package/dist/utils/load/index.js.map +7 -0
- package/dist/utils/load/load.d.ts +1 -1
- package/dist/utils/load/load.d.ts.map +1 -1
- package/dist/utils/load/load.js +89 -110
- package/dist/utils/load/load.js.map +7 -0
- package/dist/utils/load/load.test.js +361 -0
- package/dist/utils/load/load.test.js.map +7 -0
- package/dist/utils/makeFilesystem.d.ts +1 -1
- package/dist/utils/makeFilesystem.d.ts.map +1 -1
- package/dist/utils/makeFilesystem.js +20 -22
- package/dist/utils/makeFilesystem.js.map +7 -0
- package/dist/utils/makeFilesystem.test.js +15 -0
- package/dist/utils/makeFilesystem.test.js.map +7 -0
- package/dist/utils/normalize.d.ts +1 -1
- package/dist/utils/normalize.d.ts.map +1 -1
- package/dist/utils/normalize.js +22 -27
- package/dist/utils/normalize.js.map +7 -0
- package/dist/utils/normalize.test.js +88 -0
- package/dist/utils/normalize.test.js.map +7 -0
- package/dist/utils/openapi/actions/details.d.ts +2 -2
- package/dist/utils/openapi/actions/details.d.ts.map +1 -1
- package/dist/utils/openapi/actions/details.js +9 -11
- package/dist/utils/openapi/actions/details.js.map +7 -0
- package/dist/utils/openapi/actions/files.d.ts +1 -1
- package/dist/utils/openapi/actions/files.d.ts.map +1 -1
- package/dist/utils/openapi/actions/files.js +7 -9
- package/dist/utils/openapi/actions/files.js.map +7 -0
- package/dist/utils/openapi/actions/get.d.ts +1 -1
- package/dist/utils/openapi/actions/get.d.ts.map +1 -1
- package/dist/utils/openapi/actions/get.js +9 -11
- package/dist/utils/openapi/actions/get.js.map +7 -0
- package/dist/utils/openapi/actions/toJson.d.ts +1 -1
- package/dist/utils/openapi/actions/toJson.d.ts.map +1 -1
- package/dist/utils/openapi/actions/toJson.js +9 -11
- package/dist/utils/openapi/actions/toJson.js.map +7 -0
- package/dist/utils/openapi/actions/toYaml.d.ts +1 -1
- package/dist/utils/openapi/actions/toYaml.d.ts.map +1 -1
- package/dist/utils/openapi/actions/toYaml.js +9 -11
- package/dist/utils/openapi/actions/toYaml.js.map +7 -0
- package/dist/utils/openapi/commands/dereferenceCommand.d.ts +5 -5
- package/dist/utils/openapi/commands/dereferenceCommand.d.ts.map +1 -1
- package/dist/utils/openapi/commands/dereferenceCommand.js +25 -27
- package/dist/utils/openapi/commands/dereferenceCommand.js.map +7 -0
- package/dist/utils/openapi/commands/filterCommand.d.ts +9 -9
- package/dist/utils/openapi/commands/filterCommand.d.ts.map +1 -1
- package/dist/utils/openapi/commands/filterCommand.js +24 -26
- package/dist/utils/openapi/commands/filterCommand.js.map +7 -0
- package/dist/utils/openapi/commands/loadCommand.d.ts +994 -994
- package/dist/utils/openapi/commands/loadCommand.d.ts.map +1 -1
- package/dist/utils/openapi/commands/loadCommand.js +40 -42
- package/dist/utils/openapi/commands/loadCommand.js.map +7 -0
- package/dist/utils/openapi/commands/upgradeCommand.d.ts +311 -311
- package/dist/utils/openapi/commands/upgradeCommand.d.ts.map +1 -1
- package/dist/utils/openapi/commands/upgradeCommand.js +27 -29
- package/dist/utils/openapi/commands/upgradeCommand.js.map +7 -0
- package/dist/utils/openapi/commands/validateCommand.d.ts +311 -311
- package/dist/utils/openapi/commands/validateCommand.d.ts.map +1 -1
- package/dist/utils/openapi/commands/validateCommand.js +31 -33
- package/dist/utils/openapi/commands/validateCommand.js.map +7 -0
- package/dist/utils/openapi/index.d.ts +1 -1
- package/dist/utils/openapi/index.d.ts.map +1 -1
- package/dist/utils/openapi/index.js +2 -0
- package/dist/utils/openapi/index.js.map +7 -0
- package/dist/utils/openapi/openapi.d.ts +702 -700
- package/dist/utils/openapi/openapi.d.ts.map +1 -1
- package/dist/utils/openapi/openapi.js +13 -16
- package/dist/utils/openapi/openapi.js.map +7 -0
- package/dist/utils/openapi/openapi.test-d.js +14 -0
- package/dist/utils/openapi/openapi.test-d.js.map +7 -0
- package/dist/utils/openapi/openapi.test.js +309 -0
- package/dist/utils/openapi/openapi.test.js.map +7 -0
- package/dist/utils/openapi/utils/queueTask.d.ts +1 -1
- package/dist/utils/openapi/utils/queueTask.d.ts.map +1 -1
- package/dist/utils/openapi/utils/queueTask.js +8 -9
- package/dist/utils/openapi/utils/queueTask.js.map +7 -0
- package/dist/utils/openapi/utils/workThroughQueue.d.ts +1 -1
- package/dist/utils/openapi/utils/workThroughQueue.d.ts.map +1 -1
- package/dist/utils/openapi/utils/workThroughQueue.js +49 -64
- package/dist/utils/openapi/utils/workThroughQueue.js.map +7 -0
- package/dist/utils/openapi/utils/workThroughQueue.test.js +244 -0
- package/dist/utils/openapi/utils/workThroughQueue.test.js.map +7 -0
- package/dist/utils/resolveReferences.d.ts +1 -1
- package/dist/utils/resolveReferences.d.ts.map +1 -1
- package/dist/utils/resolveReferences.js +91 -139
- package/dist/utils/resolveReferences.js.map +7 -0
- package/dist/utils/resolveReferences.test.js +567 -0
- package/dist/utils/resolveReferences.test.js.map +7 -0
- package/dist/utils/toJson.d.ts +1 -1
- package/dist/utils/toJson.d.ts.map +1 -1
- package/dist/utils/toJson.js +4 -2
- package/dist/utils/toJson.js.map +7 -0
- package/dist/utils/toYaml.d.ts +1 -1
- package/dist/utils/toYaml.d.ts.map +1 -1
- package/dist/utils/toYaml.js +5 -4
- package/dist/utils/toYaml.js.map +7 -0
- package/dist/utils/transform/index.d.ts +1 -1
- package/dist/utils/transform/index.d.ts.map +1 -1
- package/dist/utils/transform/index.js +2 -0
- package/dist/utils/transform/index.js.map +7 -0
- package/dist/utils/transform/sanitize.d.ts +3 -3
- package/dist/utils/transform/sanitize.d.ts.map +1 -1
- package/dist/utils/transform/sanitize.js +22 -21
- package/dist/utils/transform/sanitize.js.map +7 -0
- package/dist/utils/transform/sanitize.test.js +148 -0
- package/dist/utils/transform/sanitize.test.js.map +7 -0
- package/dist/utils/transform/utils/addInfoObject.d.ts +1 -1
- package/dist/utils/transform/utils/addInfoObject.d.ts.map +1 -1
- package/dist/utils/transform/utils/addInfoObject.js +14 -10
- package/dist/utils/transform/utils/addInfoObject.js.map +7 -0
- package/dist/utils/transform/utils/addLatestOpenApiVersion.d.ts +1 -1
- package/dist/utils/transform/utils/addLatestOpenApiVersion.d.ts.map +1 -1
- package/dist/utils/transform/utils/addLatestOpenApiVersion.js +8 -5
- package/dist/utils/transform/utils/addLatestOpenApiVersion.js.map +7 -0
- package/dist/utils/transform/utils/addMissingTags.d.ts +1 -1
- package/dist/utils/transform/utils/addMissingTags.d.ts.map +1 -1
- package/dist/utils/transform/utils/addMissingTags.js +26 -27
- package/dist/utils/transform/utils/addMissingTags.js.map +7 -0
- package/dist/utils/transform/utils/normalizeSecuritySchemes.d.ts +1 -1
- package/dist/utils/transform/utils/normalizeSecuritySchemes.d.ts.map +1 -1
- package/dist/utils/transform/utils/normalizeSecuritySchemes.js +36 -40
- package/dist/utils/transform/utils/normalizeSecuritySchemes.js.map +7 -0
- package/dist/utils/transform/utils/rejectSwaggerDocuments.d.ts +1 -1
- package/dist/utils/transform/utils/rejectSwaggerDocuments.d.ts.map +1 -1
- package/dist/utils/transform/utils/rejectSwaggerDocuments.js +8 -6
- package/dist/utils/transform/utils/rejectSwaggerDocuments.js.map +7 -0
- package/dist/utils/transformErrors.d.ts +1 -1
- package/dist/utils/transformErrors.d.ts.map +1 -1
- package/dist/utils/transformErrors.js +18 -21
- package/dist/utils/transformErrors.js.map +7 -0
- package/dist/utils/transformErrors.test.js +17 -0
- package/dist/utils/transformErrors.test.js.map +7 -0
- package/dist/utils/traverse.d.ts +3 -3
- package/dist/utils/traverse.d.ts.map +1 -1
- package/dist/utils/traverse.js +22 -23
- package/dist/utils/traverse.js.map +7 -0
- package/dist/utils/traverse.test.js +68 -0
- package/dist/utils/traverse.test.js.map +7 -0
- package/dist/utils/unescapeJsonPointer.js +5 -9
- package/dist/utils/unescapeJsonPointer.js.map +7 -0
- package/dist/utils/unescapeJsonPointer.test.js +19 -0
- package/dist/utils/unescapeJsonPointer.test.js.map +7 -0
- package/dist/utils/upgrade.bench.d.ts +2 -0
- package/dist/utils/upgrade.bench.d.ts.map +1 -0
- package/dist/utils/upgrade.bench.js +31 -0
- package/dist/utils/upgrade.bench.js.map +7 -0
- package/dist/utils/upgrade.d.ts +1 -1
- package/dist/utils/upgrade.d.ts.map +1 -1
- package/dist/utils/upgrade.js +28 -22
- package/dist/utils/upgrade.js.map +7 -0
- package/dist/utils/upgrade.test-d.js +16 -0
- package/dist/utils/upgrade.test-d.js.map +7 -0
- package/dist/utils/upgrade.test.js +57 -0
- package/dist/utils/upgrade.test.js.map +7 -0
- package/dist/utils/upgradeFromThreeToThreeOne.d.ts +3 -3
- package/dist/utils/upgradeFromThreeToThreeOne.d.ts.map +1 -1
- package/dist/utils/upgradeFromThreeToThreeOne.js +107 -144
- package/dist/utils/upgradeFromThreeToThreeOne.js.map +7 -0
- package/dist/utils/upgradeFromThreeToThreeOne.test.js +462 -0
- package/dist/utils/upgradeFromThreeToThreeOne.test.js.map +7 -0
- package/dist/utils/upgradeFromTwoToThree.d.ts.map +1 -1
- package/dist/utils/upgradeFromTwoToThree.js +212 -219
- package/dist/utils/upgradeFromTwoToThree.js.map +7 -0
- package/dist/utils/upgradeFromTwoToThree.test.js +589 -0
- package/dist/utils/upgradeFromTwoToThree.test.js.map +7 -0
- package/dist/utils/validate.d.ts +1 -1
- package/dist/utils/validate.d.ts.map +1 -1
- package/dist/utils/validate.js +14 -16
- package/dist/utils/validate.js.map +7 -0
- package/dist/utils/validate.test.js +64 -0
- package/dist/utils/validate.test.js.map +7 -0
- package/package.json +7 -8
- package/dist/schemas/v2.0/schema.json.js +0 -1623
- package/dist/schemas/v3.0/schema.json.js +0 -1673
- package/dist/schemas/v3.1/schema.json.js +0 -1451
|
@@ -0,0 +1,589 @@
|
|
|
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
|
|
@@ -0,0 +1,7 @@
|
|
|
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,Y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AA,YACN,QAAQ;AAAA,UACV;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AAED,KAAG,8BAA8B,MAAM;AACrC,UAAM,SAAS,sBAAsB;AAAA,MACnC,SAAS;AAAA,MACT,UAAU,CAAC,kBAAkB;AAAA,MAC7B,OAAO;AAAA,QACL,YAAY;AAAA,UACV,KAAK;AAAA,YACH,aAAa;AAAA,YACb,UAAU,CAAC,kBAAkB;AAAA,YAC7B,WAAW;AAAA,cACT,OAAO;AAAA,gBACL,aAAa;AAAA,gBACb,SAAS;AAAA,kBACP,MAAM;AAAA,oBACJ,aAAa;AAAA,oBACb,MAAM;AAAA,oBACN,WAAW;AAAA,kBACb;AAAA,gBACF;AAAA,gBACA,QAAQ;AAAA,kBACN,MAAM;AAAA,kBACN,OAAO;AAAA,oBACL,MAAM;AAAA,kBACR;AAAA,gBACF;AAAA,cACF;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAED,WAAO,OAAO,MAAM,UAAU,EAAE,IAAI,UAAU,KAAK,CAAC,EAAE,cAAc;AAAA,MAClE,aAAa;AAAA,MACb,SAAS;AAAA,QACP,oBAAoB;AAAA,UAClB,QAAQ;AAAA,YACN,MAAM;AAAA,YACN,OAAO;AAAA,cACL,MAAM;AAAA,YACR;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,MACA,SAAS;AAAA,QACP,MAAM;AAAA,UACJ,aAAa;AAAA,UACb,QAAQ;AAAA,YACN,MAAM;AAAA,YACN,WAAW;AAAA,UACb;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/utils/validate.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnyObject, Filesystem, ThrowOnErrorOption, ValidateResult } from '../types/index.
|
|
1
|
+
import type { AnyObject, Filesystem, ThrowOnErrorOption, ValidateResult } from '../types/index.js';
|
|
2
2
|
export type ValidateOptions = ThrowOnErrorOption;
|
|
3
3
|
/**
|
|
4
4
|
* Validates an OpenAPI document
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/utils/validate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/utils/validate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAG/F,MAAM,MAAM,eAAe,GAAG,kBAAkB,CAAA;AAEhD;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,EACtC,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,cAAc,CAAC,CAWzB"}
|