@scalar/oas-utils 0.2.23 → 0.2.25
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
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @scalar/oas-utils
|
|
2
2
|
|
|
3
|
+
## 0.2.25
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9cc6311: fix: add overload to servers as prop for create client app
|
|
8
|
+
|
|
9
|
+
## 0.2.24
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [425dc83]
|
|
14
|
+
- @scalar/themes@0.9.20
|
|
15
|
+
|
|
3
16
|
## 0.2.23
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Request } from '../entities/workspace/spec/index.js';
|
|
2
|
-
import type { AnyObject } from '../types';
|
|
2
|
+
import type { AnyObject, Spec } from '../types';
|
|
3
3
|
/** Import an OpenAPI spec file and convert it to workspace entities */
|
|
4
|
-
export declare const importSpecToWorkspace: (spec: string | AnyObject) => Promise<{
|
|
4
|
+
export declare const importSpecToWorkspace: (spec: string | AnyObject, overloadServers?: Spec["servers"]) => Promise<{
|
|
5
5
|
tags: {
|
|
6
6
|
name: string;
|
|
7
7
|
description?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-spec.d.ts","sourceRoot":"","sources":["../../src/transforms/import-spec.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,OAAO,EAAiB,MAAM,2BAA2B,CAAA;AAIvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"import-spec.d.ts","sourceRoot":"","sources":["../../src/transforms/import-spec.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,OAAO,EAAiB,MAAM,2BAA2B,CAAA;AAIvE,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAW9C,uEAAuE;AACvE,eAAO,MAAM,qBAAqB,SAC1B,MAAM,GAAG,SAAS,oBACN,IAAI,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsKlC,CAAA"}
|
|
@@ -13,7 +13,7 @@ const PARAM_DICTIONARY = {
|
|
|
13
13
|
query: 'query',
|
|
14
14
|
};
|
|
15
15
|
/** Import an OpenAPI spec file and convert it to workspace entities */
|
|
16
|
-
const importSpecToWorkspace = async (spec) => {
|
|
16
|
+
const importSpecToWorkspace = async (spec, overloadServers) => {
|
|
17
17
|
const importWarnings = [];
|
|
18
18
|
const requests = [];
|
|
19
19
|
// TODO: `parsedSpec` can have circular reference and will break.
|
|
@@ -108,16 +108,17 @@ const importSpecToWorkspace = async (spec) => {
|
|
|
108
108
|
folders.push(folder);
|
|
109
109
|
});
|
|
110
110
|
// Toss in a default server if there aren't any
|
|
111
|
-
const unparsedServers =
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
111
|
+
const unparsedServers = overloadServers ??
|
|
112
|
+
(schema?.servers?.length
|
|
113
|
+
? schema.servers
|
|
114
|
+
: [
|
|
115
|
+
{
|
|
116
|
+
url: typeof window !== 'undefined'
|
|
117
|
+
? window.location.origin
|
|
118
|
+
: 'http://localhost',
|
|
119
|
+
description: 'Replace with your API server',
|
|
120
|
+
},
|
|
121
|
+
]);
|
|
121
122
|
const servers = unparsedServers.map((server) => createServer(server));
|
|
122
123
|
const collection = createCollection({
|
|
123
124
|
spec: {
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"specification",
|
|
17
17
|
"yaml"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.2.
|
|
19
|
+
"version": "0.2.25",
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=18"
|
|
22
22
|
},
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"nanoid": "^5.0.7",
|
|
91
91
|
"yaml": "^2.4.5",
|
|
92
92
|
"zod": "^3.22.4",
|
|
93
|
-
"@scalar/themes": "0.9.
|
|
93
|
+
"@scalar/themes": "0.9.20"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
96
|
"@scalar/openapi-parser": "^0.7.2",
|