@scalar/openapi-parser 0.7.2 → 0.8.1
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 +20 -0
- package/LICENSE +1 -1
- package/README.md +193 -24
- package/dist/configuration/index.d.ts +2 -1
- package/dist/configuration/index.d.ts.map +1 -1
- package/dist/configuration/index.js +1 -1
- package/dist/lib/Validator/Validator.d.ts.map +1 -1
- package/dist/lib/Validator/Validator.js +1 -1
- package/dist/polyfills/path.d.ts +3 -3
- package/dist/polyfills/path.d.ts.map +1 -1
- package/dist/polyfills/path.js +1 -1
- package/dist/types/index.d.ts +5 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/betterAjvErrors/helpers.d.ts.map +1 -1
- package/dist/utils/betterAjvErrors/helpers.js +1 -1
- package/dist/utils/getListOfReferences.d.ts +1 -1
- package/dist/utils/getListOfReferences.d.ts.map +1 -1
- package/dist/utils/isFilesystem.js +1 -1
- package/dist/utils/load/load.d.ts +2 -2
- package/dist/utils/load/load.d.ts.map +1 -1
- package/dist/utils/load/load.js +1 -1
- package/dist/utils/load/plugins/fetchUrls.d.ts +1 -1
- package/dist/utils/load/plugins/fetchUrls.d.ts.map +1 -1
- package/dist/utils/load/plugins/readFiles.d.ts +1 -1
- package/dist/utils/load/plugins/readFiles.d.ts.map +1 -1
- package/dist/utils/normalize.d.ts +1 -1
- package/dist/utils/normalize.d.ts.map +1 -1
- package/dist/utils/resolveReferences.d.ts +1 -1
- package/dist/utils/resolveReferences.d.ts.map +1 -1
- package/dist/utils/toJson.d.ts +1 -1
- package/dist/utils/toJson.d.ts.map +1 -1
- package/dist/utils/toYaml.d.ts +1 -1
- package/dist/utils/toYaml.d.ts.map +1 -1
- package/dist/utils/traverse.d.ts +1 -1
- package/dist/utils/traverse.d.ts.map +1 -1
- package/dist/utils/upgrade.d.ts +2 -1
- package/dist/utils/upgrade.d.ts.map +1 -1
- package/dist/utils/upgrade.test-d.d.ts +2 -0
- package/dist/utils/upgrade.test-d.d.ts.map +1 -0
- package/dist/utils/upgradeFromThreeToThreeOne.d.ts +1 -1
- package/dist/utils/upgradeFromThreeToThreeOne.d.ts.map +1 -1
- package/dist/utils/upgradeFromTwoToThree.d.ts +1 -1
- package/dist/utils/upgradeFromTwoToThree.d.ts.map +1 -1
- package/dist/utils/upgradeFromTwoToThree.js +1 -1
- package/dist/utils/validate.d.ts.map +1 -1
- package/dist/utils/workThroughQueue.js +1 -1
- package/package.json +37 -33
- package/dist/types/openapi-types.d.ts +0 -746
- package/dist/types/openapi-types.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgradeFromTwoToThree.d.ts","sourceRoot":"","sources":["../../src/utils/upgradeFromTwoToThree.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upgradeFromTwoToThree.d.ts","sourceRoot":"","sources":["../../src/utils/upgradeFromTwoToThree.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGzC;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,SAAS,aAoJ7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function n(n){return
|
|
1
|
+
import{traverse as e}from"./traverse.js";function t(t){if(!t.swagger?.startsWith("2.0"))return t;if(t.openapi="3.0.3",delete t.swagger,console.warn("[upgradeFromTwoToThree] The upgrade from Swagger 2.0 to OpenAPI 3.0 documents is experimental and lacks features."),t.host){const e=t.schemes?.length?t.schemes:["http"];t.servers=e.map((e=>({url:`${e}://${t.host}${t.basePath??""}`}))),delete t.basePath,delete t.schemes,delete t.host}if(t.definitions&&("object"!=typeof t.components&&(t.components={}),t.components.schemas=t.definitions,delete t.definitions,t=e(t,(e=>(e.$ref?.startsWith("#/definitions/")&&(e.$ref=e.$ref.replace(/^#\/definitions\//,"#/components/schemas/")),e)))),t.paths)for(const e in t.paths)if(Object.hasOwn(t.paths,e)){const s=t.paths[e];for(const e in s)if(Object.hasOwn(s,e)){const o=s[e];if(o.parameters){const e=structuredClone(o.parameters.find((e=>"body"===e.in))??{});if(e&&Object.keys(e).length){delete e.name,delete e.in;const s=t.consumes??o.consumes??["application/json"];"object"!=typeof o.requestBody&&(o.requestBody={}),"object"!=typeof o.requestBody.content&&(o.requestBody.content={});const{schema:n,...r}=e;o.requestBody={...o.requestBody,...r};for(const e of s)o.requestBody.content[e]={schema:n}}o.parameters=o.parameters.filter((e=>"body"!==e.in)),delete o.consumes}if(o.responses)for(const e in o.responses)if(Object.hasOwn(o.responses,e)){const s=o.responses[e];if(s.schema){const e=t.produces??o.produces??["application/json"];"object"!=typeof s.content&&(s.content={});for(const t of e)s.content[t]={schema:s.schema};delete s.schema}}delete o.produces,0===o.parameters?.length&&delete o.parameters}}return t}export{t as upgradeFromTwoToThree};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/utils/validate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/utils/validate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,cAAc,EACf,MAAM,UAAU,CAAA;AAGjB;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,EACtC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,cAAc,CAAC,CAWzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
async function n(n){
|
|
1
|
+
async function n(n){const t=n.specification;let o;for(const{action:c,options:e}of n.tasks)"function"==typeof c?o="AsyncFunction"===c.constructor.name?{...o,...await c(o?.filesystem??t,e)}:{...o,...c(o?.filesystem??t,e)}:console.warn("[queue] The given action is not a function:",c);return o}export{n as workThroughQueue};
|
package/package.json
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalar/openapi-parser",
|
|
3
3
|
"description": "modern OpenAPI parser written in TypeScript",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"author": "Scalar (https://github.com/scalar)",
|
|
6
|
+
"homepage": "https://github.com/scalar/scalar",
|
|
7
|
+
"bugs": "https://github.com/scalar/scalar/issues/new/choose",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/scalar/scalar.git",
|
|
11
|
+
"directory": "packages/openapi-parser"
|
|
12
|
+
},
|
|
4
13
|
"keywords": [
|
|
5
14
|
"openapi",
|
|
6
15
|
"scalar",
|
|
@@ -8,22 +17,12 @@
|
|
|
8
17
|
"parser",
|
|
9
18
|
"typescript"
|
|
10
19
|
],
|
|
11
|
-
"
|
|
12
|
-
"author": "Scalar (https://github.com/scalar)",
|
|
13
|
-
"homepage": "https://github.com/scalar/scalar",
|
|
14
|
-
"bugs": "https://github.com/scalar/scalar/issues/new/choose",
|
|
15
|
-
"version": "0.7.2",
|
|
20
|
+
"version": "0.8.1",
|
|
16
21
|
"engines": {
|
|
17
22
|
"node": ">=18"
|
|
18
23
|
},
|
|
19
24
|
"type": "module",
|
|
20
|
-
"files": [
|
|
21
|
-
"dist",
|
|
22
|
-
"!dist/webpack-stats.json",
|
|
23
|
-
"CHANGELOG.md"
|
|
24
|
-
],
|
|
25
25
|
"main": "./dist/index.js",
|
|
26
|
-
"module": "./dist/index.js",
|
|
27
26
|
"types": "./dist/index.d.ts",
|
|
28
27
|
"exports": {
|
|
29
28
|
".": {
|
|
@@ -36,40 +35,45 @@
|
|
|
36
35
|
"import": "./dist/utils/load/plugins/readFiles.js"
|
|
37
36
|
}
|
|
38
37
|
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist",
|
|
40
|
+
"CHANGELOG.md"
|
|
41
|
+
],
|
|
42
|
+
"module": "./dist/index.js",
|
|
39
43
|
"sideEffects": false,
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"ajv": "^8.17.1",
|
|
46
|
+
"ajv-draft-04": "^1.0.0",
|
|
47
|
+
"ajv-formats": "^3.0.1",
|
|
48
|
+
"jsonpointer": "^5.0.1",
|
|
49
|
+
"leven": "^4.0.0",
|
|
50
|
+
"yaml": "^2.4.5"
|
|
44
51
|
},
|
|
45
52
|
"devDependencies": {
|
|
46
53
|
"@apidevtools/swagger-parser": "^10.1.0",
|
|
54
|
+
"@babel/code-frame": "^7.24.7",
|
|
55
|
+
"@google-cloud/storage": "^7.12.1",
|
|
47
56
|
"@rollup/plugin-json": "^6.1.0",
|
|
48
57
|
"@rollup/plugin-terser": "^0.4.4",
|
|
49
58
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
50
|
-
"@types/node": "^20.14.
|
|
51
|
-
"glob": "^10.
|
|
59
|
+
"@types/node": "^20.14.10",
|
|
60
|
+
"glob": "^10.3.10",
|
|
61
|
+
"json-to-ast": "^2.1.0",
|
|
52
62
|
"just-diff": "^6.0.2",
|
|
53
|
-
"rollup": "^4.
|
|
54
|
-
"rollup-plugin-output-size": "^1.4.
|
|
55
|
-
"rollup-plugin-webpack-stats": "^1.0.1",
|
|
63
|
+
"rollup": "^4.16.4",
|
|
64
|
+
"rollup-plugin-output-size": "^1.4.1",
|
|
56
65
|
"tinybench": "^2.8.0",
|
|
57
|
-
"
|
|
58
|
-
"tslib": "^2.6.3",
|
|
59
|
-
"typescript": "^5.5.3"
|
|
60
|
-
},
|
|
61
|
-
"dependencies": {
|
|
62
|
-
"ajv": "^8.16.0",
|
|
63
|
-
"ajv-draft-04": "^1.0.0",
|
|
64
|
-
"ajv-formats": "^3.0.1",
|
|
65
|
-
"jsonpointer": "^5.0.1",
|
|
66
|
-
"leven": "^4.0.0",
|
|
67
|
-
"yaml": "^2.4.5"
|
|
66
|
+
"@scalar/openapi-types": "0.1.0"
|
|
68
67
|
},
|
|
69
68
|
"scripts": {
|
|
70
|
-
"types:check": "tsc --noEmit --skipLibCheck",
|
|
71
69
|
"build": "pnpm types:check && rollup -c --configPlugin typescript && pnpm types:build",
|
|
70
|
+
"format": "prettier --write .",
|
|
71
|
+
"lint:check": "eslint .",
|
|
72
|
+
"lint:fix": "eslint . --fix",
|
|
73
|
+
"test": "vitest",
|
|
74
|
+
"test:prepare": "vite-node scripts/load-files.ts",
|
|
75
|
+
"test:unit": "vite-node scripts/load-files.ts && vitest",
|
|
72
76
|
"types:build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
73
|
-
"
|
|
77
|
+
"types:check": "tsc --noEmit --skipLibCheck"
|
|
74
78
|
}
|
|
75
79
|
}
|