@scalar/openapi-parser 0.20.2 → 0.20.3
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade-from-two-to-three.d.ts","sourceRoot":"","sources":["../../src/utils/upgrade-from-two-to-three.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAoBxD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,qBAAqB,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"upgrade-from-two-to-three.d.ts","sourceRoot":"","sources":["../../src/utils/upgrade-from-two-to-three.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAoBxD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,qBAAqB,EAAE,aAAa,0CA4OzE"}
|
|
@@ -52,78 +52,60 @@ function upgradeFromTwoToThree(originalSpecification) {
|
|
|
52
52
|
}
|
|
53
53
|
return schema;
|
|
54
54
|
});
|
|
55
|
+
if (Object.hasOwn(specification, "parameters")) {
|
|
56
|
+
specification.components ??= {};
|
|
57
|
+
const params = {};
|
|
58
|
+
const bodyParams = {};
|
|
59
|
+
for (const [name, param] of Object.entries(specification.parameters ?? {})) {
|
|
60
|
+
if (param.in === "body") {
|
|
61
|
+
bodyParams[name] = migrateBodyParameter(
|
|
62
|
+
param,
|
|
63
|
+
specification.consumes ?? ["application/json"]
|
|
64
|
+
);
|
|
65
|
+
} else if (param.in === "formData") {
|
|
66
|
+
bodyParams[name] = migrateFormDataParameter(param);
|
|
67
|
+
} else {
|
|
68
|
+
params[name] = transformParameterObject(param);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (Object.keys(params).length > 0) {
|
|
72
|
+
;
|
|
73
|
+
specification.components.parameters = params;
|
|
74
|
+
}
|
|
75
|
+
if (Object.keys(bodyParams).length > 0) {
|
|
76
|
+
;
|
|
77
|
+
specification.components.requestBodies = bodyParams;
|
|
78
|
+
}
|
|
79
|
+
delete specification.parameters;
|
|
80
|
+
}
|
|
55
81
|
if (typeof specification.paths === "object") {
|
|
56
82
|
for (const path in specification.paths) {
|
|
57
83
|
if (Object.hasOwn(specification.paths, path)) {
|
|
58
84
|
const pathItem = specification.paths[path];
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
85
|
+
let requestBodyObject;
|
|
86
|
+
for (const methodOrParameters in pathItem) {
|
|
87
|
+
if (methodOrParameters === "parameters" && Object.hasOwn(pathItem, methodOrParameters)) {
|
|
88
|
+
const pathItemParameters = migrateParameters(
|
|
89
|
+
pathItem.parameters,
|
|
90
|
+
specification.consumes ?? ["application/json"]
|
|
91
|
+
);
|
|
92
|
+
pathItem.parameters = pathItemParameters.parameters;
|
|
93
|
+
requestBodyObject = pathItemParameters.requestBody;
|
|
94
|
+
} else if (Object.hasOwn(pathItem, methodOrParameters)) {
|
|
95
|
+
const operationItem = pathItem[methodOrParameters];
|
|
96
|
+
if (requestBodyObject) {
|
|
97
|
+
operationItem.requestBody = requestBodyObject;
|
|
98
|
+
}
|
|
62
99
|
if (operationItem.parameters) {
|
|
63
|
-
const
|
|
64
|
-
operationItem.parameters
|
|
100
|
+
const migrationResult = migrateParameters(
|
|
101
|
+
operationItem.parameters,
|
|
102
|
+
operationItem.consumes ?? specification.consumes ?? ["application/json"]
|
|
65
103
|
);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const consumes = specification.consumes ?? operationItem.consumes ?? ["application/json"];
|
|
70
|
-
if (typeof operationItem.requestBody !== "object") {
|
|
71
|
-
operationItem.requestBody = {};
|
|
72
|
-
}
|
|
73
|
-
if (typeof operationItem.requestBody.content !== "object") {
|
|
74
|
-
operationItem.requestBody.content = {};
|
|
75
|
-
}
|
|
76
|
-
const { schema, ...requestBody } = bodyParameter;
|
|
77
|
-
operationItem.requestBody = {
|
|
78
|
-
...operationItem.requestBody,
|
|
79
|
-
...requestBody
|
|
80
|
-
};
|
|
81
|
-
for (const type of consumes) {
|
|
82
|
-
operationItem.requestBody.content[type] = {
|
|
83
|
-
schema
|
|
84
|
-
};
|
|
85
|
-
}
|
|
104
|
+
operationItem.parameters = migrationResult.parameters;
|
|
105
|
+
if (migrationResult.requestBody) {
|
|
106
|
+
operationItem.requestBody = migrationResult.requestBody;
|
|
86
107
|
}
|
|
87
|
-
operationItem.parameters = operationItem.parameters.filter(
|
|
88
|
-
(parameter) => parameter.in !== "body"
|
|
89
|
-
);
|
|
90
108
|
delete operationItem.consumes;
|
|
91
|
-
const formDataParameters = operationItem.parameters.filter(
|
|
92
|
-
(parameter) => parameter.in === "formData"
|
|
93
|
-
);
|
|
94
|
-
if (formDataParameters.length > 0) {
|
|
95
|
-
if (typeof operationItem.requestBody !== "object") {
|
|
96
|
-
operationItem.requestBody = {};
|
|
97
|
-
}
|
|
98
|
-
if (typeof operationItem.requestBody.content !== "object") {
|
|
99
|
-
operationItem.requestBody.content = {};
|
|
100
|
-
}
|
|
101
|
-
operationItem.requestBody.content["application/x-www-form-urlencoded"] = {
|
|
102
|
-
schema: {
|
|
103
|
-
type: "object",
|
|
104
|
-
properties: {},
|
|
105
|
-
required: []
|
|
106
|
-
// Initialize required array
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
for (const param of formDataParameters) {
|
|
110
|
-
operationItem.requestBody.content["application/x-www-form-urlencoded"].schema.properties[param.name] = {
|
|
111
|
-
type: param.type,
|
|
112
|
-
description: param.description
|
|
113
|
-
};
|
|
114
|
-
if (param.required) {
|
|
115
|
-
operationItem.requestBody.content["application/x-www-form-urlencoded"].schema.required.push(
|
|
116
|
-
param.name
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
operationItem.parameters = operationItem.parameters.filter(
|
|
121
|
-
(parameter) => parameter.in !== "formData"
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
operationItem.parameters = operationItem.parameters.map(
|
|
125
|
-
(parameter) => transformParameterObject(parameter)
|
|
126
|
-
);
|
|
127
109
|
}
|
|
128
110
|
if (operationItem.responses) {
|
|
129
111
|
for (const response in operationItem.responses) {
|
|
@@ -200,6 +182,8 @@ function upgradeFromTwoToThree(originalSpecification) {
|
|
|
200
182
|
}
|
|
201
183
|
delete specification.securityDefinitions;
|
|
202
184
|
}
|
|
185
|
+
delete specification.consumes;
|
|
186
|
+
delete specification.produces;
|
|
203
187
|
return specification;
|
|
204
188
|
}
|
|
205
189
|
function transformItemsObject(obj) {
|
|
@@ -280,6 +264,76 @@ function getParameterSerializationStyle(parameter) {
|
|
|
280
264
|
const collectionFormat = parameter.collectionFormat ?? "csv";
|
|
281
265
|
return serializationStyles[parameter.in][collectionFormat];
|
|
282
266
|
}
|
|
267
|
+
function migrateBodyParameter(bodyParameter, consumes) {
|
|
268
|
+
delete bodyParameter.name;
|
|
269
|
+
delete bodyParameter.in;
|
|
270
|
+
const { schema, ...requestBody } = bodyParameter;
|
|
271
|
+
const requestBodyObject = {
|
|
272
|
+
content: {},
|
|
273
|
+
...requestBody
|
|
274
|
+
};
|
|
275
|
+
for (const type of consumes) {
|
|
276
|
+
requestBodyObject.content[type] = {
|
|
277
|
+
schema
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
return requestBodyObject;
|
|
281
|
+
}
|
|
282
|
+
function migrateFormDataParameter(parameters) {
|
|
283
|
+
const requestBodyObject = {
|
|
284
|
+
content: {}
|
|
285
|
+
};
|
|
286
|
+
requestBodyObject.content["application/x-www-form-urlencoded"] = {
|
|
287
|
+
schema: {
|
|
288
|
+
type: "object",
|
|
289
|
+
properties: {},
|
|
290
|
+
required: []
|
|
291
|
+
// Initialize required array
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
for (const param of parameters) {
|
|
295
|
+
requestBodyObject.content["application/x-www-form-urlencoded"].schema.properties[param.name] = {
|
|
296
|
+
type: param.type,
|
|
297
|
+
description: param.description
|
|
298
|
+
};
|
|
299
|
+
if (param.required) {
|
|
300
|
+
requestBodyObject.content["application/x-www-form-urlencoded"].schema.required.push(param.name);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return requestBodyObject;
|
|
304
|
+
}
|
|
305
|
+
function migrateParameters(parameters, consumes) {
|
|
306
|
+
const result = {
|
|
307
|
+
parameters: parameters.filter((parameter) => !(parameter.in === "body" || parameter.in === "formData")).map((parameter) => transformParameterObject(parameter))
|
|
308
|
+
};
|
|
309
|
+
const bodyParameter = structuredClone(
|
|
310
|
+
parameters.find((parameter) => parameter.in === "body") ?? {}
|
|
311
|
+
);
|
|
312
|
+
if (bodyParameter && Object.keys(bodyParameter).length) {
|
|
313
|
+
result.requestBody = migrateBodyParameter(bodyParameter, consumes);
|
|
314
|
+
}
|
|
315
|
+
const formDataParameters = parameters.filter((parameter) => parameter.in === "formData");
|
|
316
|
+
if (formDataParameters.length > 0) {
|
|
317
|
+
const requestBodyObject = migrateFormDataParameter(formDataParameters);
|
|
318
|
+
if (typeof result.requestBody !== "object") {
|
|
319
|
+
result.requestBody = requestBodyObject;
|
|
320
|
+
} else {
|
|
321
|
+
result.requestBody = {
|
|
322
|
+
...result.requestBody,
|
|
323
|
+
content: {
|
|
324
|
+
...result.requestBody.content,
|
|
325
|
+
...requestBodyObject.content
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
if (typeof result.requestBody !== "object") {
|
|
330
|
+
result.requestBody = {
|
|
331
|
+
content: {}
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
return result;
|
|
336
|
+
}
|
|
283
337
|
export {
|
|
284
338
|
upgradeFromTwoToThree
|
|
285
339
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/upgrade-from-two-to-three.ts"],
|
|
4
|
-
"sourcesContent": ["import type { OpenAPIV2, OpenAPIV3 } from '@scalar/openapi-types'\nimport type { UnknownObject } from '@scalar/types/utils'\n\nimport { traverse } from './traverse'\n\n/** Update the flow names to OpenAPI 3.1.0 format */\nconst upgradeFlow = (flow: string): 'implicit' | 'password' | 'clientCredentials' | 'authorizationCode' => {\n switch (flow) {\n case 'application':\n return 'clientCredentials'\n case 'accessCode':\n return 'authorizationCode'\n case 'implicit':\n return 'implicit'\n case 'password':\n return 'password'\n default:\n return flow as never\n }\n}\n\n/**\n * Upgrade Swagger 2.0 to OpenAPI 3.0\n *\n * https://swagger.io/blog/news/whats-new-in-openapi-3-0/\n */\nexport function upgradeFromTwoToThree(originalSpecification: UnknownObject) {\n let specification = originalSpecification\n\n // Version\n if (\n specification !== null &&\n typeof specification === 'object' &&\n typeof specification.swagger === 'string' &&\n specification.swagger?.startsWith('2.0')\n ) {\n specification.openapi = '3.0.4'\n delete specification.swagger\n } else {\n // Skip if it's something else than 3.0.x\n return specification\n }\n\n // Servers\n if (specification.host) {\n const schemes =\n Array.isArray(specification.schemes) && specification.schemes?.length ? specification.schemes : ['http']\n\n specification.servers = schemes.map((scheme: string[]) => ({\n url: `${scheme}://${specification.host}${specification.basePath ?? ''}`,\n }))\n\n delete specification.basePath\n delete specification.schemes\n delete specification.host\n } else if (specification.basePath) {\n specification.servers = [{ url: specification.basePath }]\n delete specification.basePath\n }\n\n // Schemas\n if (specification.definitions) {\n specification.components = Object.assign({}, specification.components, {\n schemas: specification.definitions,\n })\n\n delete specification.definitions\n\n // Rewrite $refs to definitions\n specification = traverse(specification, (schema) => {\n // Rewrite $refs to components\n if (typeof schema.$ref === 'string' && schema.$ref.startsWith('#/definitions/')) {\n schema.$ref = schema.$ref.replace(/^#\\/definitions\\//, '#/components/schemas/')\n }\n\n return schema\n })\n }\n\n // Transform file type to string with binary format\n specification = traverse(specification, (schema) => {\n if (schema.type === 'file') {\n schema.type = 'string'\n schema.format = 'binary'\n }\n\n return schema\n })\n\n // Paths\n if (typeof specification.paths === 'object') {\n for (const path in specification.paths) {\n if (Object.hasOwn(specification.paths, path)) {\n const pathItem = specification.paths[path]\n\n for (const method in pathItem) {\n if (Object.hasOwn(pathItem, method)) {\n const operationItem = pathItem[method]\n\n // Request bodies\n if (operationItem.parameters) {\n const bodyParameter = structuredClone(\n operationItem.parameters.find((parameter: OpenAPIV3.ParameterObject) => parameter.in === 'body') ?? {},\n )\n\n if (bodyParameter && Object.keys(bodyParameter).length) {\n delete bodyParameter.name\n delete bodyParameter.in\n\n const consumes = specification.consumes ?? operationItem.consumes ?? ['application/json']\n\n if (typeof operationItem.requestBody !== 'object') {\n operationItem.requestBody = {}\n }\n\n if (typeof operationItem.requestBody.content !== 'object') {\n operationItem.requestBody.content = {}\n }\n\n const { schema, ...requestBody } = bodyParameter\n\n operationItem.requestBody = {\n ...operationItem.requestBody,\n ...requestBody,\n }\n\n for (const type of consumes) {\n operationItem.requestBody.content[type] = {\n schema: schema,\n }\n }\n }\n\n // Delete body parameter\n operationItem.parameters = operationItem.parameters.filter(\n (parameter: OpenAPIV2.ParameterObject) => parameter.in !== 'body',\n )\n\n delete operationItem.consumes\n\n // formData parameters\n const formDataParameters = operationItem.parameters.filter(\n (parameter: OpenAPIV2.ParameterObject) => parameter.in === 'formData',\n )\n\n if (formDataParameters.length > 0) {\n if (typeof operationItem.requestBody !== 'object') {\n operationItem.requestBody = {}\n }\n\n if (typeof operationItem.requestBody.content !== 'object') {\n operationItem.requestBody.content = {}\n }\n\n operationItem.requestBody.content['application/x-www-form-urlencoded'] = {\n schema: {\n type: 'object',\n properties: {},\n required: [], // Initialize required array\n },\n }\n\n for (const param of formDataParameters) {\n operationItem.requestBody.content['application/x-www-form-urlencoded'].schema.properties[param.name] =\n {\n type: param.type,\n description: param.description,\n }\n\n // Add to required array if param is required\n if (param.required) {\n operationItem.requestBody.content['application/x-www-form-urlencoded'].schema.required.push(\n param.name,\n )\n }\n }\n\n // Remove formData parameters from the parameters array\n operationItem.parameters = operationItem.parameters.filter(\n (parameter: OpenAPIV2.ParameterObject) => parameter.in !== 'formData',\n )\n }\n\n operationItem.parameters = operationItem.parameters.map((parameter) =>\n transformParameterObject(parameter),\n )\n }\n\n // Responses\n if (operationItem.responses) {\n for (const response in operationItem.responses) {\n if (Object.hasOwn(operationItem.responses, response)) {\n const responseItem = operationItem.responses[response]\n\n if (responseItem.headers) {\n responseItem.headers = Object.entries(responseItem.headers).reduce((acc, [name, header]) => {\n return {\n [name]: transformParameterObject(header),\n ...acc,\n }\n }, {})\n }\n if (responseItem.schema) {\n const produces = specification.produces ?? operationItem.produces ?? ['application/json']\n\n if (typeof responseItem.content !== 'object') {\n responseItem.content = {}\n }\n\n for (const type of produces) {\n responseItem.content[type] = {\n schema: responseItem.schema,\n }\n }\n\n delete responseItem.schema\n }\n }\n }\n }\n\n delete operationItem.produces\n\n // Delete empty parameters\n if (operationItem.parameters?.length === 0) {\n delete operationItem.parameters\n }\n }\n }\n }\n }\n }\n\n // Upgrade securityDefinitions\n if (specification.securityDefinitions) {\n if (typeof specification.components !== 'object') {\n specification.components = {}\n }\n\n // Assert that components is of type OpenAPIV3.ComponentsObject\n specification.components = specification.components as OpenAPIV3.ComponentsObject\n\n Object.assign(specification.components, { securitySchemes: {} })\n\n for (const [key, securityScheme] of Object.entries(specification.securityDefinitions)) {\n if (typeof securityScheme === 'object') {\n if ('type' in securityScheme && securityScheme.type === 'oauth2') {\n const { flow, authorizationUrl, tokenUrl, scopes } = securityScheme as {\n type: 'oauth2'\n flow?: string\n authorizationUrl?: string\n tokenUrl?: string\n scopes?: Record<string, string>\n }\n\n // Convert flow values to OpenAPI 3.1.0 format\n\n // Assert that securitySchemes is of type OpenAPIV3.SecuritySchemeObject\n Object.assign((specification.components as OpenAPIV3.ComponentsObject).securitySchemes, {\n [key]: {\n type: 'oauth2',\n flows: {\n [upgradeFlow(flow)]: Object.assign(\n {},\n authorizationUrl && { authorizationUrl },\n tokenUrl && { tokenUrl },\n scopes && { scopes },\n ),\n },\n },\n })\n } else if ('type' in securityScheme && securityScheme.type === 'basic') {\n Object.assign((specification.components as OpenAPIV3.ComponentsObject).securitySchemes, {\n [key]: {\n type: 'http',\n scheme: 'basic',\n },\n })\n } else {\n Object.assign((specification.components as OpenAPIV3.ComponentsObject).securitySchemes, {\n [key]: securityScheme,\n })\n }\n }\n }\n\n delete specification.securityDefinitions\n }\n\n return specification as OpenAPIV3.Document\n}\n\nfunction transformItemsObject<T extends Record<PropertyKey, unknown>>(obj: T): OpenAPIV3.SchemaObject {\n const schemaProperties = [\n 'type',\n 'format',\n 'items',\n 'maximum',\n 'exclusiveMaximum',\n 'minimum',\n 'exclusiveMinimum',\n 'maxLength',\n 'minLength',\n 'pattern',\n 'maxItems',\n 'minItems',\n 'uniqueItems',\n 'enum',\n 'multipleOf',\n ]\n\n return schemaProperties.reduce((acc, property) => {\n if (Object.hasOwn(obj, property)) {\n acc[property] = obj[property]\n delete obj[property]\n }\n\n return acc\n }, {} as OpenAPIV3.SchemaObject)\n}\n\nfunction transformParameterObject(parameter: OpenAPIV2.ParameterObject): OpenAPIV3.ParameterObject {\n // it is important to call getParameterSerializationStyle first because transformItemsObject modifies properties on which getParameterSerializationStyle rely on\n const serializationStyle = getParameterSerializationStyle(parameter)\n const schema = transformItemsObject(parameter)\n\n delete parameter.collectionFormat\n delete parameter.default\n\n return {\n schema,\n ...serializationStyle,\n ...parameter,\n }\n}\n\ntype CollectionFormat = 'csv' | 'ssv' | 'tsv' | 'pipes' | 'multi'\n\ntype ParameterSerializationStyle = { style?: string; explode?: boolean }\n\nconst querySerialization: Record<CollectionFormat, ParameterSerializationStyle> = {\n ssv: {\n style: 'spaceDelimited',\n explode: false,\n },\n pipes: {\n style: 'pipeDelimited',\n explode: false,\n },\n multi: {\n style: 'form',\n explode: true,\n },\n csv: {\n style: 'form',\n explode: false,\n },\n tsv: {},\n}\n\nconst pathAndHeaderSerialization: Record<CollectionFormat, ParameterSerializationStyle> = {\n ssv: {},\n pipes: {},\n multi: {},\n csv: {\n style: 'simple',\n explode: false,\n },\n tsv: {},\n}\n\nconst serializationStyles = {\n header: pathAndHeaderSerialization,\n query: querySerialization,\n path: pathAndHeaderSerialization,\n} as const\n\nfunction getParameterSerializationStyle(parameter: OpenAPIV2.ParameterObject): ParameterSerializationStyle {\n if (\n parameter.type !== 'array' ||\n !(parameter.in === 'query' || parameter.in === 'path' || parameter.in === 'header')\n ) {\n return {}\n }\n\n const collectionFormat = parameter.collectionFormat ?? 'csv'\n\n return serializationStyles[parameter.in][collectionFormat]\n}\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,gBAAgB;AAGzB,MAAM,cAAc,CAAC,SAAsF;AACzG,UAAQ,MAAM;AAAA,IACZ,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAOO,SAAS,sBAAsB,uBAAsC;AAC1E,MAAI,gBAAgB;AAGpB,MACE,kBAAkB,QAClB,OAAO,kBAAkB,YACzB,OAAO,cAAc,YAAY,YACjC,cAAc,SAAS,WAAW,KAAK,GACvC;AACA,kBAAc,UAAU;AACxB,WAAO,cAAc;AAAA,EACvB,OAAO;AAEL,WAAO;AAAA,EACT;AAGA,MAAI,cAAc,MAAM;AACtB,UAAM,UACJ,MAAM,QAAQ,cAAc,OAAO,KAAK,cAAc,SAAS,SAAS,cAAc,UAAU,CAAC,MAAM;AAEzG,kBAAc,UAAU,QAAQ,IAAI,CAAC,YAAsB;AAAA,MACzD,KAAK,GAAG,MAAM,MAAM,cAAc,IAAI,GAAG,cAAc,YAAY,EAAE;AAAA,IACvE,EAAE;AAEF,WAAO,cAAc;AACrB,WAAO,cAAc;AACrB,WAAO,cAAc;AAAA,EACvB,WAAW,cAAc,UAAU;AACjC,kBAAc,UAAU,CAAC,EAAE,KAAK,cAAc,SAAS,CAAC;AACxD,WAAO,cAAc;AAAA,EACvB;AAGA,MAAI,cAAc,aAAa;AAC7B,kBAAc,aAAa,OAAO,OAAO,CAAC,GAAG,cAAc,YAAY;AAAA,MACrE,SAAS,cAAc;AAAA,IACzB,CAAC;AAED,WAAO,cAAc;AAGrB,oBAAgB,SAAS,eAAe,CAAC,WAAW;AAElD,UAAI,OAAO,OAAO,SAAS,YAAY,OAAO,KAAK,WAAW,gBAAgB,GAAG;AAC/E,eAAO,OAAO,OAAO,KAAK,QAAQ,qBAAqB,uBAAuB;AAAA,MAChF;AAEA,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAGA,kBAAgB,SAAS,eAAe,CAAC,WAAW;AAClD,QAAI,OAAO,SAAS,QAAQ;AAC1B,aAAO,OAAO;AACd,aAAO,SAAS;AAAA,IAClB;AAEA,WAAO;AAAA,EACT,CAAC;
|
|
4
|
+
"sourcesContent": ["import type { OpenAPIV2, OpenAPIV3 } from '@scalar/openapi-types'\nimport type { UnknownObject } from '@scalar/types/utils'\n\nimport { traverse } from './traverse'\n\n/** Update the flow names to OpenAPI 3.1.0 format */\nconst upgradeFlow = (flow: string): 'implicit' | 'password' | 'clientCredentials' | 'authorizationCode' => {\n switch (flow) {\n case 'application':\n return 'clientCredentials'\n case 'accessCode':\n return 'authorizationCode'\n case 'implicit':\n return 'implicit'\n case 'password':\n return 'password'\n default:\n return flow as never\n }\n}\n\n/**\n * Upgrade Swagger 2.0 to OpenAPI 3.0\n *\n * https://swagger.io/blog/news/whats-new-in-openapi-3-0/\n */\nexport function upgradeFromTwoToThree(originalSpecification: UnknownObject) {\n let specification = originalSpecification\n\n // Version\n if (\n specification !== null &&\n typeof specification === 'object' &&\n typeof specification.swagger === 'string' &&\n specification.swagger?.startsWith('2.0')\n ) {\n specification.openapi = '3.0.4'\n delete specification.swagger\n } else {\n // Skip if it's something else than 3.0.x\n return specification\n }\n\n // Servers\n if (specification.host) {\n const schemes =\n Array.isArray(specification.schemes) && specification.schemes?.length ? specification.schemes : ['http']\n\n specification.servers = schemes.map((scheme: string[]) => ({\n url: `${scheme}://${specification.host}${specification.basePath ?? ''}`,\n }))\n\n delete specification.basePath\n delete specification.schemes\n delete specification.host\n } else if (specification.basePath) {\n specification.servers = [{ url: specification.basePath }]\n delete specification.basePath\n }\n\n // Schemas\n if (specification.definitions) {\n specification.components = Object.assign({}, specification.components, {\n schemas: specification.definitions,\n })\n\n delete specification.definitions\n\n // Rewrite $refs to definitions\n specification = traverse(specification, (schema) => {\n // Rewrite $refs to components\n if (typeof schema.$ref === 'string' && schema.$ref.startsWith('#/definitions/')) {\n schema.$ref = schema.$ref.replace(/^#\\/definitions\\//, '#/components/schemas/')\n }\n\n return schema\n })\n }\n\n // Transform file type to string with binary format\n specification = traverse(specification, (schema) => {\n if (schema.type === 'file') {\n schema.type = 'string'\n schema.format = 'binary'\n }\n\n return schema\n })\n\n if (Object.hasOwn(specification, 'parameters')) {\n specification.components ??= {}\n\n const params = {}\n const bodyParams = {}\n for (const [name, param] of Object.entries(specification.parameters ?? {})) {\n if (param.in === 'body') {\n bodyParams[name] = migrateBodyParameter(\n param,\n (specification.consumes as string[] | undefined) ?? ['application/json'],\n )\n } else if (param.in === 'formData') {\n bodyParams[name] = migrateFormDataParameter(param)\n } else {\n params[name] = transformParameterObject(param)\n }\n }\n\n if (Object.keys(params).length > 0) {\n ;(specification.components as UnknownObject).parameters = params\n }\n\n if (Object.keys(bodyParams).length > 0) {\n ;(specification.components as UnknownObject).requestBodies = bodyParams\n }\n\n delete specification.parameters\n }\n\n // Paths\n if (typeof specification.paths === 'object') {\n for (const path in specification.paths) {\n if (Object.hasOwn(specification.paths, path)) {\n const pathItem = specification.paths[path]\n\n let requestBodyObject: OpenAPIV3.RequestBodyObject | undefined\n\n for (const methodOrParameters in pathItem) {\n if (methodOrParameters === 'parameters' && Object.hasOwn(pathItem, methodOrParameters)) {\n const pathItemParameters = migrateParameters(\n pathItem.parameters,\n (specification.consumes as string[] | undefined) ?? ['application/json'],\n )\n\n pathItem.parameters = pathItemParameters.parameters\n requestBodyObject = pathItemParameters.requestBody\n } else if (Object.hasOwn(pathItem, methodOrParameters)) {\n const operationItem = pathItem[methodOrParameters]\n\n if (requestBodyObject) {\n operationItem.requestBody = requestBodyObject\n }\n\n if (operationItem.parameters) {\n const migrationResult = migrateParameters(\n operationItem.parameters,\n operationItem.consumes ?? specification.consumes ?? ['application/json'],\n )\n\n operationItem.parameters = migrationResult.parameters\n\n if (migrationResult.requestBody) {\n operationItem.requestBody = migrationResult.requestBody\n }\n\n delete operationItem.consumes\n }\n\n // Responses\n if (operationItem.responses) {\n for (const response in operationItem.responses) {\n if (Object.hasOwn(operationItem.responses, response)) {\n const responseItem = operationItem.responses[response]\n\n if (responseItem.headers) {\n responseItem.headers = Object.entries(responseItem.headers).reduce((acc, [name, header]) => {\n return {\n [name]: transformParameterObject(header),\n ...acc,\n }\n }, {})\n }\n if (responseItem.schema) {\n const produces = specification.produces ?? operationItem.produces ?? ['application/json']\n\n if (typeof responseItem.content !== 'object') {\n responseItem.content = {}\n }\n\n for (const type of produces) {\n responseItem.content[type] = {\n schema: responseItem.schema,\n }\n }\n\n delete responseItem.schema\n }\n }\n }\n }\n\n delete operationItem.produces\n\n // Delete empty parameters\n if (operationItem.parameters?.length === 0) {\n delete operationItem.parameters\n }\n }\n }\n }\n }\n }\n\n // Upgrade securityDefinitions\n if (specification.securityDefinitions) {\n if (typeof specification.components !== 'object') {\n specification.components = {}\n }\n\n // Assert that components is of type OpenAPIV3.ComponentsObject\n specification.components = specification.components as OpenAPIV3.ComponentsObject\n\n Object.assign(specification.components, { securitySchemes: {} })\n\n for (const [key, securityScheme] of Object.entries(specification.securityDefinitions)) {\n if (typeof securityScheme === 'object') {\n if ('type' in securityScheme && securityScheme.type === 'oauth2') {\n const { flow, authorizationUrl, tokenUrl, scopes } = securityScheme as {\n type: 'oauth2'\n flow?: string\n authorizationUrl?: string\n tokenUrl?: string\n scopes?: Record<string, string>\n }\n\n // Convert flow values to OpenAPI 3.1.0 format\n\n // Assert that securitySchemes is of type OpenAPIV3.SecuritySchemeObject\n Object.assign((specification.components as OpenAPIV3.ComponentsObject).securitySchemes, {\n [key]: {\n type: 'oauth2',\n flows: {\n [upgradeFlow(flow)]: Object.assign(\n {},\n authorizationUrl && { authorizationUrl },\n tokenUrl && { tokenUrl },\n scopes && { scopes },\n ),\n },\n },\n })\n } else if ('type' in securityScheme && securityScheme.type === 'basic') {\n Object.assign((specification.components as OpenAPIV3.ComponentsObject).securitySchemes, {\n [key]: {\n type: 'http',\n scheme: 'basic',\n },\n })\n } else {\n Object.assign((specification.components as OpenAPIV3.ComponentsObject).securitySchemes, {\n [key]: securityScheme,\n })\n }\n }\n }\n\n delete specification.securityDefinitions\n }\n\n delete specification.consumes\n delete specification.produces\n\n return specification as OpenAPIV3.Document\n}\n\nfunction transformItemsObject<T extends Record<PropertyKey, unknown>>(obj: T): OpenAPIV3.SchemaObject {\n const schemaProperties = [\n 'type',\n 'format',\n 'items',\n 'maximum',\n 'exclusiveMaximum',\n 'minimum',\n 'exclusiveMinimum',\n 'maxLength',\n 'minLength',\n 'pattern',\n 'maxItems',\n 'minItems',\n 'uniqueItems',\n 'enum',\n 'multipleOf',\n ]\n\n return schemaProperties.reduce((acc, property) => {\n if (Object.hasOwn(obj, property)) {\n acc[property] = obj[property]\n delete obj[property]\n }\n\n return acc\n }, {} as OpenAPIV3.SchemaObject)\n}\n\nfunction transformParameterObject(parameter: OpenAPIV2.ParameterObject): OpenAPIV3.ParameterObject {\n // it is important to call getParameterSerializationStyle first because transformItemsObject modifies properties on which getParameterSerializationStyle rely on\n const serializationStyle = getParameterSerializationStyle(parameter)\n const schema = transformItemsObject(parameter)\n\n delete parameter.collectionFormat\n delete parameter.default\n\n return {\n schema,\n ...serializationStyle,\n ...parameter,\n }\n}\n\ntype CollectionFormat = 'csv' | 'ssv' | 'tsv' | 'pipes' | 'multi'\n\ntype ParameterSerializationStyle = { style?: string; explode?: boolean }\n\nconst querySerialization: Record<CollectionFormat, ParameterSerializationStyle> = {\n ssv: {\n style: 'spaceDelimited',\n explode: false,\n },\n pipes: {\n style: 'pipeDelimited',\n explode: false,\n },\n multi: {\n style: 'form',\n explode: true,\n },\n csv: {\n style: 'form',\n explode: false,\n },\n tsv: {},\n}\n\nconst pathAndHeaderSerialization: Record<CollectionFormat, ParameterSerializationStyle> = {\n ssv: {},\n pipes: {},\n multi: {},\n csv: {\n style: 'simple',\n explode: false,\n },\n tsv: {},\n}\n\nconst serializationStyles = {\n header: pathAndHeaderSerialization,\n query: querySerialization,\n path: pathAndHeaderSerialization,\n} as const\n\nfunction getParameterSerializationStyle(parameter: OpenAPIV2.ParameterObject): ParameterSerializationStyle {\n if (\n parameter.type !== 'array' ||\n !(parameter.in === 'query' || parameter.in === 'path' || parameter.in === 'header')\n ) {\n return {}\n }\n\n const collectionFormat = parameter.collectionFormat ?? 'csv'\n\n return serializationStyles[parameter.in][collectionFormat]\n}\n\ntype ParameterMigrationResult = {\n parameters: OpenAPIV3.ParameterObject[]\n requestBody?: OpenAPIV3.RequestBodyObject\n}\n\nfunction migrateBodyParameter(\n bodyParameter: OpenAPIV2.ParameterObject,\n consumes: string[],\n): OpenAPIV3.RequestBodyObject {\n delete bodyParameter.name\n delete bodyParameter.in\n\n const { schema, ...requestBody } = bodyParameter\n\n const requestBodyObject: OpenAPIV3.RequestBodyObject = {\n content: {},\n ...requestBody,\n }\n\n for (const type of consumes) {\n requestBodyObject.content[type] = {\n schema: schema,\n }\n }\n\n return requestBodyObject\n}\n\nfunction migrateFormDataParameter(parameters: OpenAPIV2.ParameterObject[]): OpenAPIV3.RequestBodyObject {\n const requestBodyObject: OpenAPIV3.RequestBodyObject = {\n content: {},\n }\n\n requestBodyObject.content['application/x-www-form-urlencoded'] = {\n schema: {\n type: 'object',\n properties: {},\n required: [], // Initialize required array\n },\n }\n\n for (const param of parameters) {\n requestBodyObject.content['application/x-www-form-urlencoded'].schema.properties[param.name] = {\n type: param.type,\n description: param.description,\n }\n\n // Add to required array if param is required\n if (param.required) {\n requestBodyObject.content['application/x-www-form-urlencoded'].schema.required.push(param.name)\n }\n }\n\n return requestBodyObject\n}\n\nfunction migrateParameters(parameters: OpenAPIV2.ParameterObject[], consumes: string[]): ParameterMigrationResult {\n const result: ParameterMigrationResult = {\n parameters: parameters\n .filter((parameter) => !(parameter.in === 'body' || parameter.in === 'formData'))\n .map((parameter) => transformParameterObject(parameter)),\n }\n\n const bodyParameter = structuredClone(\n parameters.find((parameter: OpenAPIV3.ParameterObject) => parameter.in === 'body') ?? {},\n )\n\n if (bodyParameter && Object.keys(bodyParameter).length) {\n result.requestBody = migrateBodyParameter(bodyParameter, consumes)\n }\n\n const formDataParameters = parameters.filter((parameter: OpenAPIV2.ParameterObject) => parameter.in === 'formData')\n\n if (formDataParameters.length > 0) {\n const requestBodyObject = migrateFormDataParameter(formDataParameters)\n\n if (typeof result.requestBody !== 'object') {\n result.requestBody = requestBodyObject\n } else {\n result.requestBody = {\n ...result.requestBody,\n content: {\n ...result.requestBody.content,\n ...requestBodyObject.content,\n },\n }\n }\n\n if (typeof result.requestBody !== 'object') {\n result.requestBody = {\n content: {},\n }\n }\n }\n\n return result\n}\n"],
|
|
5
|
+
"mappings": "AAGA,SAAS,gBAAgB;AAGzB,MAAM,cAAc,CAAC,SAAsF;AACzG,UAAQ,MAAM;AAAA,IACZ,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAOO,SAAS,sBAAsB,uBAAsC;AAC1E,MAAI,gBAAgB;AAGpB,MACE,kBAAkB,QAClB,OAAO,kBAAkB,YACzB,OAAO,cAAc,YAAY,YACjC,cAAc,SAAS,WAAW,KAAK,GACvC;AACA,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A,QACV,SAAS;AAAA,UACP,GAAG,OAAO,YAAY;AAAA,UACtB,GAAG,kBAAkB;AAAA,QACvB;AAAA,MACF;AAAA,IACF;AAEA,QAAI,OAAO,OAAO,gBAAgB,UAAU;AAC1C,aAAO,cAAc;AAAA,QACnB,SAAS,CAAC;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"parser",
|
|
18
18
|
"typescript"
|
|
19
19
|
],
|
|
20
|
-
"version": "0.20.
|
|
20
|
+
"version": "0.20.3",
|
|
21
21
|
"engines": {
|
|
22
22
|
"node": ">=20"
|
|
23
23
|
},
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"jsonpointer": "^5.0.1",
|
|
55
55
|
"leven": "^4.0.0",
|
|
56
56
|
"yaml": "2.8.0",
|
|
57
|
-
"@scalar/
|
|
58
|
-
"@scalar/
|
|
57
|
+
"@scalar/openapi-types": "0.3.7",
|
|
58
|
+
"@scalar/json-magic": "0.4.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@apidevtools/swagger-parser": "^10.1.0",
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"just-diff": "^6.0.2",
|
|
66
66
|
"tinybench": "^2.8.0",
|
|
67
67
|
"vite": "6.1.6",
|
|
68
|
-
"@scalar/
|
|
69
|
-
"@scalar/
|
|
68
|
+
"@scalar/build-tooling": "0.2.6",
|
|
69
|
+
"@scalar/types": "0.2.15"
|
|
70
70
|
},
|
|
71
71
|
"scripts": {
|
|
72
72
|
"build": "scalar-build-esbuild",
|