@scalar/oas-utils 0.11.1 → 0.12.0
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 +11 -0
- package/dist/helpers/index.d.ts +0 -82
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +0 -78
- package/dist/migrations/migrate-to-indexdb.d.ts.map +1 -1
- package/dist/migrations/migrate-to-indexdb.js +1 -1
- package/dist/migrations/v-2.5.0/types.generated.d.ts +428 -34
- package/dist/migrations/v-2.5.0/types.generated.d.ts.map +1 -1
- package/package.json +7 -61
- package/dist/entities/cookie/cookie.d.ts +0 -15
- package/dist/entities/cookie/cookie.d.ts.map +0 -1
- package/dist/entities/cookie/cookie.js +0 -12
- package/dist/entities/cookie/index.d.ts +0 -2
- package/dist/entities/cookie/index.d.ts.map +0 -1
- package/dist/entities/cookie/index.js +0 -1
- package/dist/entities/environment/environment.d.ts +0 -12
- package/dist/entities/environment/environment.d.ts.map +0 -1
- package/dist/entities/environment/environment.js +0 -8
- package/dist/entities/environment/index.d.ts +0 -2
- package/dist/entities/environment/index.d.ts.map +0 -1
- package/dist/entities/environment/index.js +0 -1
- package/dist/entities/hotkeys/hotkeys.d.ts +0 -15
- package/dist/entities/hotkeys/hotkeys.d.ts.map +0 -1
- package/dist/entities/hotkeys/hotkeys.js +0 -118
- package/dist/entities/hotkeys/index.d.ts +0 -2
- package/dist/entities/hotkeys/index.d.ts.map +0 -1
- package/dist/entities/hotkeys/index.js +0 -1
- package/dist/entities/shared/index.d.ts +0 -2
- package/dist/entities/shared/index.d.ts.map +0 -1
- package/dist/entities/shared/index.js +0 -1
- package/dist/entities/shared/utility.d.ts +0 -5
- package/dist/entities/shared/utility.d.ts.map +0 -1
- package/dist/entities/shared/utility.js +0 -9
- package/dist/entities/spec/collection.d.ts +0 -133
- package/dist/entities/spec/collection.d.ts.map +0 -1
- package/dist/entities/spec/collection.js +0 -95
- package/dist/entities/spec/index.d.ts +0 -12
- package/dist/entities/spec/index.d.ts.map +0 -1
- package/dist/entities/spec/index.js +0 -10
- package/dist/entities/spec/operation.d.ts +0 -99
- package/dist/entities/spec/operation.d.ts.map +0 -1
- package/dist/entities/spec/operation.js +0 -6
- package/dist/entities/spec/parameters.d.ts +0 -44
- package/dist/entities/spec/parameters.d.ts.map +0 -1
- package/dist/entities/spec/parameters.js +0 -41
- package/dist/entities/spec/request-examples.d.ts +0 -380
- package/dist/entities/spec/request-examples.d.ts.map +0 -1
- package/dist/entities/spec/request-examples.js +0 -449
- package/dist/entities/spec/requests.d.ts +0 -137
- package/dist/entities/spec/requests.d.ts.map +0 -1
- package/dist/entities/spec/requests.js +0 -123
- package/dist/entities/spec/server.d.ts +0 -15
- package/dist/entities/spec/server.d.ts.map +0 -1
- package/dist/entities/spec/server.js +0 -67
- package/dist/entities/spec/spec-objects.d.ts +0 -171
- package/dist/entities/spec/spec-objects.d.ts.map +0 -1
- package/dist/entities/spec/spec-objects.js +0 -134
- package/dist/entities/spec/x-scalar-environments.d.ts +0 -22
- package/dist/entities/spec/x-scalar-environments.d.ts.map +0 -1
- package/dist/entities/spec/x-scalar-environments.js +0 -22
- package/dist/entities/spec/x-scalar-secrets.d.ts +0 -6
- package/dist/entities/spec/x-scalar-secrets.d.ts.map +0 -1
- package/dist/entities/spec/x-scalar-secrets.js +0 -8
- package/dist/entities/workspace/index.d.ts +0 -2
- package/dist/entities/workspace/index.d.ts.map +0 -1
- package/dist/entities/workspace/index.js +0 -1
- package/dist/entities/workspace/workspace.d.ts +0 -236
- package/dist/entities/workspace/workspace.d.ts.map +0 -1
- package/dist/entities/workspace/workspace.js +0 -49
- package/dist/helpers/fetch-document.d.ts +0 -7
- package/dist/helpers/fetch-document.d.ts.map +0 -1
- package/dist/helpers/fetch-document.js +0 -32
- package/dist/helpers/fetch-with-proxy-fallback.d.ts +0 -15
- package/dist/helpers/fetch-with-proxy-fallback.d.ts.map +0 -1
- package/dist/helpers/fetch-with-proxy-fallback.js +0 -29
- package/dist/helpers/normalize-mime-type-object.d.ts +0 -8
- package/dist/helpers/normalize-mime-type-object.d.ts.map +0 -1
- package/dist/helpers/normalize-mime-type-object.js +0 -21
- package/dist/helpers/normalize-mime-type.d.ts +0 -10
- package/dist/helpers/normalize-mime-type.d.ts.map +0 -1
- package/dist/helpers/normalize-mime-type.js +0 -12
- package/dist/helpers/operation-stability.d.ts +0 -19
- package/dist/helpers/operation-stability.d.ts.map +0 -1
- package/dist/helpers/operation-stability.js +0 -24
- package/dist/helpers/schema-model.d.ts +0 -5
- package/dist/helpers/schema-model.d.ts.map +0 -1
- package/dist/helpers/schema-model.js +0 -14
- package/dist/helpers/security/get-schemes.d.ts +0 -97
- package/dist/helpers/security/get-schemes.d.ts.map +0 -1
- package/dist/helpers/security/get-schemes.js +0 -8
- package/dist/helpers/security/has-token.d.ts +0 -4
- package/dist/helpers/security/has-token.d.ts.map +0 -1
- package/dist/helpers/security/has-token.js +0 -19
- package/dist/helpers/security/index.d.ts +0 -3
- package/dist/helpers/security/index.d.ts.map +0 -1
- package/dist/helpers/security/index.js +0 -2
- package/dist/helpers/servers.d.ts +0 -24
- package/dist/helpers/servers.d.ts.map +0 -1
- package/dist/helpers/servers.js +0 -146
- package/dist/helpers/should-ignore-entity.d.ts +0 -8
- package/dist/helpers/should-ignore-entity.d.ts.map +0 -1
- package/dist/helpers/should-ignore-entity.js +0 -4
- package/dist/migrations/generate-types.d.ts +0 -2
- package/dist/migrations/generate-types.d.ts.map +0 -1
- package/dist/migrations/generate-types.js +0 -53
- package/dist/spec-getters/get-example-from-schema.d.ts +0 -36
- package/dist/spec-getters/get-example-from-schema.d.ts.map +0 -1
- package/dist/spec-getters/get-example-from-schema.js +0 -521
- package/dist/spec-getters/get-parameters-from-operation.d.ts +0 -17
- package/dist/spec-getters/get-parameters-from-operation.d.ts.map +0 -1
- package/dist/spec-getters/get-parameters-from-operation.js +0 -40
- package/dist/spec-getters/get-request-body-from-operation.d.ts +0 -14
- package/dist/spec-getters/get-request-body-from-operation.d.ts.map +0 -1
- package/dist/spec-getters/get-request-body-from-operation.js +0 -176
- package/dist/spec-getters/get-server-variable-examples.d.ts +0 -4
- package/dist/spec-getters/get-server-variable-examples.d.ts.map +0 -1
- package/dist/spec-getters/get-server-variable-examples.js +0 -12
- package/dist/spec-getters/index.d.ts +0 -5
- package/dist/spec-getters/index.d.ts.map +0 -1
- package/dist/spec-getters/index.js +0 -4
- package/dist/transforms/import-spec.d.ts +0 -64
- package/dist/transforms/import-spec.d.ts.map +0 -1
- package/dist/transforms/import-spec.js +0 -397
- package/dist/transforms/index.d.ts +0 -2
- package/dist/transforms/index.d.ts.map +0 -1
- package/dist/transforms/index.js +0 -1
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { json2xml } from '@scalar/helpers/file/json2xml';
|
|
2
|
-
import { prettyPrintJson } from '@scalar/helpers/json/pretty-print-json';
|
|
3
|
-
import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref';
|
|
4
|
-
import { normalizeMimeTypeObject } from '../helpers/normalize-mime-type-object.js';
|
|
5
|
-
import { getExampleFromSchema } from './get-example-from-schema.js';
|
|
6
|
-
import { getParametersFromOperation } from './get-parameters-from-operation.js';
|
|
7
|
-
/**
|
|
8
|
-
* Transform the object into a nested array of objects
|
|
9
|
-
* that represent the key-value pairs of the object.
|
|
10
|
-
*/
|
|
11
|
-
function getParamsFromObject(obj, nested = false, field) {
|
|
12
|
-
return Object.entries(obj).flatMap(([key, value]) => {
|
|
13
|
-
const name = field ?? key;
|
|
14
|
-
if (Array.isArray(value) && !nested) {
|
|
15
|
-
return getParamsFromObject(value, true, key);
|
|
16
|
-
}
|
|
17
|
-
if (typeof value === 'object' && !(value instanceof File) && value !== null) {
|
|
18
|
-
// Nested object inside formData field: no way to represent it, so just serialize to JSON string
|
|
19
|
-
value = JSON.stringify(value);
|
|
20
|
-
}
|
|
21
|
-
return [{ name, value }];
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
// Define preferred standard mime types (order indicates preference)
|
|
25
|
-
const standardMimeTypes = [
|
|
26
|
-
'application/json',
|
|
27
|
-
'application/octet-stream',
|
|
28
|
-
'application/x-www-form-urlencoded',
|
|
29
|
-
'application/xml',
|
|
30
|
-
'multipart/form-data',
|
|
31
|
-
'text/plain',
|
|
32
|
-
];
|
|
33
|
-
/**
|
|
34
|
-
* Get the request body from the operation.
|
|
35
|
-
*/
|
|
36
|
-
export function getRequestBodyFromOperation(operation, selectedExampleKey, omitEmptyAndOptionalProperties) {
|
|
37
|
-
const originalContent = operation.requestBody?.content;
|
|
38
|
-
const content = normalizeMimeTypeObject(originalContent);
|
|
39
|
-
// First try to find a standard mime type
|
|
40
|
-
const mimeType = standardMimeTypes.find((currentMimeType) => !!content?.[currentMimeType]) ??
|
|
41
|
-
(Object.keys(content ?? {})[0] || 'application/json');
|
|
42
|
-
// Handle JSON-like content types (e.g., application/vnd.github+json)
|
|
43
|
-
const isJsonLike = mimeType.includes('json') || mimeType.endsWith('+json');
|
|
44
|
-
/** Examples */
|
|
45
|
-
const examples = content?.[mimeType]?.examples ?? content?.['application/json']?.examples;
|
|
46
|
-
// Let's use the first example
|
|
47
|
-
const selectedExample = examples?.[selectedExampleKey ?? Object.keys(examples ?? {})[0] ?? ''];
|
|
48
|
-
if (selectedExample) {
|
|
49
|
-
return {
|
|
50
|
-
mimeType,
|
|
51
|
-
text: prettyPrintJson('value' in selectedExample ? selectedExample.value : selectedExample),
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Body Parameters (Swagger 2.0)
|
|
56
|
-
*
|
|
57
|
-
* ”The payload that's appended to the HTTP request. Since there can only be one payload, there can only
|
|
58
|
-
* be one body parameter. The name of the body parameter has no effect on the parameter itself and is used
|
|
59
|
-
* for documentation purposes only. Since Form parameters are also in the payload, body and form
|
|
60
|
-
* parameters cannot exist together for the same operation.”
|
|
61
|
-
*/
|
|
62
|
-
const bodyParameters = getParametersFromOperation(operation.parameters ?? [],
|
|
63
|
-
// TODO: Add path parameters
|
|
64
|
-
[], // operation.path ?? [],
|
|
65
|
-
'body', false);
|
|
66
|
-
if (bodyParameters.length > 0) {
|
|
67
|
-
return {
|
|
68
|
-
mimeType: 'application/json',
|
|
69
|
-
text: prettyPrintJson(bodyParameters[0]?.value ?? ''),
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* FormData Parameters (Swagger 2.0)
|
|
74
|
-
*
|
|
75
|
-
* ”Form - Used to describe the payload of an HTTP request when either application/x-www-form-urlencoded,
|
|
76
|
-
* multipart/form-data or both are used as the content type of the request (in Swagger's definition, the
|
|
77
|
-
* consumes property of an operation). This is the only parameter type that can be used to send files,
|
|
78
|
-
* thus supporting the file type. Since form parameters are sent in the payload, they cannot be declared
|
|
79
|
-
* together with a body parameter for the same operation. Form parameters have a different format based on
|
|
80
|
-
* the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4):
|
|
81
|
-
* - application/x-www-form-urlencoded - Similar to the format of Query parameters but as a payload.
|
|
82
|
-
* For example, foo=1&bar=swagger - both foo and bar are form parameters. This is normally used for simple
|
|
83
|
-
* parameters that are being transferred.
|
|
84
|
-
* - multipart/form-data - each parameter takes a section in the payload with an internal header.
|
|
85
|
-
* For example, for the header Content-Disposition: form-data; name="submit-name" the name of the parameter is
|
|
86
|
-
* submit-name. This type of form parameters is more commonly used for file transfers.”
|
|
87
|
-
*/
|
|
88
|
-
const formDataParameters = getParametersFromOperation(operation.parameters ?? [],
|
|
89
|
-
// TODO: Add path parameters
|
|
90
|
-
[], // operation.path ?? [],
|
|
91
|
-
'formData', false);
|
|
92
|
-
if (formDataParameters.length > 0) {
|
|
93
|
-
return {
|
|
94
|
-
mimeType: 'application/x-www-form-urlencoded',
|
|
95
|
-
params: formDataParameters.map((parameter) => ({
|
|
96
|
-
name: parameter.name,
|
|
97
|
-
/**
|
|
98
|
-
* TODO: This value MUST be a string
|
|
99
|
-
* Figure out why this is not always a string
|
|
100
|
-
*
|
|
101
|
-
* JSON.stringify is a TEMPORARY fix
|
|
102
|
-
*/
|
|
103
|
-
value: typeof parameter.value === 'string' ? parameter.value : JSON.stringify(parameter.value),
|
|
104
|
-
})),
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
// If no mime type is supported, exit early
|
|
108
|
-
if (!mimeType) {
|
|
109
|
-
return null;
|
|
110
|
-
}
|
|
111
|
-
// Get the request body object for the mime type
|
|
112
|
-
const requestBodyObject = content?.[mimeType];
|
|
113
|
-
// Get example from operation
|
|
114
|
-
const example = requestBodyObject?.example ? requestBodyObject?.example : undefined;
|
|
115
|
-
// Update the JSON handling section
|
|
116
|
-
if (isJsonLike) {
|
|
117
|
-
const exampleFromSchema = requestBodyObject?.schema
|
|
118
|
-
? getExampleFromSchema(getResolvedRef(requestBodyObject?.schema), {
|
|
119
|
-
mode: 'write',
|
|
120
|
-
omitEmptyAndOptionalProperties: omitEmptyAndOptionalProperties ?? false,
|
|
121
|
-
})
|
|
122
|
-
: null;
|
|
123
|
-
const body = example ?? exampleFromSchema;
|
|
124
|
-
return {
|
|
125
|
-
mimeType,
|
|
126
|
-
text: body ? (typeof body === 'string' ? body : JSON.stringify(body, null, 2)) : undefined,
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
// XML
|
|
130
|
-
if (mimeType === 'application/xml') {
|
|
131
|
-
const exampleFromSchema = requestBodyObject?.schema
|
|
132
|
-
? getExampleFromSchema(getResolvedRef(requestBodyObject?.schema), {
|
|
133
|
-
xml: true,
|
|
134
|
-
mode: 'write',
|
|
135
|
-
})
|
|
136
|
-
: null;
|
|
137
|
-
return {
|
|
138
|
-
mimeType,
|
|
139
|
-
text: example ?? json2xml(exampleFromSchema),
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
// Binary data
|
|
143
|
-
if (mimeType === 'application/octet-stream') {
|
|
144
|
-
return {
|
|
145
|
-
mimeType,
|
|
146
|
-
text: 'BINARY',
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
// Plain text
|
|
150
|
-
if (mimeType === 'text/plain') {
|
|
151
|
-
const exampleFromSchema = requestBodyObject?.schema
|
|
152
|
-
? getExampleFromSchema(getResolvedRef(requestBodyObject?.schema), {
|
|
153
|
-
xml: true,
|
|
154
|
-
mode: 'write',
|
|
155
|
-
})
|
|
156
|
-
: null;
|
|
157
|
-
return {
|
|
158
|
-
mimeType,
|
|
159
|
-
text: example ?? exampleFromSchema ?? '',
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
// URL encoded data
|
|
163
|
-
if (mimeType === 'multipart/form-data' || mimeType === 'application/x-www-form-urlencoded') {
|
|
164
|
-
const exampleFromSchema = requestBodyObject?.schema
|
|
165
|
-
? getExampleFromSchema(getResolvedRef(requestBodyObject?.schema), {
|
|
166
|
-
xml: true,
|
|
167
|
-
mode: 'write',
|
|
168
|
-
})
|
|
169
|
-
: null;
|
|
170
|
-
return {
|
|
171
|
-
mimeType,
|
|
172
|
-
params: getParamsFromObject(example ?? exampleFromSchema ?? {}),
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
return null;
|
|
176
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-server-variable-examples.d.ts","sourceRoot":"","sources":["../../src/spec-getters/get-server-variable-examples.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAEpD,mDAAmD;AACnD,eAAO,MAAM,yBAAyB,GAAI,QAAQ,MAAM,6BAUvD,CAAA"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/** Retrieve example values for server variables */
|
|
2
|
-
export const getServerVariableExamples = (server) => {
|
|
3
|
-
const examples = {};
|
|
4
|
-
if (server.variables) {
|
|
5
|
-
for (const [key, variable] of Object.entries(server.variables)) {
|
|
6
|
-
examples[key] = variable.enum?.filter((v) => typeof v === 'string') ?? [
|
|
7
|
-
variable.default,
|
|
8
|
-
];
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
return examples;
|
|
12
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { getExampleFromSchema } from './get-example-from-schema.js';
|
|
2
|
-
export { getParametersFromOperation } from './get-parameters-from-operation.js';
|
|
3
|
-
export { getRequestBodyFromOperation } from './get-request-body-from-operation.js';
|
|
4
|
-
export { getServerVariableExamples } from './get-server-variable-examples.js';
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/spec-getters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAA;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { getExampleFromSchema } from './get-example-from-schema.js';
|
|
2
|
-
export { getParametersFromOperation } from './get-parameters-from-operation.js';
|
|
3
|
-
export { getRequestBodyFromOperation } from './get-request-body-from-operation.js';
|
|
4
|
-
export { getServerVariableExamples } from './get-server-variable-examples.js';
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import type { OpenAPIV3_1 } from '@scalar/openapi-types';
|
|
2
|
-
import type { ApiReferenceConfiguration } from '@scalar/types/api-reference';
|
|
3
|
-
import { type SecurityScheme } from '@scalar/types/entities';
|
|
4
|
-
import type { UnknownObject } from '@scalar/types/utils';
|
|
5
|
-
import type { SelectedSecuritySchemeUids } from '../entities/shared/utility.js';
|
|
6
|
-
import { type Collection, type CollectionPayload } from '../entities/spec/collection.js';
|
|
7
|
-
import { type RequestExample } from '../entities/spec/request-examples.js';
|
|
8
|
-
import { type Request } from '../entities/spec/requests.js';
|
|
9
|
-
import { type Server } from '../entities/spec/server.js';
|
|
10
|
-
import { type Tag } from '../entities/spec/spec-objects.js';
|
|
11
|
-
/** Takes a string or object and parses it into an openapi spec compliant schema */
|
|
12
|
-
export declare const parseSchema: (originalDocument: string | UnknownObject | undefined, { shouldLoad, dereferencedDocument, }?: {
|
|
13
|
-
shouldLoad?: boolean;
|
|
14
|
-
dereferencedDocument?: OpenAPIV3_1.Document;
|
|
15
|
-
}) => Promise<{
|
|
16
|
-
/**
|
|
17
|
-
* Temporary fix for the parser returning an empty array
|
|
18
|
-
* TODO: remove this once the parser is fixed
|
|
19
|
-
*/
|
|
20
|
-
schema: OpenAPIV3_1.Document;
|
|
21
|
-
errors: import("@scalar/openapi-parser").ErrorObject[];
|
|
22
|
-
}>;
|
|
23
|
-
/** Converts selected security requirements to uids */
|
|
24
|
-
export declare const getSelectedSecuritySchemeUids: (securityRequirements: (string | string[])[], preferredSecurityNames: (string | string[])[] | undefined, securitySchemeMap: Record<string, SecurityScheme["uid"]>) => SelectedSecuritySchemeUids;
|
|
25
|
-
/** Create a "uid" from a slug */
|
|
26
|
-
export declare const getSlugUid: (slug: string) => Collection["uid"];
|
|
27
|
-
export type ImportSpecToWorkspaceArgs = Pick<CollectionPayload, 'documentUrl' | 'watchMode'> & Pick<ApiReferenceConfiguration, 'authentication' | 'baseServerURL' | 'servers' | 'slug'> & {
|
|
28
|
-
/** The dereferenced document */
|
|
29
|
-
dereferencedDocument?: OpenAPIV3_1.Document;
|
|
30
|
-
/** Sets the preferred security scheme on the collection instead of the requests */
|
|
31
|
-
useCollectionSecurity?: boolean;
|
|
32
|
-
/** Call the load step from the parser */
|
|
33
|
-
shouldLoad?: boolean;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Imports an OpenAPI document and converts it to workspace entities (Collection, Request, Server, etc.)
|
|
37
|
-
*
|
|
38
|
-
* The imported entities maintain a close mapping to the original OpenAPI specification to enable:
|
|
39
|
-
* - Bi-directional translation between spec and workspace entities
|
|
40
|
-
* - Preservation of specification details and structure
|
|
41
|
-
* - Accurate representation of relationships between components
|
|
42
|
-
*
|
|
43
|
-
* Relationships between entities are maintained through unique identifiers (UIDs) which allow:
|
|
44
|
-
* - Flexible organization at different levels (workspace, collection, request)
|
|
45
|
-
* - Proper linking between related components
|
|
46
|
-
* - Easy lookup and reference of dependent entities
|
|
47
|
-
*/
|
|
48
|
-
export declare function importSpecToWorkspace(content: string | UnknownObject | undefined, {
|
|
49
|
-
/** If a dereferenced document is provided, we will skip the dereferencing step. */
|
|
50
|
-
dereferencedDocument, authentication, baseServerURL, documentUrl, servers: configuredServers, useCollectionSecurity, slug, shouldLoad, watchMode, }?: ImportSpecToWorkspaceArgs): Promise<{
|
|
51
|
-
error: false;
|
|
52
|
-
collection: Collection;
|
|
53
|
-
requests: Request[];
|
|
54
|
-
schema: OpenAPIV3_1.Document;
|
|
55
|
-
examples: RequestExample[];
|
|
56
|
-
servers: Server[];
|
|
57
|
-
tags: Tag[];
|
|
58
|
-
securitySchemes: SecurityScheme[];
|
|
59
|
-
} | {
|
|
60
|
-
error: true;
|
|
61
|
-
importWarnings: string[];
|
|
62
|
-
collection: undefined;
|
|
63
|
-
}>;
|
|
64
|
-
//# sourceMappingURL=import-spec.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"import-spec.d.ts","sourceRoot":"","sources":["../../src/transforms/import-spec.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAE5E,OAAO,EAEL,KAAK,cAAc,EAGpB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGxD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAA;AAC3E,OAAO,EAAE,KAAK,UAAU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