@zuplo/openapi-tools 6.65.9 → 6.66.2
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/dist/constants.d.ts +13 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +25 -0
- package/dist/constants.js.map +1 -0
- package/dist/file-format.d.ts +59 -0
- package/dist/file-format.d.ts.map +1 -0
- package/dist/file-format.js +142 -0
- package/dist/file-format.js.map +1 -0
- package/dist/file-format.spec.d.ts +2 -0
- package/dist/file-format.spec.d.ts.map +1 -0
- package/dist/file-format.spec.js +289 -0
- package/dist/file-format.spec.js.map +1 -0
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +32 -5
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js +0 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/merge-fixtures.spec.d.ts +2 -0
- package/dist/merge-fixtures.spec.d.ts.map +1 -0
- package/dist/merge-fixtures.spec.js +181 -0
- package/dist/merge-fixtures.spec.js.map +1 -0
- package/dist/{openapi-utils.d.ts → merge.d.ts} +2 -22
- package/dist/merge.d.ts.map +1 -0
- package/dist/{openapi-utils.js → merge.js} +6 -186
- package/dist/merge.js.map +1 -0
- package/dist/merge.spec.d.ts +2 -0
- package/dist/merge.spec.d.ts.map +1 -0
- package/dist/merge.spec.js +399 -0
- package/dist/merge.spec.js.map +1 -0
- package/dist/operation-utils.d.ts +29 -0
- package/dist/operation-utils.d.ts.map +1 -0
- package/dist/operation-utils.js +123 -0
- package/dist/operation-utils.js.map +1 -0
- package/dist/overlay.d.ts +78 -0
- package/dist/overlay.d.ts.map +1 -0
- package/dist/overlay.js +477 -0
- package/dist/overlay.js.map +1 -0
- package/dist/overlay.spec.d.ts +2 -0
- package/dist/overlay.spec.d.ts.map +1 -0
- package/dist/overlay.spec.js +697 -0
- package/dist/overlay.spec.js.map +1 -0
- package/dist/parsing.d.ts +17 -0
- package/dist/parsing.d.ts.map +1 -0
- package/dist/parsing.js +32 -0
- package/dist/parsing.js.map +1 -0
- package/dist/path-transform.d.ts +11 -0
- package/dist/path-transform.d.ts.map +1 -0
- package/dist/path-transform.js +51 -0
- package/dist/path-transform.js.map +1 -0
- package/dist/path-transform.spec.d.ts +2 -0
- package/dist/path-transform.spec.d.ts.map +1 -0
- package/dist/path-transform.spec.js +269 -0
- package/dist/path-transform.spec.js.map +1 -0
- package/dist/url-utils.d.ts +14 -0
- package/dist/url-utils.d.ts.map +1 -0
- package/dist/url-utils.js +40 -0
- package/dist/url-utils.js.map +1 -0
- package/dist/url-utils.spec.d.ts +2 -0
- package/dist/url-utils.spec.d.ts.map +1 -0
- package/dist/url-utils.spec.js +93 -0
- package/dist/url-utils.spec.js.map +1 -0
- package/dist/validation.d.ts +210 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +119 -0
- package/dist/validation.js.map +1 -0
- package/package.json +9 -10
- package/dist/index.spec.d.ts +0 -2
- package/dist/index.spec.d.ts.map +0 -1
- package/dist/index.spec.js +0 -526
- package/dist/index.spec.js.map +0 -1
- package/dist/openapi-utils.d.ts.map +0 -1
- package/dist/openapi-utils.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../src/overlay.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,eAAe,EAGrB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAeD;;;GAGG;AACH,wBAAg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API documents following the OpenAPI Overlay Specification
|
|
4
|
+
*/
|
|
5
|
+
import { JSONPath } from "jsonpath-plus";
|
|
6
|
+
import { HTTP_METHODS } from "./constants.js";
|
|
7
|
+
import { validateOpenApiDocument, validateOverlayDocument, } from "./validation.js";
|
|
8
|
+
/**
|
|
9
|
+
* Safely validate and return a generic object
|
|
10
|
+
* Used internally for dynamic JSON manipulation
|
|
11
|
+
*/
|
|
12
|
+
function toRecord(value, context) {
|
|
13
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
14
|
+
throw new Error(`Expected object at ${context}, but got ${Array.isArray(value) ? "array" : typeof value}`);
|
|
15
|
+
}
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Deep clone an object using structuredClone for better performance and correctness
|
|
20
|
+
* Falls back to JSON parse/stringify for environments without structuredClone
|
|
21
|
+
*/
|
|
22
|
+
export function deepClone(obj) {
|
|
23
|
+
if (typeof structuredClone === "function") {
|
|
24
|
+
return structuredClone(obj);
|
|
25
|
+
}
|
|
26
|
+
return JSON.parse(JSON.stringify(obj));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Deep merge two objects
|
|
30
|
+
* Special handling for OpenAPI parameters (merge by name+in)
|
|
31
|
+
* Returns the merged result, which will have the shape of source if target is not an object,
|
|
32
|
+
* or a merged object/array if both are objects/arrays
|
|
33
|
+
*/
|
|
34
|
+
export function deepMerge(target, source) {
|
|
35
|
+
if (!source || typeof source !== "object") {
|
|
36
|
+
return source;
|
|
37
|
+
}
|
|
38
|
+
if (!target || typeof target !== "object") {
|
|
39
|
+
return deepClone(source);
|
|
40
|
+
}
|
|
41
|
+
if (Array.isArray(source)) {
|
|
42
|
+
if (!Array.isArray(target)) {
|
|
43
|
+
return deepClone(source);
|
|
44
|
+
}
|
|
45
|
+
// Special case for OpenAPI parameters - merge by name+in
|
|
46
|
+
if (source.length > 0 &&
|
|
47
|
+
typeof source[0] === "object" &&
|
|
48
|
+
source[0] !== null &&
|
|
49
|
+
"name" in source[0] &&
|
|
50
|
+
"in" in source[0]) {
|
|
51
|
+
const merged = [...target];
|
|
52
|
+
for (const sourceParam of source) {
|
|
53
|
+
if (typeof sourceParam !== "object" || sourceParam === null)
|
|
54
|
+
continue;
|
|
55
|
+
const existingIndex = merged.findIndex((p) => typeof p === "object" &&
|
|
56
|
+
p !== null &&
|
|
57
|
+
"name" in p &&
|
|
58
|
+
"in" in p &&
|
|
59
|
+
"name" in sourceParam &&
|
|
60
|
+
"in" in sourceParam &&
|
|
61
|
+
p.name === sourceParam.name &&
|
|
62
|
+
p.in === sourceParam.in);
|
|
63
|
+
if (existingIndex >= 0) {
|
|
64
|
+
merged[existingIndex] = deepMerge(merged[existingIndex], sourceParam);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
merged.push(deepClone(sourceParam));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return merged;
|
|
71
|
+
}
|
|
72
|
+
// For other arrays, concatenate
|
|
73
|
+
return [...target, ...deepClone(source)];
|
|
74
|
+
}
|
|
75
|
+
// Both are objects at this point (checked above)
|
|
76
|
+
const targetObj = target;
|
|
77
|
+
const sourceObj = source;
|
|
78
|
+
const result = { ...targetObj };
|
|
79
|
+
for (const [key, value] of Object.entries(sourceObj)) {
|
|
80
|
+
if (key in result) {
|
|
81
|
+
result[key] = deepMerge(result[key], value);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
result[key] = deepClone(value);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Check if a condition is met for conditional removal
|
|
91
|
+
*/
|
|
92
|
+
export function checkCondition(value, condition) {
|
|
93
|
+
// Support "empty" condition to check if object has no keys
|
|
94
|
+
if (condition.empty) {
|
|
95
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
96
|
+
return Object.keys(value).length === 0;
|
|
97
|
+
}
|
|
98
|
+
if (Array.isArray(value)) {
|
|
99
|
+
return value.length === 0;
|
|
100
|
+
}
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
// Support "missing" condition to check if a property doesn't exist
|
|
104
|
+
if (condition.missing) {
|
|
105
|
+
const parts = condition.missing.split(".");
|
|
106
|
+
let current = value;
|
|
107
|
+
for (const part of parts) {
|
|
108
|
+
if (current &&
|
|
109
|
+
typeof current === "object" &&
|
|
110
|
+
!Array.isArray(current) &&
|
|
111
|
+
part in current) {
|
|
112
|
+
current = current[part];
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
return true; // Property is missing
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return false; // Property exists
|
|
119
|
+
}
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Regular expression for parsing JSONPath segments
|
|
124
|
+
* Matches: word, or [quoted], or ['quoted'], or ["quoted"], or numeric indices [0]
|
|
125
|
+
*/
|
|
126
|
+
const JSONPATH_SEGMENT_PATTERN = /[^.[]+|\[[^\]]+\]/g;
|
|
127
|
+
/**
|
|
128
|
+
* Extract key from bracket notation, handling various formats:
|
|
129
|
+
* - ['key'] -> key
|
|
130
|
+
* - ["key"] -> key
|
|
131
|
+
* - [key] -> key
|
|
132
|
+
* - [0] -> 0 (as string for consistency)
|
|
133
|
+
*/
|
|
134
|
+
function extractBracketKey(bracketNotation) {
|
|
135
|
+
const inner = bracketNotation.slice(1, -1); // Remove [ and ]
|
|
136
|
+
// Handle single-quoted: ['key'] -> key
|
|
137
|
+
if (inner.startsWith("'") && inner.endsWith("'")) {
|
|
138
|
+
return inner.slice(1, -1);
|
|
139
|
+
}
|
|
140
|
+
// Handle double-quoted: ["key"] -> key
|
|
141
|
+
if (inner.startsWith('"') && inner.endsWith('"')) {
|
|
142
|
+
return inner.slice(1, -1);
|
|
143
|
+
}
|
|
144
|
+
// Handle unquoted: [key] or [0] -> key or 0
|
|
145
|
+
return inner;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Set a value at a JSONPath, creating parent paths as needed
|
|
149
|
+
* Handles patterns like:
|
|
150
|
+
* $.paths['/route'].method
|
|
151
|
+
* $.components.parameters['name']
|
|
152
|
+
* $.paths["/users"].get
|
|
153
|
+
* $.paths[users].get
|
|
154
|
+
* $.items[0].value
|
|
155
|
+
*/
|
|
156
|
+
const PROTOTYPE_POLLUTION_KEYS = new Set([
|
|
157
|
+
"__proto__",
|
|
158
|
+
"constructor",
|
|
159
|
+
"prototype",
|
|
160
|
+
]);
|
|
161
|
+
function assertSafeKey(key, context) {
|
|
162
|
+
if (PROTOTYPE_POLLUTION_KEYS.has(key)) {
|
|
163
|
+
throw new Error(`Unsafe key "${key}" in ${context} would cause prototype pollution`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
export function setValueAtPath(doc, target, value) {
|
|
167
|
+
// Parse the path manually to handle both bracket and dot notation
|
|
168
|
+
// Example: $.paths['/route'].post -> ["paths", "['/route']", "post"]
|
|
169
|
+
// Remove leading $.
|
|
170
|
+
const targetPath = target.replace(/^\$\./, "");
|
|
171
|
+
// Split by dots, but keep bracket notation together
|
|
172
|
+
const parts = targetPath.match(JSONPATH_SEGMENT_PATTERN) || [];
|
|
173
|
+
// biome-ignore lint/suspicious/noExplicitAny: Dynamic path traversal requires any
|
|
174
|
+
let current = toRecord(doc, "setValueAtPath document");
|
|
175
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
176
|
+
const part = parts[i];
|
|
177
|
+
// Handle bracket notation
|
|
178
|
+
if (part.startsWith("[")) {
|
|
179
|
+
const key = extractBracketKey(part);
|
|
180
|
+
// Check if key is a numeric index for array access
|
|
181
|
+
const numericKey = parseInt(key, 10);
|
|
182
|
+
if (Array.isArray(current) && !Number.isNaN(numericKey)) {
|
|
183
|
+
// Array access with numeric index
|
|
184
|
+
if (current[numericKey] === undefined) {
|
|
185
|
+
current[numericKey] = {};
|
|
186
|
+
}
|
|
187
|
+
current = current[numericKey];
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
// Object property access
|
|
191
|
+
assertSafeKey(key, "setValueAtPath intermediate segment");
|
|
192
|
+
if (!Object.hasOwn(current, key)) {
|
|
193
|
+
Object.defineProperty(current, key, {
|
|
194
|
+
value: {},
|
|
195
|
+
writable: true,
|
|
196
|
+
enumerable: true,
|
|
197
|
+
configurable: true,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
current = current[key];
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
// Handle regular property
|
|
205
|
+
assertSafeKey(part, "setValueAtPath intermediate segment");
|
|
206
|
+
if (!Object.hasOwn(current, part)) {
|
|
207
|
+
Object.defineProperty(current, part, {
|
|
208
|
+
value: {},
|
|
209
|
+
writable: true,
|
|
210
|
+
enumerable: true,
|
|
211
|
+
configurable: true,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
current = current[part];
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
// Set the final value
|
|
218
|
+
const lastPart = parts[parts.length - 1];
|
|
219
|
+
if (lastPart.startsWith("[")) {
|
|
220
|
+
const key = extractBracketKey(lastPart);
|
|
221
|
+
// Check if key is a numeric index for array access
|
|
222
|
+
const numericKey = parseInt(key, 10);
|
|
223
|
+
if (Array.isArray(current) && !Number.isNaN(numericKey)) {
|
|
224
|
+
current[numericKey] = value;
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
assertSafeKey(key, "setValueAtPath final segment");
|
|
228
|
+
Object.defineProperty(current, key, {
|
|
229
|
+
value,
|
|
230
|
+
writable: true,
|
|
231
|
+
enumerable: true,
|
|
232
|
+
configurable: true,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
assertSafeKey(lastPart, "setValueAtPath final segment");
|
|
238
|
+
Object.defineProperty(current, lastPart, {
|
|
239
|
+
value,
|
|
240
|
+
writable: true,
|
|
241
|
+
enumerable: true,
|
|
242
|
+
configurable: true,
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Apply a single overlay action to the document
|
|
248
|
+
*/
|
|
249
|
+
export function applyAction(doc, action) {
|
|
250
|
+
const docRecord = toRecord(doc, "applyAction document");
|
|
251
|
+
if (action.update) {
|
|
252
|
+
// Handle root level updates specially
|
|
253
|
+
if (action.target === "$") {
|
|
254
|
+
Object.assign(docRecord, deepMerge(doc, action.update));
|
|
255
|
+
return { applied: true, count: 1 };
|
|
256
|
+
}
|
|
257
|
+
try {
|
|
258
|
+
// Try to find existing nodes
|
|
259
|
+
const results = JSONPath({
|
|
260
|
+
path: action.target,
|
|
261
|
+
// biome-ignore lint/suspicious/noExplicitAny: JSONPath library requires loose typing
|
|
262
|
+
json: doc,
|
|
263
|
+
resultType: "all",
|
|
264
|
+
});
|
|
265
|
+
if (results.length > 0) {
|
|
266
|
+
// Path exists, merge the update
|
|
267
|
+
let count = 0;
|
|
268
|
+
for (const result of results) {
|
|
269
|
+
const { parent, parentProperty } = result;
|
|
270
|
+
if (parent &&
|
|
271
|
+
typeof parent === "object" &&
|
|
272
|
+
!Array.isArray(parent) &&
|
|
273
|
+
parentProperty !== undefined) {
|
|
274
|
+
const parentRecord = parent;
|
|
275
|
+
parentRecord[parentProperty] = deepMerge(parentRecord[parentProperty], action.update);
|
|
276
|
+
count++;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return { applied: true, count };
|
|
280
|
+
}
|
|
281
|
+
// Path doesn't exist, create it manually
|
|
282
|
+
setValueAtPath(doc, action.target, action.update);
|
|
283
|
+
return { applied: true, count: 1 };
|
|
284
|
+
}
|
|
285
|
+
catch (cause) {
|
|
286
|
+
throw new Error("Failed to apply update", { cause });
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
else if (action.remove) {
|
|
290
|
+
try {
|
|
291
|
+
const results = JSONPath({
|
|
292
|
+
path: action.target,
|
|
293
|
+
// biome-ignore lint/suspicious/noExplicitAny: JSONPath library requires loose typing
|
|
294
|
+
json: doc,
|
|
295
|
+
resultType: "all",
|
|
296
|
+
});
|
|
297
|
+
if (results.length === 0) {
|
|
298
|
+
return { applied: false, count: 0 };
|
|
299
|
+
}
|
|
300
|
+
let count = 0;
|
|
301
|
+
// Process in reverse to avoid index issues when removing
|
|
302
|
+
for (let i = results.length - 1; i >= 0; i--) {
|
|
303
|
+
const result = results[i];
|
|
304
|
+
const { parent, parentProperty, value } = result;
|
|
305
|
+
// Check condition if specified
|
|
306
|
+
const shouldRemove = typeof action.remove === "object"
|
|
307
|
+
? checkCondition(value, action.remove)
|
|
308
|
+
: true;
|
|
309
|
+
if (shouldRemove && parent && parentProperty !== undefined) {
|
|
310
|
+
if (Array.isArray(parent)) {
|
|
311
|
+
parent.splice(parentProperty, 1);
|
|
312
|
+
}
|
|
313
|
+
else if (typeof parent === "object" && parent !== null) {
|
|
314
|
+
delete parent[parentProperty];
|
|
315
|
+
}
|
|
316
|
+
count++;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return { applied: true, count };
|
|
320
|
+
}
|
|
321
|
+
catch (cause) {
|
|
322
|
+
throw new Error("Failed to remove", { cause });
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return { applied: false, count: 0 };
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Extract path order from overlay actions
|
|
329
|
+
* Returns array of paths in the order they appear in overlay
|
|
330
|
+
*/
|
|
331
|
+
export function extractPathOrder(overlay) {
|
|
332
|
+
const pathOrder = [];
|
|
333
|
+
const seenPaths = new Set();
|
|
334
|
+
for (const action of overlay.actions) {
|
|
335
|
+
// Match patterns like $.paths['/route'].method
|
|
336
|
+
const match = action.target.match(/^\$\.paths\['([^']+)'\]/);
|
|
337
|
+
if (match) {
|
|
338
|
+
const targetPath = match[1];
|
|
339
|
+
if (!seenPaths.has(targetPath)) {
|
|
340
|
+
pathOrder.push(targetPath);
|
|
341
|
+
seenPaths.add(targetPath);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return pathOrder;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Reorder operation properties so summary, description, operationId come first
|
|
349
|
+
* Returns a new object with reordered keys
|
|
350
|
+
*/
|
|
351
|
+
export function reorderOperationProperties(operation) {
|
|
352
|
+
const operationObj = toRecord(operation, "reorderOperationProperties");
|
|
353
|
+
const priorityKeys = ["summary", "description", "operationId"];
|
|
354
|
+
const reordered = {};
|
|
355
|
+
// Add priority keys first (in order)
|
|
356
|
+
for (const key of priorityKeys) {
|
|
357
|
+
if (key in operationObj) {
|
|
358
|
+
reordered[key] = operationObj[key];
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
// Add remaining keys
|
|
362
|
+
for (const [key, value] of Object.entries(operationObj)) {
|
|
363
|
+
if (!priorityKeys.includes(key)) {
|
|
364
|
+
reordered[key] = value;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return reordered;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Reorder paths object to match the order from overlay
|
|
371
|
+
* Modifies the document in place and returns it
|
|
372
|
+
*/
|
|
373
|
+
export function reorderPaths(doc, pathOrder) {
|
|
374
|
+
// Early return if no paths to reorder
|
|
375
|
+
if (typeof doc !== "object" ||
|
|
376
|
+
doc === null ||
|
|
377
|
+
!("paths" in doc) ||
|
|
378
|
+
pathOrder.length === 0) {
|
|
379
|
+
return doc;
|
|
380
|
+
}
|
|
381
|
+
const docRecord = doc;
|
|
382
|
+
const originalPaths = toRecord(docRecord.paths, "paths");
|
|
383
|
+
const reorderedPaths = {};
|
|
384
|
+
// First, add paths in the order specified by overlay
|
|
385
|
+
for (const targetPath of pathOrder) {
|
|
386
|
+
if (targetPath in originalPaths) {
|
|
387
|
+
reorderedPaths[targetPath] = originalPaths[targetPath];
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
// Then add any remaining paths that weren't in the overlay
|
|
391
|
+
for (const [targetPath, value] of Object.entries(originalPaths)) {
|
|
392
|
+
if (!(targetPath in reorderedPaths)) {
|
|
393
|
+
reorderedPaths[targetPath] = value;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
// Reorder operation properties within each path
|
|
397
|
+
for (const pathItem of Object.values(reorderedPaths)) {
|
|
398
|
+
if (typeof pathItem !== "object" || pathItem === null)
|
|
399
|
+
continue;
|
|
400
|
+
const pathItemRecord = pathItem;
|
|
401
|
+
for (const method of HTTP_METHODS) {
|
|
402
|
+
if (method in pathItemRecord &&
|
|
403
|
+
typeof pathItemRecord[method] === "object" &&
|
|
404
|
+
pathItemRecord[method] !== null) {
|
|
405
|
+
pathItemRecord[method] = reorderOperationProperties(pathItemRecord[method]);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
docRecord.paths = reorderedPaths;
|
|
410
|
+
return doc;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Reorder top-level document properties to ensure proper ordering
|
|
414
|
+
* OpenAPI spec should have: openapi, info, tags, servers, paths, components, etc.
|
|
415
|
+
* Returns a new object with reordered keys
|
|
416
|
+
*/
|
|
417
|
+
export function reorderDocumentProperties(doc) {
|
|
418
|
+
const docObj = toRecord(doc, "reorderDocumentProperties");
|
|
419
|
+
const priorityKeys = ["openapi", "info", "tags"];
|
|
420
|
+
const reordered = {};
|
|
421
|
+
// Add priority keys first
|
|
422
|
+
for (const key of priorityKeys) {
|
|
423
|
+
if (key in docObj) {
|
|
424
|
+
reordered[key] = docObj[key];
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
// Add remaining keys
|
|
428
|
+
for (const [key, value] of Object.entries(docObj)) {
|
|
429
|
+
if (!priorityKeys.includes(key)) {
|
|
430
|
+
reordered[key] = value;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return reordered;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Apply overlay to OpenAPI document
|
|
437
|
+
*
|
|
438
|
+
* Validates both the OpenAPI document and overlay upfront, then applies
|
|
439
|
+
* all actions defined in the overlay to produce a modified OpenAPI document.
|
|
440
|
+
*
|
|
441
|
+
* @param openapi The OpenAPI document to modify (will be validated)
|
|
442
|
+
* @param overlay The overlay document to apply (will be validated)
|
|
443
|
+
* @returns The modified OpenAPI document and statistics about what was applied
|
|
444
|
+
* @throws {Error} if either document is invalid, with actionable error messages
|
|
445
|
+
*
|
|
446
|
+
* @example
|
|
447
|
+
* ```typescript
|
|
448
|
+
* const result = applyOverlay(openapiDoc, overlayDoc);
|
|
449
|
+
* console.log(`Applied ${result.stats.applied} actions`);
|
|
450
|
+
* ```
|
|
451
|
+
*/
|
|
452
|
+
export function applyOverlay(openapi, overlay) {
|
|
453
|
+
// Validate inputs upfront with actionable error messages
|
|
454
|
+
const validatedOverlay = validateOverlayDocument(overlay);
|
|
455
|
+
const validatedOpenApi = validateOpenApiDocument(openapi);
|
|
456
|
+
// Clone the document for modification
|
|
457
|
+
const result = deepClone(validatedOpenApi);
|
|
458
|
+
const stats = { applied: 0, skipped: 0, totalNodes: 0 };
|
|
459
|
+
// Apply each action
|
|
460
|
+
for (const action of validatedOverlay.actions) {
|
|
461
|
+
const { applied, count } = applyAction(result, action);
|
|
462
|
+
if (applied) {
|
|
463
|
+
stats.applied++;
|
|
464
|
+
stats.totalNodes += count;
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
stats.skipped++;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
// Reorder paths to match overlay order
|
|
471
|
+
const pathOrder = extractPathOrder(validatedOverlay);
|
|
472
|
+
reorderPaths(result, pathOrder);
|
|
473
|
+
// Reorder top-level document properties
|
|
474
|
+
const reordered = reorderDocumentProperties(result);
|
|
475
|
+
return { result: reordered, stats };
|
|
476
|
+
}
|
|
477
|
+
//# sourceMappingURL=overlay.js.map
|
|
@@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