@scalar/oas-utils
Advanced tools
Comparing version 0.2.24 to 0.2.25
# @scalar/oas-utils | ||
## 0.2.25 | ||
### Patch Changes | ||
- 9cc6311: fix: add overload to servers as prop for create client app | ||
## 0.2.24 | ||
@@ -4,0 +10,0 @@ |
import { type Request } from '../entities/workspace/spec/index.js'; | ||
import type { AnyObject } from '../types'; | ||
import type { AnyObject, Spec } from '../types'; | ||
/** Import an OpenAPI spec file and convert it to workspace entities */ | ||
export declare const importSpecToWorkspace: (spec: string | AnyObject) => Promise<{ | ||
export declare const importSpecToWorkspace: (spec: string | AnyObject, overloadServers?: Spec["servers"]) => Promise<{ | ||
tags: { | ||
@@ -6,0 +6,0 @@ name: string; |
@@ -16,3 +16,3 @@ import { tagObjectSchema } from '../entities/workspace/spec/spec.js'; | ||
/** Import an OpenAPI spec file and convert it to workspace entities */ | ||
const importSpecToWorkspace = async (spec) => { | ||
const importSpecToWorkspace = async (spec, overloadServers) => { | ||
const importWarnings = []; | ||
@@ -112,12 +112,13 @@ const requests = []; | ||
// Toss in a default server if there aren't any | ||
const unparsedServers = schema?.servers?.length | ||
? schema.servers | ||
: [ | ||
{ | ||
url: typeof window !== 'undefined' | ||
? window.location.origin | ||
: 'http://localhost', | ||
description: 'Replace with your API server', | ||
}, | ||
]; | ||
const unparsedServers = overloadServers ?? | ||
(schema?.servers?.length | ||
? schema.servers | ||
: [ | ||
{ | ||
url: typeof window !== 'undefined' | ||
? window.location.origin | ||
: 'http://localhost', | ||
description: 'Replace with your API server', | ||
}, | ||
]); | ||
const servers = unparsedServers.map((server) => createServer(server)); | ||
@@ -124,0 +125,0 @@ const collection = createCollection({ |
@@ -19,3 +19,3 @@ { | ||
], | ||
"version": "0.2.24", | ||
"version": "0.2.25", | ||
"engines": { | ||
@@ -22,0 +22,0 @@ "node": ">=18" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
240686
5198