@scalar/openapi-upgrader 0.2.0 → 0.2.1

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.
@@ -1,5 +1 @@
1
- import { upgradeFromThreeToThreeOne } from "./upgrade-from-three-to-three-one.js";
2
- export {
3
- upgradeFromThreeToThreeOne
4
- };
5
- //# sourceMappingURL=index.js.map
1
+ export { upgradeFromThreeToThreeOne } from './upgrade-from-three-to-three-one.js';
@@ -1,126 +1,154 @@
1
- import { traverse } from "../helpers/traverse.js";
2
- const SCHEMA_SEGMENTS = /* @__PURE__ */ new Set([
3
- "properties",
4
- "items",
5
- "allOf",
6
- "anyOf",
7
- "oneOf",
8
- "not",
9
- "additionalProperties",
10
- "schema"
1
+ import { traverse } from '../helpers/traverse.js';
2
+ // Create Sets for faster schema path lookups
3
+ const SCHEMA_SEGMENTS = new Set([
4
+ 'properties',
5
+ 'items',
6
+ 'allOf',
7
+ 'anyOf',
8
+ 'oneOf',
9
+ 'not',
10
+ 'additionalProperties',
11
+ 'schema',
11
12
  ]);
12
- function isSchemaPath(path) {
13
- if (!path) {
13
+ /** Determine if the current path is within a schema - optimized version */
14
+ export function isSchemaPath(path) {
15
+ // Early return if path is undefined
16
+ if (!path) {
17
+ return false;
18
+ }
19
+ // Check for schema segments first (most common case)
20
+ if (path.some((segment) => SCHEMA_SEGMENTS.has(segment))) {
21
+ return true;
22
+ }
23
+ // Check for schema suffix
24
+ if (path.some((segment) => segment.endsWith('Schema'))) {
25
+ return true;
26
+ }
27
+ // Check for components/schemas path
28
+ if (path.length >= 2 && path[0] === 'components' && path[1] === 'schemas') {
29
+ return true;
30
+ }
14
31
  return false;
15
- }
16
- if (path.some((segment) => SCHEMA_SEGMENTS.has(segment))) {
17
- return true;
18
- }
19
- if (path.some((segment) => segment.endsWith("Schema"))) {
20
- return true;
21
- }
22
- if (path.length >= 2 && path[0] === "components" && path[1] === "schemas") {
23
- return true;
24
- }
25
- return false;
26
32
  }
27
- function upgradeFromThreeToThreeOne(originalContent) {
28
- let content = originalContent;
29
- if (content === null || typeof content.openapi !== "string" || !content.openapi.startsWith("3.0")) {
33
+ /**
34
+ * Upgrade from OpenAPI 3.0.x to 3.1.1
35
+ *
36
+ * https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0
37
+ */
38
+ export function upgradeFromThreeToThreeOne(originalContent) {
39
+ let content = originalContent;
40
+ // Version check - early return if not 3.0.x
41
+ if (content === null || typeof content.openapi !== 'string' || !content.openapi.startsWith('3.0')) {
42
+ return content;
43
+ }
44
+ content.openapi = '3.1.1';
45
+ // Single traversal that handles all transformations
46
+ content = traverse(content, applyChangesToDocument);
30
47
  return content;
31
- }
32
- content.openapi = "3.1.1";
33
- content = traverse(content, applyChangesToDocument);
34
- return content;
35
48
  }
36
49
  const applyChangesToDocument = (schema, path) => {
37
- if (schema.type !== void 0 && schema.nullable === true) {
38
- schema.type = [schema.type, "null"];
39
- delete schema.nullable;
40
- }
41
- if (schema.exclusiveMinimum === true) {
42
- schema.exclusiveMinimum = schema.minimum;
43
- delete schema.minimum;
44
- } else if (schema.exclusiveMinimum === false) {
45
- delete schema.exclusiveMinimum;
46
- }
47
- if (schema.exclusiveMaximum === true) {
48
- schema.exclusiveMaximum = schema.maximum;
49
- delete schema.maximum;
50
- } else if (schema.exclusiveMaximum === false) {
51
- delete schema.exclusiveMaximum;
52
- }
53
- const isInsideExamplesMap = path?.some((segment, index) => {
54
- if (segment === "examples" && index > 0) {
55
- const parent = path[index - 1];
56
- return parent !== "properties";
50
+ // 1. Handle nullable types
51
+ if (schema.type !== undefined && schema.nullable === true) {
52
+ schema.type = [schema.type, 'null'];
53
+ delete schema.nullable;
57
54
  }
58
- return false;
59
- });
60
- if (schema.example !== void 0 && !isInsideExamplesMap) {
61
- if (isSchemaPath(path)) {
62
- schema.examples = [schema.example];
63
- } else {
64
- schema.examples = {
65
- default: {
66
- value: schema.example
67
- }
68
- };
55
+ // 2. Handle exclusiveMinimum and exclusiveMaximum
56
+ if (schema.exclusiveMinimum === true) {
57
+ schema.exclusiveMinimum = schema.minimum;
58
+ delete schema.minimum;
59
+ }
60
+ else if (schema.exclusiveMinimum === false) {
61
+ delete schema.exclusiveMinimum;
62
+ }
63
+ if (schema.exclusiveMaximum === true) {
64
+ schema.exclusiveMaximum = schema.maximum;
65
+ delete schema.maximum;
69
66
  }
70
- delete schema.example;
71
- }
72
- if (schema.type === "object" && schema.properties !== void 0) {
73
- const parentPath = path?.slice(0, -1);
74
- const isMultipart = parentPath?.some((segment, index) => {
75
- return segment === "content" && path?.[index + 1] === "multipart/form-data";
67
+ else if (schema.exclusiveMaximum === false) {
68
+ delete schema.exclusiveMaximum;
69
+ }
70
+ // 3. Handle examples
71
+ // Skip conversion if we're already inside an examples map to avoid double nesting
72
+ // Check if 'examples' appears as an exact path segment (not just a substring)
73
+ // BUT exclude cases where 'examples' is just a schema property name
74
+ const isInsideExamplesMap = path?.some((segment, index) => {
75
+ // Only consider it an examples map if 'examples' is not a schema property name
76
+ if (segment === 'examples' && index > 0) {
77
+ const parent = path[index - 1];
78
+ // If parent is 'properties', then 'examples' is just a property name, not an examples map
79
+ return parent !== 'properties';
80
+ }
81
+ return false;
76
82
  });
77
- if (isMultipart && schema.properties !== null) {
78
- for (const value of Object.values(schema.properties)) {
79
- if (typeof value === "object" && value !== null && "type" in value && "format" in value && value.type === "string" && value.format === "binary") {
80
- value.contentMediaType = "application/octet-stream";
81
- delete value.format;
83
+ if (schema.example !== undefined && !isInsideExamplesMap) {
84
+ if (isSchemaPath(path)) {
85
+ schema.examples = [schema.example];
86
+ }
87
+ else {
88
+ schema.examples = {
89
+ default: {
90
+ value: schema.example,
91
+ },
92
+ };
82
93
  }
83
- }
94
+ delete schema.example;
84
95
  }
85
- }
86
- if (path?.includes("content") && path?.includes("application/octet-stream")) {
87
- return {};
88
- }
89
- const { format: _, ...rest } = schema;
90
- if (schema.type === "string") {
91
- if (schema.format === "binary") {
92
- return {
93
- ...rest,
94
- type: "string",
95
- contentMediaType: "application/octet-stream"
96
- };
96
+ // 4. Handle multipart file uploads
97
+ if (schema.type === 'object' && schema.properties !== undefined) {
98
+ const parentPath = path?.slice(0, -1);
99
+ const isMultipart = parentPath?.some((segment, index) => {
100
+ return segment === 'content' && path?.[index + 1] === 'multipart/form-data';
101
+ });
102
+ if (isMultipart && schema.properties !== null) {
103
+ for (const value of Object.values(schema.properties)) {
104
+ if (typeof value === 'object' &&
105
+ value !== null &&
106
+ 'type' in value &&
107
+ 'format' in value &&
108
+ value.type === 'string' &&
109
+ value.format === 'binary') {
110
+ value.contentMediaType = 'application/octet-stream';
111
+ delete value.format;
112
+ }
113
+ }
114
+ }
97
115
  }
98
- if (schema.format === "base64") {
99
- return {
100
- ...rest,
101
- type: "string",
102
- contentEncoding: "base64"
103
- };
116
+ // 5. Handle binary file uploads
117
+ if (path?.includes('content') && path?.includes('application/octet-stream')) {
118
+ return {};
104
119
  }
105
- if (schema.format === "byte") {
106
- const parentPath = path?.slice(0, -1);
107
- const contentMediaType = parentPath?.find((_2, index) => path?.[index - 1] === "content");
108
- return {
109
- ...rest,
110
- type: "string",
111
- contentEncoding: "base64",
112
- contentMediaType
113
- };
120
+ // 6. Handle older formats
121
+ const { format: _, ...rest } = schema;
122
+ if (schema.type === 'string') {
123
+ if (schema.format === 'binary') {
124
+ return {
125
+ ...rest,
126
+ type: 'string',
127
+ contentMediaType: 'application/octet-stream',
128
+ };
129
+ }
130
+ if (schema.format === 'base64') {
131
+ return {
132
+ ...rest,
133
+ type: 'string',
134
+ contentEncoding: 'base64',
135
+ };
136
+ }
137
+ if (schema.format === 'byte') {
138
+ const parentPath = path?.slice(0, -1);
139
+ const contentMediaType = parentPath?.find((_, index) => path?.[index - 1] === 'content');
140
+ return {
141
+ ...rest,
142
+ type: 'string',
143
+ contentEncoding: 'base64',
144
+ contentMediaType,
145
+ };
146
+ }
114
147
  }
115
- }
116
- if (schema["x-webhooks"] !== void 0) {
117
- schema.webhooks = schema["x-webhooks"];
118
- delete schema["x-webhooks"];
119
- }
120
- return schema;
121
- };
122
- export {
123
- isSchemaPath,
124
- upgradeFromThreeToThreeOne
148
+ // 7. Handle x-webhooks
149
+ if (schema['x-webhooks'] !== undefined) {
150
+ schema.webhooks = schema['x-webhooks'];
151
+ delete schema['x-webhooks'];
152
+ }
153
+ return schema;
125
154
  };
126
- //# sourceMappingURL=upgrade-from-three-to-three-one.js.map
@@ -1,5 +1 @@
1
- import { upgradeFromThreeOneToThreeTwo } from "./upgrade-from-three-one-to-three-two.js";
2
- export {
3
- upgradeFromThreeOneToThreeTwo
4
- };
5
- //# sourceMappingURL=index.js.map
1
+ export { upgradeFromThreeOneToThreeTwo } from './upgrade-from-three-one-to-three-two.js';
@@ -1,77 +1,107 @@
1
+ /**
2
+ * Recursively migrate XML object properties from 3.1 to 3.2 format
3
+ */
1
4
  function migrateXmlObjects(obj) {
2
- if (obj === null || typeof obj !== "object") {
3
- return;
4
- }
5
- if (Array.isArray(obj)) {
6
- for (const item of obj) {
7
- migrateXmlObjects(item);
5
+ if (obj === null || typeof obj !== 'object') {
6
+ return;
8
7
  }
9
- return;
10
- }
11
- if (obj.xml && typeof obj.xml === "object") {
12
- if (obj.xml.wrapped === true && obj.xml.attribute === true) {
13
- throw new Error("Invalid XML configuration: wrapped and attribute cannot be true at the same time.");
14
- }
15
- if (obj.xml.wrapped === true) {
16
- delete obj.xml.wrapped;
17
- obj.xml.nodeType = "element";
8
+ // Handle arrays
9
+ if (Array.isArray(obj)) {
10
+ for (const item of obj) {
11
+ migrateXmlObjects(item);
12
+ }
13
+ return;
18
14
  }
19
- if (obj.xml.attribute === true) {
20
- delete obj.xml.attribute;
21
- obj.xml.nodeType = "attribute";
15
+ // Handle xml property migration
16
+ if (obj.xml && typeof obj.xml === 'object') {
17
+ if (obj.xml.wrapped === true && obj.xml.attribute === true) {
18
+ throw new Error('Invalid XML configuration: wrapped and attribute cannot be true at the same time.');
19
+ }
20
+ // Migrate wrapped: true to nodeType: 'element'
21
+ if (obj.xml.wrapped === true) {
22
+ delete obj.xml.wrapped;
23
+ obj.xml.nodeType = 'element';
24
+ }
25
+ // Migrate attribute: true to nodeType: 'attribute'
26
+ if (obj.xml.attribute === true) {
27
+ delete obj.xml.attribute;
28
+ obj.xml.nodeType = 'attribute';
29
+ }
22
30
  }
23
- }
24
- for (const key in obj) {
25
- if (Object.hasOwn(obj, key)) {
26
- migrateXmlObjects(obj[key]);
31
+ // Recursively process all object properties
32
+ for (const key in obj) {
33
+ if (Object.hasOwn(obj, key)) {
34
+ migrateXmlObjects(obj[key]);
35
+ }
27
36
  }
28
- }
29
37
  }
38
+ /**
39
+ * Migrate x-tagGroups to kind property on tags
40
+ */
30
41
  function migrateTagGroups(document) {
31
- if (document["x-tagGroups"] && Array.isArray(document["x-tagGroups"])) {
32
- const tagGroups = document["x-tagGroups"];
33
- if (!document.tags) {
34
- document.tags = [];
35
- }
36
- const tagGroupMap = /* @__PURE__ */ new Map();
37
- for (const group of tagGroups) {
38
- for (const tagName of group.tags) {
39
- tagGroupMap.set(tagName, group.name);
40
- }
41
- }
42
- if (Array.isArray(document.tags)) {
43
- for (const tag of document.tags) {
44
- if (typeof tag === "object" && tag !== null && "name" in tag) {
45
- const groupName = tagGroupMap.get(tag.name);
46
- if (groupName) {
47
- if (groupName.toLowerCase().includes("nav") || groupName.toLowerCase().includes("navigation")) {
48
- tag.kind = "nav";
49
- } else if (groupName.toLowerCase().includes("audience")) {
50
- tag.kind = "audience";
51
- } else if (groupName.toLowerCase().includes("badge")) {
52
- tag.kind = "badge";
53
- } else {
54
- tag.kind = "nav";
42
+ if (document['x-tagGroups'] && Array.isArray(document['x-tagGroups'])) {
43
+ const tagGroups = document['x-tagGroups'];
44
+ // Ensure tags array exists
45
+ if (!document.tags) {
46
+ document.tags = [];
47
+ }
48
+ // Create a map of tag names to their group information
49
+ const tagGroupMap = new Map();
50
+ for (const group of tagGroups) {
51
+ for (const tagName of group.tags) {
52
+ tagGroupMap.set(tagName, group.name);
53
+ }
54
+ }
55
+ // Update existing tags with kind property based on group name
56
+ if (Array.isArray(document.tags)) {
57
+ for (const tag of document.tags) {
58
+ if (typeof tag === 'object' && tag !== null && 'name' in tag) {
59
+ const groupName = tagGroupMap.get(tag.name);
60
+ if (groupName) {
61
+ // Map group names to kind values
62
+ // This is a simplified mapping - in practice, you might want more sophisticated logic
63
+ if (groupName.toLowerCase().includes('nav') || groupName.toLowerCase().includes('navigation')) {
64
+ tag.kind = 'nav';
65
+ }
66
+ else if (groupName.toLowerCase().includes('audience')) {
67
+ tag.kind = 'audience';
68
+ }
69
+ else if (groupName.toLowerCase().includes('badge')) {
70
+ tag.kind = 'badge';
71
+ }
72
+ else {
73
+ // Default to nav for unknown group types
74
+ tag.kind = 'nav';
75
+ }
76
+ }
77
+ }
55
78
  }
56
- }
57
79
  }
58
- }
80
+ // Remove x-tagGroups
81
+ delete document['x-tagGroups'];
59
82
  }
60
- delete document["x-tagGroups"];
61
- }
62
83
  }
63
- function upgradeFromThreeOneToThreeTwo(originalDocument) {
64
- const document = originalDocument;
65
- if (document !== null && typeof document === "object" && typeof document.openapi === "string" && document.openapi?.startsWith("3.1")) {
66
- document.openapi = "3.2.0";
67
- } else {
84
+ /**
85
+ * Upgrade OpenAPI 3.1 to 3.2
86
+ *
87
+ * @see https://github.com/OAI/OpenAPI-Specification/compare/main...v3.2-dev
88
+ */
89
+ export function upgradeFromThreeOneToThreeTwo(originalDocument) {
90
+ const document = originalDocument;
91
+ // Version
92
+ if (document !== null &&
93
+ typeof document === 'object' &&
94
+ typeof document.openapi === 'string' &&
95
+ document.openapi?.startsWith('3.1')) {
96
+ document.openapi = '3.2.0';
97
+ }
98
+ else {
99
+ // Skip if it's something else than 3.1.x
100
+ return document;
101
+ }
102
+ // Migrate x-tagGroups to kind property
103
+ migrateTagGroups(document);
104
+ // Migrate XML object properties
105
+ migrateXmlObjects(document);
68
106
  return document;
69
- }
70
- migrateTagGroups(document);
71
- migrateXmlObjects(document);
72
- return document;
73
107
  }
74
- export {
75
- upgradeFromThreeOneToThreeTwo
76
- };
77
- //# sourceMappingURL=upgrade-from-three-one-to-three-two.js.map
@@ -1,25 +1,24 @@
1
- function traverse(content, transform, path = []) {
2
- const result = {};
3
- for (const [key, value] of Object.entries(content)) {
4
- const currentPath = [...path, key];
5
- if (Array.isArray(value)) {
6
- result[key] = value.map((item, index) => {
7
- if (typeof item === "object" && !Array.isArray(item) && item !== null) {
8
- return traverse(item, transform, [...currentPath, index.toString()]);
1
+ /**
2
+ * Recursively traverses the content and applies the transform function to each node.
3
+ */
4
+ export function traverse(content, transform, path = []) {
5
+ const result = {};
6
+ for (const [key, value] of Object.entries(content)) {
7
+ const currentPath = [...path, key];
8
+ if (Array.isArray(value)) {
9
+ result[key] = value.map((item, index) => {
10
+ if (typeof item === 'object' && !Array.isArray(item) && item !== null) {
11
+ return traverse(item, transform, [...currentPath, index.toString()]);
12
+ }
13
+ return item;
14
+ });
15
+ continue;
9
16
  }
10
- return item;
11
- });
12
- continue;
13
- }
14
- if (typeof value === "object" && value !== null) {
15
- result[key] = traverse(value, transform, currentPath);
16
- continue;
17
+ if (typeof value === 'object' && value !== null) {
18
+ result[key] = traverse(value, transform, currentPath);
19
+ continue;
20
+ }
21
+ result[key] = value;
17
22
  }
18
- result[key] = value;
19
- }
20
- return transform(result, path);
23
+ return transform(result, path);
21
24
  }
22
- export {
23
- traverse
24
- };
25
- //# sourceMappingURL=traverse.js.map
package/dist/index.js CHANGED
@@ -1,5 +1 @@
1
- import { upgrade } from "./upgrade.js";
2
- export {
3
- upgrade
4
- };
5
- //# sourceMappingURL=index.js.map
1
+ export { upgrade } from './upgrade.js';
@@ -1,31 +1,46 @@
1
- import { bench, describe, expect } from "vitest";
2
- import { upgradeFromTwoToThree } from "./2.0-to-3.0/upgrade-from-two-to-three.js";
3
- import { upgrade } from "./upgrade.js";
4
- const STRIPE = await fetch(
5
- "https://raw.githubusercontent.com/stripe/openapi/refs/heads/master/openapi/spec3.json"
6
- ).then((r) => r.json());
7
- const PETSTORE = await fetch("https://petstore.swagger.io/v2/swagger.json").then((r) => r.json());
8
- describe("upgrade", () => {
9
- describe("Petstore: Swagger 2.0 to OpenAPI 3.0", () => {
10
- bench("new", () => {
11
- expect(PETSTORE.swagger).toBe("2.0");
12
- const result = upgradeFromTwoToThree({ ...PETSTORE });
13
- expect(result.openapi).toBe("3.0.4");
1
+ import { bench, describe, expect } from 'vitest';
2
+ import { upgradeFromTwoToThree } from './2.0-to-3.0/upgrade-from-two-to-three.js';
3
+ // import { upgrade as upgradeOld } from './slow/upgrade'
4
+ // import { upgradeFromTwoToThree as upgradeFromTwoToThreeOld } from './slow/upgradeFromTwoToThree'
5
+ import { upgrade } from './upgrade.js';
6
+ // Setup the test data
7
+ const STRIPE = await fetch('https://raw.githubusercontent.com/stripe/openapi/refs/heads/master/openapi/spec3.json').then((r) => r.json());
8
+ const PETSTORE = await fetch('https://petstore.swagger.io/v2/swagger.json').then((r) => r.json());
9
+ describe('upgrade', () => {
10
+ describe('Petstore: Swagger 2.0 to OpenAPI 3.0', () => {
11
+ bench('new', () => {
12
+ expect(PETSTORE.swagger).toBe('2.0');
13
+ const result = upgradeFromTwoToThree({ ...PETSTORE });
14
+ expect(result.openapi).toBe('3.0.4');
15
+ });
16
+ // bench('old', () => {
17
+ // expect(PETSTORE.swagger).toBe('2.0')
18
+ // const result = upgradeFromTwoToThreeOld({ ...PETSTORE })
19
+ // expect(result.openapi).toBe('3.0.4')
20
+ // })
14
21
  });
15
- });
16
- describe("Stripe: OpenAPI 3.0 to 3.1", () => {
17
- bench("new", () => {
18
- expect(STRIPE.openapi).toBe("3.0.0");
19
- const document = upgrade(STRIPE, "3.1");
20
- expect(document?.openapi).toBe("3.1.1");
22
+ describe('Stripe: OpenAPI 3.0 to 3.1', () => {
23
+ bench('new', () => {
24
+ expect(STRIPE.openapi).toBe('3.0.0');
25
+ const document = upgrade(STRIPE, '3.1');
26
+ expect(document?.openapi).toBe('3.1.1');
27
+ });
28
+ // bench('old', () => {
29
+ // expect(STRIPE.openapi).toBe('3.0.0')
30
+ // const document = upgradeOld(STRIPE)
31
+ // expect(document?.openapi).toBe('3.1.1')
32
+ // })
21
33
  });
22
- });
23
- describe("Petstore: Swagger 2.0 to OpenAPI 3.1", () => {
24
- bench("new", () => {
25
- expect(PETSTORE.swagger).toBe("2.0");
26
- const document = upgrade(PETSTORE, "3.1");
27
- expect(document?.openapi).toBe("3.1.1");
34
+ describe('Petstore: Swagger 2.0 to OpenAPI 3.1', () => {
35
+ bench('new', () => {
36
+ expect(PETSTORE.swagger).toBe('2.0');
37
+ const document = upgrade(PETSTORE, '3.1');
38
+ expect(document?.openapi).toBe('3.1.1');
39
+ });
40
+ // bench('old', () => {
41
+ // expect(PETSTORE.swagger).toBe('2.0')
42
+ // const document = upgradeOld(PETSTORE)
43
+ // expect(document?.openapi).toBe('3.1.1')
44
+ // })
28
45
  });
29
- });
30
46
  });
31
- //# sourceMappingURL=upgrade.bench.js.map
package/dist/upgrade.js CHANGED
@@ -1,22 +1,21 @@
1
- import { upgradeFromThreeOneToThreeTwo } from "./3.1-to-3.2/index.js";
2
- import { upgradeFromTwoToThree } from "./2.0-to-3.0/index.js";
3
- import { upgradeFromThreeToThreeOne } from "./3.0-to-3.1/index.js";
4
- function upgrade(value, targetVersion) {
5
- const openapi30 = upgradeFromTwoToThree(value);
6
- if (targetVersion === "3.0") {
7
- return openapi30;
8
- }
9
- const openapi31 = upgradeFromThreeToThreeOne(openapi30);
10
- if (targetVersion === "3.1") {
11
- return openapi31;
12
- }
13
- const openapi32 = upgradeFromThreeOneToThreeTwo(openapi31);
14
- if (targetVersion === "3.2") {
1
+ import { upgradeFromThreeOneToThreeTwo } from './3.1-to-3.2/index.js';
2
+ import { upgradeFromTwoToThree } from './2.0-to-3.0/index.js';
3
+ import { upgradeFromThreeToThreeOne } from './3.0-to-3.1/index.js';
4
+ export function upgrade(value, targetVersion) {
5
+ // Swagger 2.0 -> OpenAPI 3.0
6
+ const openapi30 = upgradeFromTwoToThree(value);
7
+ if (targetVersion === '3.0') {
8
+ return openapi30;
9
+ }
10
+ // OpenAPI 3.0 -> OpenAPI 3.1
11
+ const openapi31 = upgradeFromThreeToThreeOne(openapi30);
12
+ if (targetVersion === '3.1') {
13
+ return openapi31;
14
+ }
15
+ // OpenAPI 3.1 -> OpenAPI 3.2
16
+ const openapi32 = upgradeFromThreeOneToThreeTwo(openapi31);
17
+ if (targetVersion === '3.2') {
18
+ return openapi32;
19
+ }
15
20
  return openapi32;
16
- }
17
- return openapi32;
18
21
  }
19
- export {
20
- upgrade
21
- };
22
- //# sourceMappingURL=upgrade.js.map