@scalar/openapi-parser 0.10.15 → 0.10.16

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 (34) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +0 -22
  3. package/dist/lib/Validator/Validator.js +1 -1
  4. package/dist/plugins/fetch-urls/fetchUrls.d.ts +0 -1
  5. package/dist/plugins/fetch-urls/fetchUrls.d.ts.map +1 -1
  6. package/dist/plugins/fetch-urls/fetchUrls.js +7 -79
  7. package/dist/plugins/fetch-urls/index.d.ts +1 -1
  8. package/dist/plugins/fetch-urls/index.d.ts.map +1 -1
  9. package/dist/plugins/fetch-urls/index.js +1 -1
  10. package/dist/plugins/read-files/index.d.ts +1 -1
  11. package/dist/plugins/read-files/index.d.ts.map +1 -1
  12. package/dist/plugins/read-files/readFiles.d.ts.map +1 -1
  13. package/dist/plugins/read-files/readFiles.js +3 -18
  14. package/dist/types/index.d.ts +4 -23
  15. package/dist/types/index.d.ts.map +1 -1
  16. package/dist/utils/dereference.js +2 -2
  17. package/dist/utils/filter.js +1 -1
  18. package/dist/utils/isFilesystem.d.ts +1 -2
  19. package/dist/utils/isFilesystem.d.ts.map +1 -1
  20. package/dist/utils/load/load.d.ts +2 -11
  21. package/dist/utils/load/load.d.ts.map +1 -1
  22. package/dist/utils/load/load.js +38 -77
  23. package/dist/utils/makeFilesystem.d.ts +1 -18
  24. package/dist/utils/makeFilesystem.d.ts.map +1 -1
  25. package/dist/utils/makeFilesystem.js +9 -55
  26. package/dist/utils/openapi/actions/details.js +1 -1
  27. package/dist/utils/openapi/actions/toJson.js +1 -1
  28. package/dist/utils/openapi/actions/toYaml.js +1 -1
  29. package/dist/utils/openapi/commands/loadCommand.d.ts +180 -180
  30. package/dist/utils/resolveReferences.d.ts +0 -6
  31. package/dist/utils/resolveReferences.d.ts.map +1 -1
  32. package/dist/utils/resolveReferences.js +9 -19
  33. package/dist/utils/upgrade.js +1 -1
  34. package/package.json +3 -4
@@ -1,71 +1,25 @@
1
+ import { getListOfReferences } from './getListOfReferences.js';
1
2
  import { isFilesystem } from './isFilesystem.js';
2
3
  import { normalize } from './normalize.js';
3
4
 
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) {
5
+ function makeFilesystem(value, overwrites = {}) {
13
6
  // Keep as is
14
7
  if (isFilesystem(value)) {
15
8
  return value;
16
9
  }
17
- // Just create it from an existing entry
18
- if (isFilesystemEntry(value)) {
19
- return [
20
- makeFilesystemEntry(value.content, {
21
- isEntrypoint: true,
22
- }),
23
- ];
24
- }
25
10
  // Make an object
26
- const content = normalize(value);
11
+ const specification = normalize(value);
27
12
  // Create fake filesystem
28
13
  return [
29
14
  {
30
15
  isEntrypoint: true,
31
- content,
32
- uri: undefined,
33
- references: {},
34
- ...({}),
16
+ specification,
17
+ filename: null,
18
+ dir: './',
19
+ references: getListOfReferences(specification),
20
+ ...overwrites,
35
21
  },
36
22
  ];
37
23
  }
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
- };
70
24
 
71
- export { makeFilesystem, makeFilesystemEntry };
25
+ export { makeFilesystem };
@@ -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).content);
10
+ return details$1(getEntrypoint(filesystem).specification);
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).content);
10
+ return toJson$1(getEntrypoint(filesystem).specification);
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).content);
10
+ return toYaml$1(getEntrypoint(filesystem).specification);
11
11
  }
12
12
 
13
13
  export { toYaml };