@scalar/openapi-upgrader 0.1.9 → 0.1.10

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,11 @@
1
1
  # @scalar/openapi-upgrader
2
2
 
3
+ ## 0.1.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#8272](https://github.com/scalar/scalar/pull/8272): feat: migrate swagger 2.0 response examples
8
+
3
9
  ## 0.1.9
4
10
 
5
11
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade-from-two-to-three.d.ts","sourceRoot":"","sources":["../../src/2.0-to-3.0/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;AAiGxD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,qBAAqB,EAAE,aAAa,0CA0ZzE"}
1
+ {"version":3,"file":"upgrade-from-two-to-three.d.ts","sourceRoot":"","sources":["../../src/2.0-to-3.0/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;AAgHxD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,qBAAqB,EAAE,aAAa,0CA0bzE"}
@@ -1,4 +1,5 @@
1
1
  import { traverse } from "../helpers/traverse.js";
2
+ const DEFAULT_MEDIA_TYPE = "application/json";
2
3
  function extractXExampleExtensions(obj) {
3
4
  const xExample = obj["x-example"];
4
5
  const xExamples = obj["x-examples"];
@@ -28,6 +29,10 @@ function wrapAsExampleObject(value) {
28
29
  }
29
30
  return { value };
30
31
  }
32
+ const MEDIA_TYPE_KEY_PATTERN = /^[a-zA-Z0-9*+.-]+\/[a-zA-Z0-9*+.+-]+$/;
33
+ function isMediaTypeKey(key) {
34
+ return MEDIA_TYPE_KEY_PATTERN.test(key);
35
+ }
31
36
  function transformXExampleToExamples(xExample) {
32
37
  return Object.entries(xExample).reduce(
33
38
  (acc, [key, value]) => {
@@ -119,7 +124,7 @@ function upgradeFromTwoToThree(originalSpecification) {
119
124
  if (param.in === "body") {
120
125
  bodyParams[name] = migrateBodyParameter(
121
126
  param,
122
- document.consumes ?? ["application/json"]
127
+ document.consumes ?? [DEFAULT_MEDIA_TYPE]
123
128
  );
124
129
  } else if (param.in === "formData") {
125
130
  bodyParams[name] = migrateFormDataParameter(
@@ -159,7 +164,7 @@ function upgradeFromTwoToThree(originalSpecification) {
159
164
  migratedResponses[name] = response;
160
165
  } else {
161
166
  const responseObj = response;
162
- const produces = document.produces ?? ["application/json"];
167
+ const produces = document.produces ?? [DEFAULT_MEDIA_TYPE];
163
168
  if (responseObj.schema) {
164
169
  if (typeof responseObj.content !== "object") {
165
170
  responseObj.content = {};
@@ -176,13 +181,27 @@ function upgradeFromTwoToThree(originalSpecification) {
176
181
  if (typeof responseObj.content !== "object") {
177
182
  responseObj.content = {};
178
183
  }
179
- for (const [mediaType, exampleValue] of Object.entries(responseObj.examples)) {
180
- if (typeof responseObj.content[mediaType] !== "object") {
184
+ const defaultMediaType = produces[0] ?? DEFAULT_MEDIA_TYPE;
185
+ for (const [key, exampleValue] of Object.entries(responseObj.examples)) {
186
+ if (isMediaTypeKey(key)) {
187
+ if (typeof responseObj.content[key] !== "object") {
188
+ ;
189
+ responseObj.content[key] = {};
190
+ }
191
+ ;
192
+ responseObj.content[key].example = exampleValue;
193
+ } else {
194
+ if (typeof responseObj.content[defaultMediaType] !== "object") {
195
+ ;
196
+ responseObj.content[defaultMediaType] = {};
197
+ }
198
+ const mediaEntry = responseObj.content[defaultMediaType];
199
+ if (typeof mediaEntry.examples !== "object") {
200
+ mediaEntry.examples = {};
201
+ }
181
202
  ;
182
- responseObj.content[mediaType] = {};
203
+ mediaEntry.examples[key] = wrapAsExampleObject(exampleValue);
183
204
  }
184
- ;
185
- responseObj.content[mediaType].example = exampleValue;
186
205
  }
187
206
  delete responseObj.examples;
188
207
  }
@@ -222,7 +241,7 @@ function upgradeFromTwoToThree(originalSpecification) {
222
241
  if (methodOrParameters === "parameters" && Object.hasOwn(pathItem, methodOrParameters)) {
223
242
  const pathItemParameters = migrateParameters(
224
243
  pathItem.parameters,
225
- document.consumes ?? ["application/json"]
244
+ document.consumes ?? [DEFAULT_MEDIA_TYPE]
226
245
  );
227
246
  pathItem.parameters = pathItemParameters.parameters;
228
247
  requestBodyObject = pathItemParameters.requestBody;
@@ -234,7 +253,7 @@ function upgradeFromTwoToThree(originalSpecification) {
234
253
  if (operationItem.parameters) {
235
254
  const migrationResult = migrateParameters(
236
255
  operationItem.parameters,
237
- operationItem.consumes ?? document.consumes ?? ["application/json"]
256
+ operationItem.consumes ?? document.consumes ?? [DEFAULT_MEDIA_TYPE]
238
257
  );
239
258
  operationItem.parameters = migrationResult.parameters;
240
259
  if (migrationResult.requestBody) {
@@ -261,7 +280,7 @@ function upgradeFromTwoToThree(originalSpecification) {
261
280
  );
262
281
  }
263
282
  if (responseItem.schema) {
264
- const produces = document.produces ?? operationItem.produces ?? ["application/json"];
283
+ const produces = document.produces ?? operationItem.produces ?? [DEFAULT_MEDIA_TYPE];
265
284
  if (typeof responseItem.content !== "object") {
266
285
  responseItem.content = {};
267
286
  }
@@ -276,11 +295,24 @@ function upgradeFromTwoToThree(originalSpecification) {
276
295
  if (typeof responseItem.content !== "object") {
277
296
  responseItem.content = {};
278
297
  }
279
- for (const [mediaType, exampleValue] of Object.entries(responseItem.examples)) {
280
- if (typeof responseItem.content[mediaType] !== "object") {
281
- responseItem.content[mediaType] = {};
298
+ const produces = document.produces ?? operationItem.produces ?? [DEFAULT_MEDIA_TYPE];
299
+ const defaultMediaType = produces[0] ?? DEFAULT_MEDIA_TYPE;
300
+ for (const [key, exampleValue] of Object.entries(responseItem.examples)) {
301
+ if (isMediaTypeKey(key)) {
302
+ if (typeof responseItem.content[key] !== "object") {
303
+ responseItem.content[key] = {};
304
+ }
305
+ responseItem.content[key].example = exampleValue;
306
+ } else {
307
+ if (typeof responseItem.content[defaultMediaType] !== "object") {
308
+ responseItem.content[defaultMediaType] = {};
309
+ }
310
+ const mediaEntry = responseItem.content[defaultMediaType];
311
+ if (typeof mediaEntry.examples !== "object") {
312
+ mediaEntry.examples = {};
313
+ }
314
+ mediaEntry.examples[key] = wrapAsExampleObject(exampleValue);
282
315
  }
283
- responseItem.content[mediaType].example = exampleValue;
284
316
  }
285
317
  delete responseItem.examples;
286
318
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/2.0-to-3.0/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 '@/helpers/traverse'\n\ntype XExampleExtensions = {\n xExample: Record<string, unknown> | undefined\n xExamples: Record<string, unknown> | undefined\n}\n\n/** Extracts and removes x-example and x-examples extensions from an object */\nfunction extractXExampleExtensions(obj: Record<string, unknown>): XExampleExtensions {\n const xExample = obj['x-example'] as Record<string, unknown> | undefined\n const xExamples = obj['x-examples'] as Record<string, unknown> | undefined\n\n delete obj['x-example']\n delete obj['x-examples']\n\n return { xExample, xExamples }\n}\n\n/** Checks if a value is a non-null, non-array object with at least one entry */\nfunction isNonEmptyObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value) && Object.keys(value).length > 0\n}\n\n/**\n * Checks if a value looks like a collection of named examples (all values are objects).\n * This helps distinguish between:\n * - A single example: { message: 'OK', type: 'success' } - values are primitives\n * - Named examples: { 'my-example': { message: 'OK' } } - values are objects\n */\nfunction isNamedExamplesCollection(value: unknown): value is Record<string, Record<string, unknown>> {\n return (\n isNonEmptyObject(value) &&\n Object.values(value).every((v) => typeof v === 'object' && v !== null && !Array.isArray(v))\n )\n}\n\n/** The allowed properties for an OpenAPI 3.x ExampleObject */\nconst EXAMPLE_OBJECT_PROPERTIES = new Set(['summary', 'description', 'value', 'externalValue'])\n\n/**\n * Checks if a value is a valid OpenAPI 3.x ExampleObject.\n *\n * An ExampleObject must have a `value` (or `externalValue`) property and can only contain\n * properties from the allowed set: `summary`, `description`, `value`, `externalValue`.\n *\n * This prevents false positives when user's example data happens to have a `value` property\n * (e.g., `{ value: \"some data\", count: 5 }` should NOT be treated as an ExampleObject).\n */\nfunction isExampleObject(value: unknown): value is OpenAPIV3.ExampleObject {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n\n const obj = value as Record<string, unknown>\n const hasValueOrExternalValue = 'value' in obj || 'externalValue' in obj\n const onlyHasAllowedProperties = Object.keys(obj).every((key) => EXAMPLE_OBJECT_PROPERTIES.has(key))\n\n return hasValueOrExternalValue && onlyHasAllowedProperties\n}\n\n/** Wraps a value as an ExampleObject, preserving existing structure if valid */\nfunction wrapAsExampleObject(value: unknown): OpenAPIV3.ExampleObject {\n if (isExampleObject(value)) {\n return value\n }\n return { value }\n}\n\n/** Transforms x-example entries to OpenAPI 3.x examples format */\nfunction transformXExampleToExamples(xExample: Record<string, unknown>): Record<string, OpenAPIV3.ExampleObject> {\n return Object.entries(xExample).reduce(\n (acc, [key, value]) => {\n acc[key] = { value }\n return acc\n },\n {} as Record<string, OpenAPIV3.ExampleObject>,\n )\n}\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 document = originalSpecification\n\n // Version\n if (\n document !== null &&\n typeof document === 'object' &&\n typeof document.swagger === 'string' &&\n document.swagger?.startsWith('2.0')\n ) {\n document.openapi = '3.0.4'\n delete document.swagger\n } else {\n // Skip if it's something else than 3.0.x\n return document\n }\n\n // Servers\n if (document.host) {\n const schemes = Array.isArray(document.schemes) && document.schemes?.length ? document.schemes : ['http']\n\n document.servers = schemes.map((scheme: string[]) => ({\n url: `${scheme}://${document.host}${document.basePath ?? ''}`,\n }))\n\n delete document.basePath\n delete document.schemes\n delete document.host\n } else if (document.basePath) {\n document.servers = [{ url: document.basePath }]\n delete document.basePath\n }\n\n // Schemas\n if (document.definitions) {\n document.components = Object.assign({}, document.components, {\n schemas: document.definitions,\n })\n\n delete document.definitions\n\n // Rewrite $refs to definitions\n document = traverse(document, (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 document = traverse(document, (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(document, 'parameters')) {\n // update all the $refs before we do any transformations\n document = traverse(document, (schema) => {\n if (typeof schema.$ref === 'string' && schema.$ref.startsWith('#/parameters/')) {\n const schemaName = schema.$ref.split('/')[2]\n\n if (!schemaName) {\n return schema\n }\n\n const param =\n document.parameters && typeof document.parameters === 'object' && schemaName in document.parameters\n ? (document.parameters as Record<string, unknown>)[schemaName]\n : undefined\n\n if (param && typeof param === 'object' && 'in' in param && (param.in === 'body' || param.in === 'formData')) {\n schema.$ref = schema.$ref.replace(/^#\\/parameters\\//, '#/components/requestBodies/')\n } else {\n schema.$ref = schema.$ref.replace(/^#\\/parameters\\//, '#/components/parameters/')\n }\n }\n\n return schema\n })\n\n document.components ??= {}\n\n const params: Record<string, OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject> = {}\n const bodyParams: Record<string, OpenAPIV3.RequestBodyObject> = {}\n const parameters =\n document.parameters && typeof document.parameters === 'object'\n ? (document.parameters as Record<string, unknown>)\n : {}\n for (const [name, param] of Object.entries(parameters)) {\n if (param && typeof param === 'object') {\n // Handle reference objects\n if ('$ref' in param) {\n const convertedParam = transformParameterObject(param as OpenAPIV2.ReferenceObject)\n params[name] = convertedParam\n } else if ('in' in param) {\n if (param.in === 'body') {\n bodyParams[name] = migrateBodyParameter(\n param as OpenAPIV2.ParameterObject,\n (document.consumes as string[] | undefined) ?? ['application/json'],\n )\n } else if (param.in === 'formData') {\n bodyParams[name] = migrateFormDataParameter(\n [param as OpenAPIV2.ParameterObject],\n document.consumes as string[] | undefined,\n )\n } else {\n const convertedParam = transformParameterObject(param as OpenAPIV2.ParameterObject)\n params[name] = convertedParam\n }\n }\n }\n }\n\n if (Object.keys(params).length > 0) {\n ;(document.components as UnknownObject).parameters = params\n }\n\n if (Object.keys(bodyParams).length > 0) {\n ;(document.components as UnknownObject).requestBodies = bodyParams\n }\n\n delete document.parameters\n }\n\n // Handle global responses defined in #/responses\n if (Object.hasOwn(document, 'responses') && typeof document.responses === 'object' && document.responses !== null) {\n // Update all $refs from #/responses/ to #/components/responses/\n document = traverse(document, (schema) => {\n if (typeof schema.$ref === 'string' && schema.$ref.startsWith('#/responses/')) {\n schema.$ref = schema.$ref.replace(/^#\\/responses\\//, '#/components/responses/')\n }\n return schema\n })\n\n document.components ??= {}\n\n const migratedResponses: Record<string, OpenAPIV3.ResponseObject | OpenAPIV3.ReferenceObject> = {}\n const responses = document.responses as Record<string, unknown>\n\n for (const [name, response] of Object.entries(responses)) {\n if (response && typeof response === 'object') {\n // Handle reference objects\n if ('$ref' in response) {\n migratedResponses[name] = response as OpenAPIV3.ReferenceObject\n } else {\n // Transform the response object\n const responseObj = response as Record<string, unknown>\n const produces = (document.produces as string[] | undefined) ?? ['application/json']\n\n // Transform schema to content\n if (responseObj.schema) {\n if (typeof responseObj.content !== 'object') {\n responseObj.content = {}\n }\n\n for (const type of produces) {\n ;(responseObj.content as Record<string, unknown>)[type] = {\n schema: responseObj.schema,\n }\n }\n\n delete responseObj.schema\n }\n\n // Transform examples from Swagger 2.0 to OpenAPI 3.0 format\n if (responseObj.examples && typeof responseObj.examples === 'object') {\n if (typeof responseObj.content !== 'object') {\n responseObj.content = {}\n }\n\n for (const [mediaType, exampleValue] of Object.entries(responseObj.examples as Record<string, unknown>)) {\n if (typeof (responseObj.content as Record<string, unknown>)[mediaType] !== 'object') {\n ;(responseObj.content as Record<string, unknown>)[mediaType] = {}\n }\n ;((responseObj.content as Record<string, unknown>)[mediaType] as Record<string, unknown>).example =\n exampleValue\n }\n\n delete responseObj.examples\n }\n\n // Transform headers if present\n if (responseObj.headers && typeof responseObj.headers === 'object') {\n responseObj.headers = Object.entries(responseObj.headers as Record<string, unknown>).reduce(\n (acc, [headerName, header]) => {\n if (header && typeof header === 'object') {\n return {\n [headerName]: transformResponseHeader(header as OpenAPIV2.HeaderObject),\n ...acc,\n }\n }\n return acc\n },\n {} as Record<string, OpenAPIV3.HeaderObject | OpenAPIV3.ReferenceObject>,\n )\n }\n\n migratedResponses[name] = responseObj as OpenAPIV3.ResponseObject\n }\n }\n }\n\n if (Object.keys(migratedResponses).length > 0) {\n ;(document.components as UnknownObject).responses = migratedResponses\n }\n\n delete document.responses\n }\n\n // Paths\n if (typeof document.paths === 'object') {\n for (const path in document.paths) {\n if (Object.hasOwn(document.paths, path)) {\n const pathItem =\n document.paths && typeof document.paths === 'object' && path in document.paths\n ? (document.paths as Record<string, unknown>)[path]\n : undefined\n\n if (!pathItem || typeof pathItem !== 'object') {\n continue\n }\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 as any).parameters,\n (document.consumes as string[] | undefined) ?? ['application/json'],\n )\n\n ;(pathItem as any).parameters = pathItemParameters.parameters\n requestBodyObject = pathItemParameters.requestBody\n } else if (Object.hasOwn(pathItem, methodOrParameters)) {\n const operationItem = (pathItem as any)[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 ?? document.consumes ?? ['application/json'],\n )\n\n operationItem.parameters = migrationResult.parameters\n\n if (migrationResult.requestBody) {\n operationItem.requestBody = migrationResult.requestBody\n }\n }\n\n delete operationItem.consumes\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 && typeof responseItem.headers === 'object') {\n responseItem.headers = Object.entries(responseItem.headers).reduce(\n (acc, [name, header]) => {\n if (header && typeof header === 'object') {\n return {\n [name]: transformResponseHeader(header as OpenAPIV2.HeaderObject),\n ...acc,\n }\n }\n return acc\n },\n {} as Record<string, OpenAPIV3.HeaderObject | OpenAPIV3.ReferenceObject>,\n )\n }\n if (responseItem.schema) {\n const produces = document.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 // Transform response examples from Swagger 2.0 to OpenAPI 3.0 format\n // In Swagger 2.0, examples are at response level: examples: { 'application/json': {...} }\n // In OpenAPI 3.0, examples move inside content: content: { 'application/json': { example: {...} } }\n if (responseItem.examples && typeof responseItem.examples === 'object') {\n if (typeof responseItem.content !== 'object') {\n responseItem.content = {}\n }\n\n for (const [mediaType, exampleValue] of Object.entries(responseItem.examples)) {\n if (typeof responseItem.content[mediaType] !== 'object') {\n responseItem.content[mediaType] = {}\n }\n responseItem.content[mediaType].example = exampleValue\n }\n\n delete responseItem.examples\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 (document.securityDefinitions) {\n if (typeof document.components !== 'object' || document.components === null) {\n document.components = {}\n }\n\n if (document.components && typeof document.components === 'object') {\n Object.assign(document.components, { securitySchemes: {} })\n }\n\n for (const [key, securityScheme] of Object.entries(document.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 if (\n document.components &&\n typeof document.components === 'object' &&\n 'securitySchemes' in document.components &&\n document.components.securitySchemes\n ) {\n Object.assign(document.components.securitySchemes, {\n [key]: {\n type: 'oauth2',\n flows: {\n [upgradeFlow(flow || 'implicit')]: Object.assign(\n {},\n authorizationUrl && { authorizationUrl },\n tokenUrl && { tokenUrl },\n scopes && { scopes },\n ),\n },\n },\n })\n }\n } else if ('type' in securityScheme && securityScheme.type === 'basic') {\n if (\n document.components &&\n typeof document.components === 'object' &&\n 'securitySchemes' in document.components &&\n document.components.securitySchemes\n ) {\n Object.assign(document.components.securitySchemes, {\n [key]: {\n type: 'http',\n scheme: 'basic',\n },\n })\n }\n } else {\n if (\n document.components &&\n typeof document.components === 'object' &&\n 'securitySchemes' in document.components &&\n document.components.securitySchemes\n ) {\n Object.assign(document.components.securitySchemes, {\n [key]: securityScheme,\n })\n }\n }\n }\n }\n\n delete document.securityDefinitions\n }\n\n delete document.consumes\n delete document.produces\n\n return document as OpenAPIV3.Document\n}\n\nfunction transformItemsObject<T extends Record<PropertyKey, unknown>>(obj: T): OpenAPIV3.SchemaObject {\n const schemaProperties = [\n 'type',\n 'format',\n 'default',\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 getParameterLocation(location: OpenAPIV2.ParameterLocation): OpenAPIV3.ParameterLocation {\n if (location === 'formData') {\n throw new Error('Encountered a formData parameter which should have been filtered out by the caller')\n }\n if (location === 'body') {\n throw new Error('Encountered a body parameter which should have been filtered out by the caller')\n }\n return location as OpenAPIV3.ParameterLocation\n}\n\nfunction transformParameterObject(\n parameter: OpenAPIV2.ParameterObject | OpenAPIV2.ReferenceObject,\n): OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject {\n if (Object.hasOwn(parameter, '$ref') && '$ref' in parameter) {\n return {\n $ref: parameter.$ref,\n }\n }\n\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 const { xExample, xExamples } = extractXExampleExtensions(parameter as Record<string, unknown>)\n\n // Input:\n // x-example:\n // application/json:\n // message: OK\n // type: success\n // text/plain: 'OK'\n\n // Output:\n // examples:\n // application/json:\n // value:\n // message: OK\n // type: success\n // text/plain:\n // value: 'OK'\n\n // We need to transform the x-example to an examples object and add \"value\" to the structure\n if (isNonEmptyObject(xExample)) {\n parameter.examples = transformXExampleToExamples(xExample)\n } else if (isNonEmptyObject(xExamples)) {\n parameter.examples = Object.entries(xExamples).reduce(\n (acc, [key, exampleValue]) => {\n acc[key] = wrapAsExampleObject(exampleValue)\n return acc\n },\n {} as Record<string, OpenAPIV3.ExampleObject>,\n )\n }\n\n delete parameter.collectionFormat\n delete parameter.default\n\n if (!parameter.in) {\n throw new Error('Parameter object must have an \"in\" property')\n }\n\n return {\n schema,\n ...serializationStyle,\n ...parameter,\n in: getParameterLocation(parameter.in),\n }\n}\n\n/**\n * Transform OpenAPI 2.0 response header to OpenAPI 3.0 format.\n * Response headers do not have \"in\", \"name\", \"style\", or \"explode\" properties.\n */\nfunction transformResponseHeader(\n header: OpenAPIV2.HeaderObject | OpenAPIV2.ReferenceObject,\n): OpenAPIV3.HeaderObject | OpenAPIV3.ReferenceObject {\n if (Object.hasOwn(header, '$ref') && '$ref' in header) {\n return {\n $ref: header.$ref,\n }\n }\n\n const schema = transformItemsObject(header)\n\n return {\n ...header,\n schema,\n }\n}\n\ntype CollectionFormat = 'csv' | 'ssv' | 'tsv' | 'pipes' | 'multi'\n\ntype ParameterSerializationStyle = { style?: OpenAPIV3.ParameterStyle; 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 if (\n parameter.in in serializationStyles &&\n collectionFormat in serializationStyles[parameter.in as keyof typeof serializationStyles]\n ) {\n return serializationStyles[parameter.in as keyof typeof serializationStyles][collectionFormat as CollectionFormat]\n }\n\n return {}\n}\n\ntype ParameterMigrationResult = {\n parameters: (OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject)[]\n requestBody?: OpenAPIV3.RequestBodyObject\n}\n\nfunction migrateBodyParameter(\n bodyParameter: OpenAPIV2.ParameterObject,\n consumes: string[],\n): OpenAPIV3.RequestBodyObject {\n // Extract x-example and x-examples before deleting other properties\n // @see https://redocly.com/docs-legacy/api-reference-docs/specification-extensions/x-examples\n const { xExample, xExamples } = extractXExampleExtensions(bodyParameter as Record<string, unknown>)\n\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 if (requestBodyObject.content) {\n for (const type of consumes) {\n requestBodyObject.content[type] = {\n schema: schema,\n }\n\n // Handle x-example (singular) - Redocly extension for Swagger 2.0\n // Transforms to OpenAPI 3.x `example` field\n if (isNonEmptyObject(xExample) && type in xExample) {\n requestBodyObject.content[type].example = xExample[type]\n }\n\n // Handle x-examples (plural) - Redocly extension for Swagger 2.0\n // Transforms to OpenAPI 3.x `examples` field (named examples with summary/value)\n if (isNonEmptyObject(xExamples) && type in xExamples) {\n const examples = xExamples[type]\n\n // Check if examples is already in proper OpenAPI 3.x format (object with entries that are valid ExampleObjects)\n const isExamplesCollection =\n isNonEmptyObject(examples) && Object.values(examples).every((example) => isExampleObject(example))\n\n if (isExamplesCollection) {\n requestBodyObject.content[type].examples = examples as Record<string, OpenAPIV3.ExampleObject>\n }\n // Named examples without value wrappers - wrap each individually\n else if (isNamedExamplesCollection(examples)) {\n requestBodyObject.content[type].examples = Object.entries(examples).reduce(\n (acc, [key, exampleValue]) => {\n acc[key] = wrapAsExampleObject(exampleValue)\n return acc\n },\n {} as Record<string, OpenAPIV3.ExampleObject>,\n )\n }\n // Single example value - wrap as default\n else {\n requestBodyObject.content[type].examples = {\n default: wrapAsExampleObject(examples),\n }\n }\n }\n }\n }\n\n return requestBodyObject\n}\n\nfunction migrateFormDataParameter(\n parameters: OpenAPIV2.ParameterObject[],\n consumes: string[] | undefined = ['multipart/form-data'],\n): OpenAPIV3.RequestBodyObject {\n const requestBodyObject: OpenAPIV3.RequestBodyObject = {\n content: {},\n }\n\n // Ensure consumes contains a form data content type\n const filtered = consumes.filter(\n (type) => type === 'multipart/form-data' || type === 'application/x-www-form-urlencoded',\n )\n const contentTypes = filtered.length > 0 ? filtered : ['multipart/form-data']\n\n if (requestBodyObject.content) {\n for (const contentType of contentTypes) {\n requestBodyObject.content[contentType] = {\n schema: {\n type: 'object',\n properties: {},\n required: [], // Initialize required array\n },\n }\n\n const formContent = requestBodyObject.content?.[contentType]\n if (formContent?.schema && typeof formContent.schema === 'object' && 'properties' in formContent.schema) {\n for (const param of parameters) {\n if (param.name && formContent.schema.properties) {\n formContent.schema.properties[param.name] = {\n type: param.type,\n description: param.description,\n ...(param.format ? { format: param.format } : {}),\n }\n\n // Add to required array if param is required\n if (param.required && Array.isArray(formContent.schema.required)) {\n formContent.schema.required.push(param.name)\n }\n }\n }\n }\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: OpenAPIV2.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, consumes)\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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;AAElH,MAAI,mBAAmB,SAAS,GAAG;AACjC,UAAM,oBAAoB,yBAAyB,oBAAoB,QAAQ;AAE/E,QAAI,OAAO,OAAO,gBAAgB,UAAU;AAC1C,aAAO,cAAc;AAAA,IACvB,OAAO;AACL,aAAO,cAAc;AAAA,QACnB,GAAG,OAAO;AAAA,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;",
4
+ "sourcesContent": ["import type { OpenAPIV2, OpenAPIV3 } from '@scalar/openapi-types'\nimport type { UnknownObject } from '@scalar/types/utils'\n\nimport { traverse } from '@/helpers/traverse'\n\ntype XExampleExtensions = {\n xExample: Record<string, unknown> | undefined\n xExamples: Record<string, unknown> | undefined\n}\n\nconst DEFAULT_MEDIA_TYPE = 'application/json'\n\n/** Extracts and removes x-example and x-examples extensions from an object */\nfunction extractXExampleExtensions(obj: Record<string, unknown>): XExampleExtensions {\n const xExample = obj['x-example'] as Record<string, unknown> | undefined\n const xExamples = obj['x-examples'] as Record<string, unknown> | undefined\n\n delete obj['x-example']\n delete obj['x-examples']\n\n return { xExample, xExamples }\n}\n\n/** Checks if a value is a non-null, non-array object with at least one entry */\nfunction isNonEmptyObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value) && Object.keys(value).length > 0\n}\n\n/**\n * Checks if a value looks like a collection of named examples (all values are objects).\n * This helps distinguish between:\n * - A single example: { message: 'OK', type: 'success' } - values are primitives\n * - Named examples: { 'my-example': { message: 'OK' } } - values are objects\n */\nfunction isNamedExamplesCollection(value: unknown): value is Record<string, Record<string, unknown>> {\n return (\n isNonEmptyObject(value) &&\n Object.values(value).every((v) => typeof v === 'object' && v !== null && !Array.isArray(v))\n )\n}\n\n/** The allowed properties for an OpenAPI 3.x ExampleObject */\nconst EXAMPLE_OBJECT_PROPERTIES = new Set(['summary', 'description', 'value', 'externalValue'])\n\n/**\n * Checks if a value is a valid OpenAPI 3.x ExampleObject.\n *\n * An ExampleObject must have a `value` (or `externalValue`) property and can only contain\n * properties from the allowed set: `summary`, `description`, `value`, `externalValue`.\n *\n * This prevents false positives when user's example data happens to have a `value` property\n * (e.g., `{ value: \"some data\", count: 5 }` should NOT be treated as an ExampleObject).\n */\nfunction isExampleObject(value: unknown): value is OpenAPIV3.ExampleObject {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n\n const obj = value as Record<string, unknown>\n const hasValueOrExternalValue = 'value' in obj || 'externalValue' in obj\n const onlyHasAllowedProperties = Object.keys(obj).every((key) => EXAMPLE_OBJECT_PROPERTIES.has(key))\n\n return hasValueOrExternalValue && onlyHasAllowedProperties\n}\n\n/** Wraps a value as an ExampleObject, preserving existing structure if valid */\nfunction wrapAsExampleObject(value: unknown): OpenAPIV3.ExampleObject {\n if (isExampleObject(value)) {\n return value\n }\n return { value }\n}\n\n/**\n * True if the key looks like a MIME media type (e.g. application/json, text/plain).\n * Used to distinguish media-type example keys from named example keys when migrating\n * Swagger 2.0 examples to OpenAPI 3.0 content. Requires exactly one slash and\n * token-style type/subtype (no spaces or semicolons) to avoid false positives\n * for named keys that contain a slash (e.g. \"Error 404/Not Found\").\n */\nconst MEDIA_TYPE_KEY_PATTERN = /^[a-zA-Z0-9*+.-]+\\/[a-zA-Z0-9*+.+-]+$/\n\nfunction isMediaTypeKey(key: string): boolean {\n return MEDIA_TYPE_KEY_PATTERN.test(key)\n}\n\n/** Transforms x-example entries to OpenAPI 3.x examples format */\nfunction transformXExampleToExamples(xExample: Record<string, unknown>): Record<string, OpenAPIV3.ExampleObject> {\n return Object.entries(xExample).reduce(\n (acc, [key, value]) => {\n acc[key] = { value }\n return acc\n },\n {} as Record<string, OpenAPIV3.ExampleObject>,\n )\n}\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 document = originalSpecification\n\n // Version\n if (\n document !== null &&\n typeof document === 'object' &&\n typeof document.swagger === 'string' &&\n document.swagger?.startsWith('2.0')\n ) {\n document.openapi = '3.0.4'\n delete document.swagger\n } else {\n // Skip if it's something else than 3.0.x\n return document\n }\n\n // Servers\n if (document.host) {\n const schemes = Array.isArray(document.schemes) && document.schemes?.length ? document.schemes : ['http']\n\n document.servers = schemes.map((scheme: string[]) => ({\n url: `${scheme}://${document.host}${document.basePath ?? ''}`,\n }))\n\n delete document.basePath\n delete document.schemes\n delete document.host\n } else if (document.basePath) {\n document.servers = [{ url: document.basePath }]\n delete document.basePath\n }\n\n // Schemas\n if (document.definitions) {\n document.components = Object.assign({}, document.components, {\n schemas: document.definitions,\n })\n\n delete document.definitions\n\n // Rewrite $refs to definitions\n document = traverse(document, (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 document = traverse(document, (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(document, 'parameters')) {\n // update all the $refs before we do any transformations\n document = traverse(document, (schema) => {\n if (typeof schema.$ref === 'string' && schema.$ref.startsWith('#/parameters/')) {\n const schemaName = schema.$ref.split('/')[2]\n\n if (!schemaName) {\n return schema\n }\n\n const param =\n document.parameters && typeof document.parameters === 'object' && schemaName in document.parameters\n ? (document.parameters as Record<string, unknown>)[schemaName]\n : undefined\n\n if (param && typeof param === 'object' && 'in' in param && (param.in === 'body' || param.in === 'formData')) {\n schema.$ref = schema.$ref.replace(/^#\\/parameters\\//, '#/components/requestBodies/')\n } else {\n schema.$ref = schema.$ref.replace(/^#\\/parameters\\//, '#/components/parameters/')\n }\n }\n\n return schema\n })\n\n document.components ??= {}\n\n const params: Record<string, OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject> = {}\n const bodyParams: Record<string, OpenAPIV3.RequestBodyObject> = {}\n const parameters =\n document.parameters && typeof document.parameters === 'object'\n ? (document.parameters as Record<string, unknown>)\n : {}\n for (const [name, param] of Object.entries(parameters)) {\n if (param && typeof param === 'object') {\n // Handle reference objects\n if ('$ref' in param) {\n const convertedParam = transformParameterObject(param as OpenAPIV2.ReferenceObject)\n params[name] = convertedParam\n } else if ('in' in param) {\n if (param.in === 'body') {\n bodyParams[name] = migrateBodyParameter(\n param as OpenAPIV2.ParameterObject,\n (document.consumes as string[] | undefined) ?? [DEFAULT_MEDIA_TYPE],\n )\n } else if (param.in === 'formData') {\n bodyParams[name] = migrateFormDataParameter(\n [param as OpenAPIV2.ParameterObject],\n document.consumes as string[] | undefined,\n )\n } else {\n const convertedParam = transformParameterObject(param as OpenAPIV2.ParameterObject)\n params[name] = convertedParam\n }\n }\n }\n }\n\n if (Object.keys(params).length > 0) {\n ;(document.components as UnknownObject).parameters = params\n }\n\n if (Object.keys(bodyParams).length > 0) {\n ;(document.components as UnknownObject).requestBodies = bodyParams\n }\n\n delete document.parameters\n }\n\n // Handle global responses defined in #/responses\n if (Object.hasOwn(document, 'responses') && typeof document.responses === 'object' && document.responses !== null) {\n // Update all $refs from #/responses/ to #/components/responses/\n document = traverse(document, (schema) => {\n if (typeof schema.$ref === 'string' && schema.$ref.startsWith('#/responses/')) {\n schema.$ref = schema.$ref.replace(/^#\\/responses\\//, '#/components/responses/')\n }\n return schema\n })\n\n document.components ??= {}\n\n const migratedResponses: Record<string, OpenAPIV3.ResponseObject | OpenAPIV3.ReferenceObject> = {}\n const responses = document.responses as Record<string, unknown>\n\n for (const [name, response] of Object.entries(responses)) {\n if (response && typeof response === 'object') {\n // Handle reference objects\n if ('$ref' in response) {\n migratedResponses[name] = response as OpenAPIV3.ReferenceObject\n } else {\n // Transform the response object\n const responseObj = response as Record<string, unknown>\n const produces = (document.produces as string[] | undefined) ?? [DEFAULT_MEDIA_TYPE]\n\n // Transform schema to content\n if (responseObj.schema) {\n if (typeof responseObj.content !== 'object') {\n responseObj.content = {}\n }\n\n for (const type of produces) {\n ;(responseObj.content as Record<string, unknown>)[type] = {\n schema: responseObj.schema,\n }\n }\n\n delete responseObj.schema\n }\n\n // Transform examples from Swagger 2.0 to OpenAPI 3.0 format\n if (responseObj.examples && typeof responseObj.examples === 'object') {\n if (typeof responseObj.content !== 'object') {\n responseObj.content = {}\n }\n\n const defaultMediaType = produces[0] ?? DEFAULT_MEDIA_TYPE\n\n for (const [key, exampleValue] of Object.entries(responseObj.examples as Record<string, unknown>)) {\n // Media-type keys (e.g. application/json) go to content[key]; named example keys go to content[defaultMediaType].examples[key].\n if (isMediaTypeKey(key)) {\n if (typeof (responseObj.content as Record<string, unknown>)[key] !== 'object') {\n ;(responseObj.content as Record<string, unknown>)[key] = {}\n }\n ;((responseObj.content as Record<string, unknown>)[key] as Record<string, unknown>).example =\n exampleValue\n } else {\n if (typeof (responseObj.content as Record<string, unknown>)[defaultMediaType] !== 'object') {\n ;(responseObj.content as Record<string, unknown>)[defaultMediaType] = {}\n }\n const mediaEntry = (responseObj.content as Record<string, unknown>)[defaultMediaType] as Record<\n string,\n unknown\n >\n if (typeof mediaEntry.examples !== 'object') {\n mediaEntry.examples = {}\n }\n ;(mediaEntry.examples as Record<string, OpenAPIV3.ExampleObject>)[key] =\n wrapAsExampleObject(exampleValue)\n }\n }\n\n delete responseObj.examples\n }\n\n // Transform headers if present\n if (responseObj.headers && typeof responseObj.headers === 'object') {\n responseObj.headers = Object.entries(responseObj.headers as Record<string, unknown>).reduce(\n (acc, [headerName, header]) => {\n if (header && typeof header === 'object') {\n return {\n [headerName]: transformResponseHeader(header as OpenAPIV2.HeaderObject),\n ...acc,\n }\n }\n return acc\n },\n {} as Record<string, OpenAPIV3.HeaderObject | OpenAPIV3.ReferenceObject>,\n )\n }\n\n migratedResponses[name] = responseObj as OpenAPIV3.ResponseObject\n }\n }\n }\n\n if (Object.keys(migratedResponses).length > 0) {\n ;(document.components as UnknownObject).responses = migratedResponses\n }\n\n delete document.responses\n }\n\n // Paths\n if (typeof document.paths === 'object') {\n for (const path in document.paths) {\n if (Object.hasOwn(document.paths, path)) {\n const pathItem =\n document.paths && typeof document.paths === 'object' && path in document.paths\n ? (document.paths as Record<string, unknown>)[path]\n : undefined\n\n if (!pathItem || typeof pathItem !== 'object') {\n continue\n }\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 as any).parameters,\n (document.consumes as string[] | undefined) ?? [DEFAULT_MEDIA_TYPE],\n )\n\n ;(pathItem as any).parameters = pathItemParameters.parameters\n requestBodyObject = pathItemParameters.requestBody\n } else if (Object.hasOwn(pathItem, methodOrParameters)) {\n const operationItem = (pathItem as any)[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 ?? document.consumes ?? [DEFAULT_MEDIA_TYPE],\n )\n\n operationItem.parameters = migrationResult.parameters\n\n if (migrationResult.requestBody) {\n operationItem.requestBody = migrationResult.requestBody\n }\n }\n\n delete operationItem.consumes\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 && typeof responseItem.headers === 'object') {\n responseItem.headers = Object.entries(responseItem.headers).reduce(\n (acc, [name, header]) => {\n if (header && typeof header === 'object') {\n return {\n [name]: transformResponseHeader(header as OpenAPIV2.HeaderObject),\n ...acc,\n }\n }\n return acc\n },\n {} as Record<string, OpenAPIV3.HeaderObject | OpenAPIV3.ReferenceObject>,\n )\n }\n if (responseItem.schema) {\n const produces = document.produces ?? operationItem.produces ?? [DEFAULT_MEDIA_TYPE]\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 // Transform response examples from Swagger 2.0 to OpenAPI 3.0 format\n // In Swagger 2.0, examples are at response level: examples: { DEFAULT_MEDIA_TYPE: {...} } or named: { 'Example': {...} }\n // In OpenAPI 3.0, examples move inside content: content: { DEFAULT_MEDIA_TYPE: { example: {...} } } or examples: { Example: { value: {...} } }\n if (responseItem.examples && typeof responseItem.examples === 'object') {\n if (typeof responseItem.content !== 'object') {\n responseItem.content = {}\n }\n\n const produces: string[] = document.produces ?? operationItem.produces ?? [DEFAULT_MEDIA_TYPE]\n const defaultMediaType = produces[0] ?? DEFAULT_MEDIA_TYPE\n for (const [key, exampleValue] of Object.entries(responseItem.examples)) {\n // Media-type keys (e.g. application/json) go to content[key]; named example keys go to content[defaultMediaType].examples[key].\n if (isMediaTypeKey(key)) {\n if (typeof responseItem.content[key] !== 'object') {\n responseItem.content[key] = {}\n }\n responseItem.content[key].example = exampleValue\n } else {\n if (typeof responseItem.content[defaultMediaType] !== 'object') {\n responseItem.content[defaultMediaType] = {}\n }\n const mediaEntry = responseItem.content[defaultMediaType]\n if (typeof mediaEntry.examples !== 'object') {\n mediaEntry.examples = {}\n }\n mediaEntry.examples[key] = wrapAsExampleObject(exampleValue)\n }\n }\n\n delete responseItem.examples\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 (document.securityDefinitions) {\n if (typeof document.components !== 'object' || document.components === null) {\n document.components = {}\n }\n\n if (document.components && typeof document.components === 'object') {\n Object.assign(document.components, { securitySchemes: {} })\n }\n\n for (const [key, securityScheme] of Object.entries(document.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 if (\n document.components &&\n typeof document.components === 'object' &&\n 'securitySchemes' in document.components &&\n document.components.securitySchemes\n ) {\n Object.assign(document.components.securitySchemes, {\n [key]: {\n type: 'oauth2',\n flows: {\n [upgradeFlow(flow || 'implicit')]: Object.assign(\n {},\n authorizationUrl && { authorizationUrl },\n tokenUrl && { tokenUrl },\n scopes && { scopes },\n ),\n },\n },\n })\n }\n } else if ('type' in securityScheme && securityScheme.type === 'basic') {\n if (\n document.components &&\n typeof document.components === 'object' &&\n 'securitySchemes' in document.components &&\n document.components.securitySchemes\n ) {\n Object.assign(document.components.securitySchemes, {\n [key]: {\n type: 'http',\n scheme: 'basic',\n },\n })\n }\n } else {\n if (\n document.components &&\n typeof document.components === 'object' &&\n 'securitySchemes' in document.components &&\n document.components.securitySchemes\n ) {\n Object.assign(document.components.securitySchemes, {\n [key]: securityScheme,\n })\n }\n }\n }\n }\n\n delete document.securityDefinitions\n }\n\n delete document.consumes\n delete document.produces\n\n return document as OpenAPIV3.Document\n}\n\nfunction transformItemsObject<T extends Record<PropertyKey, unknown>>(obj: T): OpenAPIV3.SchemaObject {\n const schemaProperties = [\n 'type',\n 'format',\n 'default',\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 getParameterLocation(location: OpenAPIV2.ParameterLocation): OpenAPIV3.ParameterLocation {\n if (location === 'formData') {\n throw new Error('Encountered a formData parameter which should have been filtered out by the caller')\n }\n if (location === 'body') {\n throw new Error('Encountered a body parameter which should have been filtered out by the caller')\n }\n return location as OpenAPIV3.ParameterLocation\n}\n\nfunction transformParameterObject(\n parameter: OpenAPIV2.ParameterObject | OpenAPIV2.ReferenceObject,\n): OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject {\n if (Object.hasOwn(parameter, '$ref') && '$ref' in parameter) {\n return {\n $ref: parameter.$ref,\n }\n }\n\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 const { xExample, xExamples } = extractXExampleExtensions(parameter as Record<string, unknown>)\n\n // Input:\n // x-example:\n // application/json:\n // message: OK\n // type: success\n // text/plain: 'OK'\n\n // Output:\n // examples:\n // application/json:\n // value:\n // message: OK\n // type: success\n // text/plain:\n // value: 'OK'\n\n // We need to transform the x-example to an examples object and add \"value\" to the structure\n if (isNonEmptyObject(xExample)) {\n parameter.examples = transformXExampleToExamples(xExample)\n } else if (isNonEmptyObject(xExamples)) {\n parameter.examples = Object.entries(xExamples).reduce(\n (acc, [key, exampleValue]) => {\n acc[key] = wrapAsExampleObject(exampleValue)\n return acc\n },\n {} as Record<string, OpenAPIV3.ExampleObject>,\n )\n }\n\n delete parameter.collectionFormat\n delete parameter.default\n\n if (!parameter.in) {\n throw new Error('Parameter object must have an \"in\" property')\n }\n\n return {\n schema,\n ...serializationStyle,\n ...parameter,\n in: getParameterLocation(parameter.in),\n }\n}\n\n/**\n * Transform OpenAPI 2.0 response header to OpenAPI 3.0 format.\n * Response headers do not have \"in\", \"name\", \"style\", or \"explode\" properties.\n */\nfunction transformResponseHeader(\n header: OpenAPIV2.HeaderObject | OpenAPIV2.ReferenceObject,\n): OpenAPIV3.HeaderObject | OpenAPIV3.ReferenceObject {\n if (Object.hasOwn(header, '$ref') && '$ref' in header) {\n return {\n $ref: header.$ref,\n }\n }\n\n const schema = transformItemsObject(header)\n\n return {\n ...header,\n schema,\n }\n}\n\ntype CollectionFormat = 'csv' | 'ssv' | 'tsv' | 'pipes' | 'multi'\n\ntype ParameterSerializationStyle = { style?: OpenAPIV3.ParameterStyle; 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 if (\n parameter.in in serializationStyles &&\n collectionFormat in serializationStyles[parameter.in as keyof typeof serializationStyles]\n ) {\n return serializationStyles[parameter.in as keyof typeof serializationStyles][collectionFormat as CollectionFormat]\n }\n\n return {}\n}\n\ntype ParameterMigrationResult = {\n parameters: (OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject)[]\n requestBody?: OpenAPIV3.RequestBodyObject\n}\n\nfunction migrateBodyParameter(\n bodyParameter: OpenAPIV2.ParameterObject,\n consumes: string[],\n): OpenAPIV3.RequestBodyObject {\n // Extract x-example and x-examples before deleting other properties\n // @see https://redocly.com/docs-legacy/api-reference-docs/specification-extensions/x-examples\n const { xExample, xExamples } = extractXExampleExtensions(bodyParameter as Record<string, unknown>)\n\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 if (requestBodyObject.content) {\n for (const type of consumes) {\n requestBodyObject.content[type] = {\n schema: schema,\n }\n\n // Handle x-example (singular) - Redocly extension for Swagger 2.0\n // Transforms to OpenAPI 3.x `example` field\n if (isNonEmptyObject(xExample) && type in xExample) {\n requestBodyObject.content[type].example = xExample[type]\n }\n\n // Handle x-examples (plural) - Redocly extension for Swagger 2.0\n // Transforms to OpenAPI 3.x `examples` field (named examples with summary/value)\n if (isNonEmptyObject(xExamples) && type in xExamples) {\n const examples = xExamples[type]\n\n // Check if examples is already in proper OpenAPI 3.x format (object with entries that are valid ExampleObjects)\n const isExamplesCollection =\n isNonEmptyObject(examples) && Object.values(examples).every((example) => isExampleObject(example))\n\n if (isExamplesCollection) {\n requestBodyObject.content[type].examples = examples as Record<string, OpenAPIV3.ExampleObject>\n }\n // Named examples without value wrappers - wrap each individually\n else if (isNamedExamplesCollection(examples)) {\n requestBodyObject.content[type].examples = Object.entries(examples).reduce(\n (acc, [key, exampleValue]) => {\n acc[key] = wrapAsExampleObject(exampleValue)\n return acc\n },\n {} as Record<string, OpenAPIV3.ExampleObject>,\n )\n }\n // Single example value - wrap as default\n else {\n requestBodyObject.content[type].examples = {\n default: wrapAsExampleObject(examples),\n }\n }\n }\n }\n }\n\n return requestBodyObject\n}\n\nfunction migrateFormDataParameter(\n parameters: OpenAPIV2.ParameterObject[],\n consumes: string[] | undefined = ['multipart/form-data'],\n): OpenAPIV3.RequestBodyObject {\n const requestBodyObject: OpenAPIV3.RequestBodyObject = {\n content: {},\n }\n\n // Ensure consumes contains a form data content type\n const filtered = consumes.filter(\n (type) => type === 'multipart/form-data' || type === 'application/x-www-form-urlencoded',\n )\n const contentTypes = filtered.length > 0 ? filtered : ['multipart/form-data']\n\n if (requestBodyObject.content) {\n for (const contentType of contentTypes) {\n requestBodyObject.content[contentType] = {\n schema: {\n type: 'object',\n properties: {},\n required: [], // Initialize required array\n },\n }\n\n const formContent = requestBodyObject.content?.[contentType]\n if (formContent?.schema && typeof formContent.schema === 'object' && 'properties' in formContent.schema) {\n for (const param of parameters) {\n if (param.name && formContent.schema.properties) {\n formContent.schema.properties[param.name] = {\n type: param.type,\n description: param.description,\n ...(param.format ? { format: param.format } : {}),\n }\n\n // Add to required array if param is required\n if (param.required && Array.isArray(formContent.schema.required)) {\n formContent.schema.required.push(param.name)\n }\n }\n }\n }\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: OpenAPIV2.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, consumes)\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.request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I,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
@@ -20,7 +20,7 @@
20
20
  "openapi 3.0",
21
21
  "openapi 3.1"
22
22
  ],
23
- "version": "0.1.9",
23
+ "version": "0.1.10",
24
24
  "engines": {
25
25
  "node": ">=20"
26
26
  },
@@ -76,7 +76,7 @@
76
76
  "devDependencies": {
77
77
  "vite": "^7.3.1",
78
78
  "@scalar/build-tooling": "0.4.1",
79
- "@scalar/types": "0.6.8"
79
+ "@scalar/types": "0.6.9"
80
80
  },
81
81
  "scripts": {
82
82
  "build": "scalar-build-esbuild",