@scalar/openapi-parser 0.10.13 → 0.10.15
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 +13 -0
- package/README.md +22 -0
- package/dist/lib/Validator/Validator.js +1 -1
- package/dist/plugins/fetch-urls/fetchUrls.d.ts +1 -0
- package/dist/plugins/fetch-urls/fetchUrls.d.ts.map +1 -1
- package/dist/plugins/fetch-urls/fetchUrls.js +79 -7
- 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 +1 -1
- 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/readFiles.d.ts.map +1 -1
- package/dist/plugins/read-files/readFiles.js +18 -3
- package/dist/types/index.d.ts +23 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/dereference.js +2 -2
- package/dist/utils/filter.js +1 -1
- package/dist/utils/isFilesystem.d.ts +2 -1
- package/dist/utils/isFilesystem.d.ts.map +1 -1
- package/dist/utils/load/load.d.ts +11 -2
- package/dist/utils/load/load.d.ts.map +1 -1
- package/dist/utils/load/load.js +77 -38
- package/dist/utils/makeFilesystem.d.ts +18 -1
- package/dist/utils/makeFilesystem.d.ts.map +1 -1
- package/dist/utils/makeFilesystem.js +55 -9
- package/dist/utils/openapi/actions/details.js +1 -1
- package/dist/utils/openapi/actions/toJson.js +1 -1
- package/dist/utils/openapi/actions/toYaml.js +1 -1
- package/dist/utils/openapi/commands/loadCommand.d.ts +180 -180
- package/dist/utils/resolveReferences.d.ts +6 -0
- package/dist/utils/resolveReferences.d.ts.map +1 -1
- package/dist/utils/resolveReferences.js +19 -9
- package/dist/utils/upgrade.js +1 -1
- package/dist/utils/upgradeFromTwoToThree.d.ts.map +1 -1
- package/dist/utils/upgradeFromTwoToThree.js +58 -0
- package/package.json +4 -3
|
@@ -1,25 +1,71 @@
|
|
|
1
|
-
import { getListOfReferences } from './getListOfReferences.js';
|
|
2
1
|
import { isFilesystem } from './isFilesystem.js';
|
|
3
2
|
import { normalize } from './normalize.js';
|
|
4
3
|
|
|
5
|
-
function makeFilesystem(
|
|
4
|
+
function makeFilesystem(
|
|
5
|
+
/**
|
|
6
|
+
* Pass whatever you have, it will be normalized and then used as the content.
|
|
7
|
+
*/
|
|
8
|
+
value,
|
|
9
|
+
/**
|
|
10
|
+
* If you know better, you can overwrite the default values.
|
|
11
|
+
*/
|
|
12
|
+
overwrites) {
|
|
6
13
|
// Keep as is
|
|
7
14
|
if (isFilesystem(value)) {
|
|
8
15
|
return value;
|
|
9
16
|
}
|
|
17
|
+
// Just create it from an existing entry
|
|
18
|
+
if (isFilesystemEntry(value)) {
|
|
19
|
+
return [
|
|
20
|
+
makeFilesystemEntry(value.content, {
|
|
21
|
+
isEntrypoint: true,
|
|
22
|
+
}),
|
|
23
|
+
];
|
|
24
|
+
}
|
|
10
25
|
// Make an object
|
|
11
|
-
const
|
|
26
|
+
const content = normalize(value);
|
|
12
27
|
// Create fake filesystem
|
|
13
28
|
return [
|
|
14
29
|
{
|
|
15
30
|
isEntrypoint: true,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
...overwrites,
|
|
31
|
+
content,
|
|
32
|
+
uri: undefined,
|
|
33
|
+
references: {},
|
|
34
|
+
...({}),
|
|
21
35
|
},
|
|
22
36
|
];
|
|
23
37
|
}
|
|
38
|
+
function makeFilesystemEntry(
|
|
39
|
+
/**
|
|
40
|
+
* Pass whatever you have, it will be normalized and then used as the content.
|
|
41
|
+
*/
|
|
42
|
+
value,
|
|
43
|
+
/**
|
|
44
|
+
* If you know better, you can overwrite the default values.
|
|
45
|
+
*/
|
|
46
|
+
overwrites) {
|
|
47
|
+
// Keep as is
|
|
48
|
+
if (isFilesystemEntry(value)) {
|
|
49
|
+
return {
|
|
50
|
+
...value,
|
|
51
|
+
...(overwrites ?? {}),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
// Make an object
|
|
55
|
+
const content = normalize(value);
|
|
56
|
+
return {
|
|
57
|
+
isEntrypoint: true,
|
|
58
|
+
content,
|
|
59
|
+
uri: null,
|
|
60
|
+
references: {},
|
|
61
|
+
...(overwrites ?? {}),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Check whether the value is a filesystem entry already.
|
|
66
|
+
*/
|
|
67
|
+
const isFilesystemEntry = (value) => {
|
|
68
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value) && 'isEntrypoint' in value;
|
|
69
|
+
};
|
|
24
70
|
|
|
25
|
-
export { makeFilesystem };
|
|
71
|
+
export { makeFilesystem, makeFilesystemEntry };
|
|
@@ -7,7 +7,7 @@ import { workThroughQueue } from '../utils/workThroughQueue.js';
|
|
|
7
7
|
*/
|
|
8
8
|
async function details(queue) {
|
|
9
9
|
const { filesystem } = await workThroughQueue(queue);
|
|
10
|
-
return details$1(getEntrypoint(filesystem).
|
|
10
|
+
return details$1(getEntrypoint(filesystem).content);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export { details };
|
|
@@ -7,7 +7,7 @@ import { workThroughQueue } from '../utils/workThroughQueue.js';
|
|
|
7
7
|
*/
|
|
8
8
|
async function toJson(queue) {
|
|
9
9
|
const { filesystem } = await workThroughQueue(queue);
|
|
10
|
-
return toJson$1(getEntrypoint(filesystem).
|
|
10
|
+
return toJson$1(getEntrypoint(filesystem).content);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export { toJson };
|
|
@@ -7,7 +7,7 @@ import { workThroughQueue } from '../utils/workThroughQueue.js';
|
|
|
7
7
|
*/
|
|
8
8
|
async function toYaml(queue) {
|
|
9
9
|
const { filesystem } = await workThroughQueue(queue);
|
|
10
|
-
return toYaml$1(getEntrypoint(filesystem).
|
|
10
|
+
return toYaml$1(getEntrypoint(filesystem).content);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export { toYaml };
|