swagger-parser-mcp-server 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +127 -206
- package/dist/index.js.map +1 -1
- package/dist/schemas.d.ts +58 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +32 -0
- package/dist/schemas.js.map +1 -0
- package/dist/tests/edgeCases.test.d.ts +2 -0
- package/dist/tests/edgeCases.test.d.ts.map +1 -0
- package/dist/tests/edgeCases.test.js +364 -0
- package/dist/tests/edgeCases.test.js.map +1 -0
- package/dist/tests/integration.test.d.ts +2 -0
- package/dist/tests/integration.test.d.ts.map +1 -0
- package/dist/tests/integration.test.js +382 -0
- package/dist/tests/integration.test.js.map +1 -0
- package/dist/tests/realWorldValidation.test.d.ts +2 -0
- package/dist/tests/realWorldValidation.test.d.ts.map +1 -0
- package/dist/tests/realWorldValidation.test.js +398 -0
- package/dist/tests/realWorldValidation.test.js.map +1 -0
- package/dist/tests/schemaResolver.test.d.ts +2 -0
- package/dist/tests/schemaResolver.test.d.ts.map +1 -0
- package/dist/tests/schemaResolver.test.js +322 -0
- package/dist/tests/schemaResolver.test.js.map +1 -0
- package/dist/utils/schemaResolver.d.ts +34 -0
- package/dist/utils/schemaResolver.d.ts.map +1 -0
- package/dist/utils/schemaResolver.js +255 -0
- package/dist/utils/schemaResolver.js.map +1 -0
- package/dist/utils/swaggerCache.d.ts +53 -0
- package/dist/utils/swaggerCache.d.ts.map +1 -0
- package/dist/utils/swaggerCache.js +146 -0
- package/dist/utils/swaggerCache.js.map +1 -0
- package/dist/utils/types.d.ts +73 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/types.js +20 -0
- package/dist/utils/types.js.map +1 -0
- package/package.json +31 -9
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { SchemaResolver } from '../utils/schemaResolver.js';
|
|
2
|
+
import { CircularReferenceError, MaxDepthExceededError, InvalidReferenceError, } from '../utils/types.js';
|
|
3
|
+
describe('SchemaResolver', () => {
|
|
4
|
+
let resolver;
|
|
5
|
+
let mockSwagger;
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
resolver = new SchemaResolver();
|
|
8
|
+
mockSwagger = {
|
|
9
|
+
openapi: '3.0.0',
|
|
10
|
+
info: { title: 'Test API', version: '1.0.0' },
|
|
11
|
+
paths: {},
|
|
12
|
+
components: {
|
|
13
|
+
schemas: {
|
|
14
|
+
User: {
|
|
15
|
+
type: 'object',
|
|
16
|
+
properties: {
|
|
17
|
+
id: { type: 'string' },
|
|
18
|
+
name: { type: 'string' },
|
|
19
|
+
profile: { $ref: '#/components/schemas/Profile' },
|
|
20
|
+
},
|
|
21
|
+
required: ['id', 'name'],
|
|
22
|
+
},
|
|
23
|
+
Profile: {
|
|
24
|
+
type: 'object',
|
|
25
|
+
properties: {
|
|
26
|
+
bio: { type: 'string' },
|
|
27
|
+
user: { $ref: '#/components/schemas/User' }, // Circular reference
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
SimpleString: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
},
|
|
33
|
+
StringArray: {
|
|
34
|
+
type: 'array',
|
|
35
|
+
items: { type: 'string' },
|
|
36
|
+
},
|
|
37
|
+
NestedArray: {
|
|
38
|
+
type: 'array',
|
|
39
|
+
items: { $ref: '#/components/schemas/User' },
|
|
40
|
+
},
|
|
41
|
+
DeepNested: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
properties: {
|
|
44
|
+
level1: {
|
|
45
|
+
type: 'object',
|
|
46
|
+
properties: {
|
|
47
|
+
level2: {
|
|
48
|
+
type: 'object',
|
|
49
|
+
properties: {
|
|
50
|
+
level3: { $ref: '#/components/schemas/SimpleString' },
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
describe('resolveSchemaReference', () => {
|
|
62
|
+
it('should return null for null/undefined schema', () => {
|
|
63
|
+
expect(resolver.resolveSchemaReference(null, mockSwagger)).toBeNull();
|
|
64
|
+
expect(resolver.resolveSchemaReference(undefined, mockSwagger)).toBeNull();
|
|
65
|
+
});
|
|
66
|
+
it('should resolve simple primitive schema', () => {
|
|
67
|
+
const schema = { type: 'string', format: 'email' };
|
|
68
|
+
const result = resolver.resolveSchemaReference(schema, mockSwagger);
|
|
69
|
+
expect(result).toEqual(schema);
|
|
70
|
+
});
|
|
71
|
+
it('should resolve simple $ref schema', () => {
|
|
72
|
+
const schema = { $ref: '#/components/schemas/SimpleString' };
|
|
73
|
+
const result = resolver.resolveSchemaReference(schema, mockSwagger);
|
|
74
|
+
expect(result).toHaveProperty('$ref', '#/components/schemas/SimpleString');
|
|
75
|
+
expect(result).toHaveProperty('resolved');
|
|
76
|
+
expect(result.resolved).toEqual({ type: 'string' });
|
|
77
|
+
});
|
|
78
|
+
it('should resolve array with primitive items', () => {
|
|
79
|
+
const schema = {
|
|
80
|
+
type: 'array',
|
|
81
|
+
items: { type: 'string' },
|
|
82
|
+
};
|
|
83
|
+
const result = resolver.resolveSchemaReference(schema, mockSwagger);
|
|
84
|
+
expect(result).toEqual({
|
|
85
|
+
type: 'array',
|
|
86
|
+
items: { type: 'string' },
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
it('should resolve array with $ref items', () => {
|
|
90
|
+
const schema = {
|
|
91
|
+
type: 'array',
|
|
92
|
+
items: { $ref: '#/components/schemas/SimpleString' },
|
|
93
|
+
};
|
|
94
|
+
const result = resolver.resolveSchemaReference(schema, mockSwagger);
|
|
95
|
+
expect(result.type).toBe('array');
|
|
96
|
+
expect(result.items).toHaveProperty('$ref');
|
|
97
|
+
expect(result.items.resolved).toEqual({ type: 'string' });
|
|
98
|
+
});
|
|
99
|
+
it('should resolve object with primitive properties', () => {
|
|
100
|
+
const schema = {
|
|
101
|
+
type: 'object',
|
|
102
|
+
properties: {
|
|
103
|
+
name: { type: 'string' },
|
|
104
|
+
age: { type: 'number' },
|
|
105
|
+
},
|
|
106
|
+
required: ['name'],
|
|
107
|
+
};
|
|
108
|
+
const result = resolver.resolveSchemaReference(schema, mockSwagger);
|
|
109
|
+
expect(result).toEqual({
|
|
110
|
+
type: 'object',
|
|
111
|
+
properties: {
|
|
112
|
+
name: { type: 'string' },
|
|
113
|
+
age: { type: 'number' },
|
|
114
|
+
},
|
|
115
|
+
required: ['name'],
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
it('should handle circular references gracefully with default options', () => {
|
|
119
|
+
const schema = { $ref: '#/components/schemas/User' };
|
|
120
|
+
// With default options, should throw CircularReferenceError
|
|
121
|
+
expect(() => {
|
|
122
|
+
resolver.resolveSchemaReference(schema, mockSwagger);
|
|
123
|
+
}).toThrow(CircularReferenceError);
|
|
124
|
+
});
|
|
125
|
+
it('should handle circular references with includeCircularRefs=false', () => {
|
|
126
|
+
const resolverNoCircular = new SchemaResolver({ includeCircularRefs: false });
|
|
127
|
+
const schema = { $ref: '#/components/schemas/User' };
|
|
128
|
+
const result = resolverNoCircular.resolveSchemaReference(schema, mockSwagger);
|
|
129
|
+
// Should not throw, and should include circular reference handling
|
|
130
|
+
expect(result).toHaveProperty('$ref');
|
|
131
|
+
// The result should be a resolved object, but with circular references handled
|
|
132
|
+
expect(result.resolved).toBeDefined();
|
|
133
|
+
expect(result.resolved.type).toBe('object');
|
|
134
|
+
// Check that circular references within the schema are handled
|
|
135
|
+
const resultStr = JSON.stringify(result.resolved);
|
|
136
|
+
expect(resultStr).toContain('[Circular Reference]');
|
|
137
|
+
});
|
|
138
|
+
it('should respect max depth limit', () => {
|
|
139
|
+
const resolverShallowDepth = new SchemaResolver({ maxDepth: 2, includeCircularRefs: false });
|
|
140
|
+
const schema = { $ref: '#/components/schemas/DeepNested' };
|
|
141
|
+
const result = resolverShallowDepth.resolveSchemaReference(schema, mockSwagger);
|
|
142
|
+
// Should handle depth limit gracefully
|
|
143
|
+
expect(result).toBeDefined();
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
describe('resolveRef', () => {
|
|
147
|
+
it('should resolve valid reference path', () => {
|
|
148
|
+
const result = resolver.resolveRef('#/components/schemas/SimpleString', mockSwagger);
|
|
149
|
+
expect(result).toEqual({ type: 'string' });
|
|
150
|
+
});
|
|
151
|
+
it('should throw InvalidReferenceError for malformed reference', () => {
|
|
152
|
+
expect(() => {
|
|
153
|
+
resolver.resolveRef('invalid-ref', mockSwagger);
|
|
154
|
+
}).toThrow(InvalidReferenceError);
|
|
155
|
+
});
|
|
156
|
+
it('should throw InvalidReferenceError for non-existent reference', () => {
|
|
157
|
+
expect(() => {
|
|
158
|
+
resolver.resolveRef('#/components/schemas/NonExistent', mockSwagger);
|
|
159
|
+
}).toThrow(InvalidReferenceError);
|
|
160
|
+
});
|
|
161
|
+
it('should detect circular reference', () => {
|
|
162
|
+
expect(() => {
|
|
163
|
+
resolver.resolveRef('#/components/schemas/User', mockSwagger);
|
|
164
|
+
}).toThrow(CircularReferenceError);
|
|
165
|
+
});
|
|
166
|
+
it('should resolve nested object properties', () => {
|
|
167
|
+
// Add a non-circular schema for this test
|
|
168
|
+
mockSwagger.components.schemas.Address = {
|
|
169
|
+
type: 'object',
|
|
170
|
+
properties: {
|
|
171
|
+
street: { type: 'string' },
|
|
172
|
+
city: { type: 'string' },
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
const result = resolver.resolveRef('#/components/schemas/Address', mockSwagger);
|
|
176
|
+
expect(result.type).toBe('object');
|
|
177
|
+
expect(result.properties).toHaveProperty('street');
|
|
178
|
+
expect(result.properties).toHaveProperty('city');
|
|
179
|
+
});
|
|
180
|
+
it('should resolve array items recursively', () => {
|
|
181
|
+
const result = resolver.resolveRef('#/components/schemas/StringArray', mockSwagger);
|
|
182
|
+
expect(result).toEqual({
|
|
183
|
+
type: 'array',
|
|
184
|
+
items: { type: 'string' },
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
describe('validateRef', () => {
|
|
189
|
+
it('should return true for valid reference', () => {
|
|
190
|
+
expect(resolver.validateRef('#/components/schemas/SimpleString', mockSwagger)).toBe(true);
|
|
191
|
+
});
|
|
192
|
+
it('should return false for invalid reference', () => {
|
|
193
|
+
expect(resolver.validateRef('#/components/schemas/NonExistent', mockSwagger)).toBe(false);
|
|
194
|
+
});
|
|
195
|
+
it('should return false for malformed reference', () => {
|
|
196
|
+
expect(resolver.validateRef('invalid-ref', mockSwagger)).toBe(false);
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
describe('getCleanResolvedSchema', () => {
|
|
200
|
+
it('should return resolved schema for non-circular reference', () => {
|
|
201
|
+
const resolvedSchema = {
|
|
202
|
+
$ref: '#/components/schemas/SimpleString',
|
|
203
|
+
resolved: { type: 'string' },
|
|
204
|
+
isCircular: false,
|
|
205
|
+
};
|
|
206
|
+
const result = resolver.getCleanResolvedSchema(resolvedSchema);
|
|
207
|
+
expect(result).toEqual({ type: 'string' });
|
|
208
|
+
});
|
|
209
|
+
it('should return circular reference marker for circular schema', () => {
|
|
210
|
+
const resolvedSchema = {
|
|
211
|
+
$ref: '#/components/schemas/User',
|
|
212
|
+
resolved: '[Circular Reference]',
|
|
213
|
+
isCircular: true,
|
|
214
|
+
circularRef: '#/components/schemas/User',
|
|
215
|
+
};
|
|
216
|
+
const result = resolver.getCleanResolvedSchema(resolvedSchema);
|
|
217
|
+
expect(result).toEqual({
|
|
218
|
+
$ref: '#/components/schemas/User',
|
|
219
|
+
circularReference: true,
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
describe('Edge Cases', () => {
|
|
224
|
+
it('should handle empty components section', () => {
|
|
225
|
+
const emptySwagger = {
|
|
226
|
+
openapi: '3.0.0',
|
|
227
|
+
info: { title: 'Empty API', version: '1.0.0' },
|
|
228
|
+
paths: {},
|
|
229
|
+
};
|
|
230
|
+
expect(() => {
|
|
231
|
+
resolver.resolveRef('#/components/schemas/NonExistent', emptySwagger);
|
|
232
|
+
}).toThrow(InvalidReferenceError);
|
|
233
|
+
});
|
|
234
|
+
it('should handle schema with no properties', () => {
|
|
235
|
+
const schema = { type: 'object' };
|
|
236
|
+
const result = resolver.resolveSchemaReference(schema, mockSwagger);
|
|
237
|
+
expect(result).toEqual({ type: 'object' });
|
|
238
|
+
});
|
|
239
|
+
it('should handle array without items', () => {
|
|
240
|
+
const schema = { type: 'array' };
|
|
241
|
+
const result = resolver.resolveSchemaReference(schema, mockSwagger);
|
|
242
|
+
expect(result).toEqual({ type: 'array' });
|
|
243
|
+
});
|
|
244
|
+
it('should handle very deep nesting without circular references', () => {
|
|
245
|
+
// Create a deep but non-circular schema
|
|
246
|
+
const deepSchema = {
|
|
247
|
+
type: 'object',
|
|
248
|
+
properties: {
|
|
249
|
+
level1: {
|
|
250
|
+
type: 'object',
|
|
251
|
+
properties: {
|
|
252
|
+
level2: {
|
|
253
|
+
type: 'object',
|
|
254
|
+
properties: {
|
|
255
|
+
level3: {
|
|
256
|
+
type: 'object',
|
|
257
|
+
properties: {
|
|
258
|
+
level4: {
|
|
259
|
+
type: 'object',
|
|
260
|
+
properties: {
|
|
261
|
+
value: { type: 'string' },
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
};
|
|
272
|
+
const result = resolver.resolveSchemaReference(deepSchema, mockSwagger);
|
|
273
|
+
expect(result.type).toBe('object');
|
|
274
|
+
expect(result.properties.level1.type).toBe('object');
|
|
275
|
+
});
|
|
276
|
+
it('should handle maximum depth exceeded with includeCircularRefs=true', () => {
|
|
277
|
+
const shallowResolver = new SchemaResolver({ maxDepth: 1, includeCircularRefs: true });
|
|
278
|
+
expect(() => {
|
|
279
|
+
shallowResolver.resolveRef('#/components/schemas/DeepNested', mockSwagger);
|
|
280
|
+
}).toThrow(MaxDepthExceededError);
|
|
281
|
+
});
|
|
282
|
+
it('should handle custom circular reference placeholder', () => {
|
|
283
|
+
const customPlaceholderResolver = new SchemaResolver({
|
|
284
|
+
includeCircularRefs: false,
|
|
285
|
+
circularRefPlaceholder: 'CUSTOM_CIRCULAR_REF',
|
|
286
|
+
});
|
|
287
|
+
const schema = { $ref: '#/components/schemas/User' };
|
|
288
|
+
const result = customPlaceholderResolver.resolveSchemaReference(schema, mockSwagger);
|
|
289
|
+
// Check that the custom placeholder is used for circular references
|
|
290
|
+
const resultStr = JSON.stringify(result.resolved);
|
|
291
|
+
expect(resultStr).toContain('CUSTOM_CIRCULAR_REF');
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
describe('Performance and Resource Management', () => {
|
|
295
|
+
it('should handle large number of non-circular references efficiently', () => {
|
|
296
|
+
// Create a schema with many properties but no circular references
|
|
297
|
+
const largeSchema = {
|
|
298
|
+
type: 'object',
|
|
299
|
+
properties: {},
|
|
300
|
+
};
|
|
301
|
+
// Add 100 simple properties
|
|
302
|
+
for (let i = 0; i < 100; i++) {
|
|
303
|
+
largeSchema.properties[`prop${i}`] = { type: 'string' };
|
|
304
|
+
}
|
|
305
|
+
const startTime = Date.now();
|
|
306
|
+
const result = resolver.resolveSchemaReference(largeSchema, mockSwagger);
|
|
307
|
+
const endTime = Date.now();
|
|
308
|
+
expect(result).toBeDefined();
|
|
309
|
+
expect(endTime - startTime).toBeLessThan(1000); // Should complete within 1 second
|
|
310
|
+
expect(Object.keys(result.properties)).toHaveLength(100);
|
|
311
|
+
});
|
|
312
|
+
it('should detect circular references quickly', () => {
|
|
313
|
+
const startTime = Date.now();
|
|
314
|
+
expect(() => {
|
|
315
|
+
resolver.resolveRef('#/components/schemas/User', mockSwagger);
|
|
316
|
+
}).toThrow(CircularReferenceError);
|
|
317
|
+
const endTime = Date.now();
|
|
318
|
+
expect(endTime - startTime).toBeLessThan(100); // Should fail fast
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
//# sourceMappingURL=schemaResolver.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaResolver.test.js","sourceRoot":"","sources":["../../src/tests/schemaResolver.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAEL,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,IAAI,QAAwB,CAAC;IAC7B,IAAI,WAA4B,CAAC;IAEjC,UAAU,CAAC,GAAG,EAAE;QACd,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC;QAChC,WAAW,GAAG;YACZ,OAAO,EAAE,OAAO;YAChB,IAAI,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE;YAC7C,KAAK,EAAE,EAAE;YACT,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,IAAI,EAAE;wBACJ,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;4BACtB,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;4BACxB,OAAO,EAAE,EAAE,IAAI,EAAE,8BAA8B,EAAE;yBAClD;wBACD,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC;qBACzB;oBACD,OAAO,EAAE;wBACP,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;4BACvB,IAAI,EAAE,EAAE,IAAI,EAAE,2BAA2B,EAAE,EAAE,qBAAqB;yBACnE;qBACF;oBACD,YAAY,EAAE;wBACZ,IAAI,EAAE,QAAQ;qBACf;oBACD,WAAW,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C7B,MAAM,MAAM,GAAG,QAAQ,CAAC,sBAAsB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YACzE,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAE3B,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;YAC7B,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,kCAAkC;YAClF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;YACnD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAE7B,MAAM,CAAC,GAAG,EAAE;gBACV,QAAQ,CAAC,UAAU,CAAC,2BAA2B,EAAE,WAAW,CAAC,CAAC;YAChE,CAAC,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;YAEnC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAC3B,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,mBAAmB;QACpE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { OpenAPIDocument, SchemaResolutionContext, ResolvedSchema, SchemaResolverOptions } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Schema resolver class that handles OpenAPI schema resolution with circular reference protection
|
|
4
|
+
*/
|
|
5
|
+
export declare class SchemaResolver {
|
|
6
|
+
private options;
|
|
7
|
+
private readonly defaultOptions;
|
|
8
|
+
constructor(options?: SchemaResolverOptions);
|
|
9
|
+
/**
|
|
10
|
+
* Resolves a schema reference with circular reference protection
|
|
11
|
+
*/
|
|
12
|
+
resolveSchemaReference(schema: any, swagger: OpenAPIDocument, context?: SchemaResolutionContext): any;
|
|
13
|
+
/**
|
|
14
|
+
* Resolves a $ref path to the actual schema object
|
|
15
|
+
*/
|
|
16
|
+
resolveRef(ref: string, swagger: OpenAPIDocument, context?: SchemaResolutionContext): any;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new resolution context
|
|
19
|
+
*/
|
|
20
|
+
private createContext;
|
|
21
|
+
/**
|
|
22
|
+
* Parses a $ref path and navigates to the referenced schema
|
|
23
|
+
*/
|
|
24
|
+
private parseRefPath;
|
|
25
|
+
/**
|
|
26
|
+
* Utility method to get a clean resolved schema without internal metadata
|
|
27
|
+
*/
|
|
28
|
+
getCleanResolvedSchema(resolvedSchema: ResolvedSchema): any;
|
|
29
|
+
/**
|
|
30
|
+
* Validates if a reference path exists in the OpenAPI document
|
|
31
|
+
*/
|
|
32
|
+
validateRef(ref: string, swagger: OpenAPIDocument): boolean;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=schemaResolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaResolver.d.ts","sourceRoot":"","sources":["../../src/utils/schemaResolver.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,cAAc,EACd,qBAAqB,EAItB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,qBAAa,cAAc;IAOb,OAAO,CAAC,OAAO;IAN3B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAI7B;gBAEkB,OAAO,GAAE,qBAA0B;IAIvD;;OAEG;IAEI,sBAAsB,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,GAAG;IA0G5G;;OAEG;IAEI,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,GAAG;IA2GhG;;OAEG;IACH,OAAO,CAAC,aAAa;IAQrB;;OAEG;IAEH,OAAO,CAAC,YAAY;IAwBpB;;OAEG;IAEI,sBAAsB,CAAC,cAAc,EAAE,cAAc,GAAG,GAAG;IAUlE;;OAEG;IACI,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO;CAQnE"}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { CircularReferenceError, MaxDepthExceededError, InvalidReferenceError, } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Schema resolver class that handles OpenAPI schema resolution with circular reference protection
|
|
4
|
+
*/
|
|
5
|
+
export class SchemaResolver {
|
|
6
|
+
options;
|
|
7
|
+
defaultOptions = {
|
|
8
|
+
maxDepth: 10,
|
|
9
|
+
includeCircularRefs: true,
|
|
10
|
+
circularRefPlaceholder: '[Circular Reference]',
|
|
11
|
+
};
|
|
12
|
+
constructor(options = {}) {
|
|
13
|
+
this.options = options;
|
|
14
|
+
this.options = { ...this.defaultOptions, ...options };
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Resolves a schema reference with circular reference protection
|
|
18
|
+
*/
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
+
resolveSchemaReference(schema, swagger, context) {
|
|
21
|
+
if (!schema)
|
|
22
|
+
return null;
|
|
23
|
+
const ctx = context || this.createContext();
|
|
24
|
+
// Check depth limit
|
|
25
|
+
if (ctx.currentDepth >= ctx.maxDepth) {
|
|
26
|
+
if (this.options.includeCircularRefs) {
|
|
27
|
+
throw new MaxDepthExceededError(ctx.maxDepth, JSON.stringify(schema));
|
|
28
|
+
}
|
|
29
|
+
return this.options.circularRefPlaceholder;
|
|
30
|
+
}
|
|
31
|
+
// Handle $ref resolution
|
|
32
|
+
if (schema.$ref) {
|
|
33
|
+
try {
|
|
34
|
+
const resolved = this.resolveRef(schema.$ref, swagger, ctx);
|
|
35
|
+
return {
|
|
36
|
+
$ref: schema.$ref,
|
|
37
|
+
resolved,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (error instanceof CircularReferenceError) {
|
|
42
|
+
// If includeCircularRefs is true, re-throw the error
|
|
43
|
+
if (this.options.includeCircularRefs) {
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
// Otherwise, return a placeholder
|
|
47
|
+
return {
|
|
48
|
+
$ref: schema.$ref,
|
|
49
|
+
resolved: this.options.circularRefPlaceholder,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// Handle array type
|
|
56
|
+
if (schema.type === 'array' && schema.items) {
|
|
57
|
+
return {
|
|
58
|
+
type: 'array',
|
|
59
|
+
items: this.resolveSchemaReference(schema.items, swagger, {
|
|
60
|
+
...ctx,
|
|
61
|
+
currentDepth: ctx.currentDepth + 1,
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
// Handle object type with properties
|
|
66
|
+
if (schema.type === 'object' && schema.properties) {
|
|
67
|
+
const properties = {};
|
|
68
|
+
Object.entries(schema.properties).forEach(([key, value]) => {
|
|
69
|
+
properties[key] = this.resolveSchemaReference(value, swagger, {
|
|
70
|
+
...ctx,
|
|
71
|
+
currentDepth: ctx.currentDepth + 1,
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
return {
|
|
75
|
+
type: 'object',
|
|
76
|
+
properties,
|
|
77
|
+
required: schema.required,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
// Handle composition keywords (allOf, anyOf, oneOf)
|
|
81
|
+
if (schema.allOf || schema.anyOf || schema.oneOf) {
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
83
|
+
const result = { ...schema };
|
|
84
|
+
if (schema.allOf) {
|
|
85
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
86
|
+
result.allOf = schema.allOf.map((subSchema) => this.resolveSchemaReference(subSchema, swagger, {
|
|
87
|
+
...ctx,
|
|
88
|
+
currentDepth: ctx.currentDepth + 1,
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
if (schema.anyOf) {
|
|
92
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
93
|
+
result.anyOf = schema.anyOf.map((subSchema) => this.resolveSchemaReference(subSchema, swagger, {
|
|
94
|
+
...ctx,
|
|
95
|
+
currentDepth: ctx.currentDepth + 1,
|
|
96
|
+
}));
|
|
97
|
+
}
|
|
98
|
+
if (schema.oneOf) {
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
100
|
+
result.oneOf = schema.oneOf.map((subSchema) => this.resolveSchemaReference(subSchema, swagger, {
|
|
101
|
+
...ctx,
|
|
102
|
+
currentDepth: ctx.currentDepth + 1,
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
// Return primitive types as-is
|
|
108
|
+
return schema;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Resolves a $ref path to the actual schema object
|
|
112
|
+
*/
|
|
113
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
114
|
+
resolveRef(ref, swagger, context) {
|
|
115
|
+
const ctx = context || this.createContext();
|
|
116
|
+
// Check for circular reference
|
|
117
|
+
if (ctx.visitedRefs.has(ref)) {
|
|
118
|
+
if (this.options.includeCircularRefs) {
|
|
119
|
+
throw new CircularReferenceError(ref, Array.from(ctx.visitedRefs));
|
|
120
|
+
}
|
|
121
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
122
|
+
const result = {
|
|
123
|
+
$ref: ref,
|
|
124
|
+
};
|
|
125
|
+
result[this.options.circularRefPlaceholder] = true;
|
|
126
|
+
return result;
|
|
127
|
+
}
|
|
128
|
+
// Check depth limit
|
|
129
|
+
if (ctx.currentDepth >= ctx.maxDepth) {
|
|
130
|
+
if (this.options.includeCircularRefs) {
|
|
131
|
+
throw new MaxDepthExceededError(ctx.maxDepth, ref);
|
|
132
|
+
}
|
|
133
|
+
return this.options.circularRefPlaceholder;
|
|
134
|
+
}
|
|
135
|
+
// Add current ref to visited set
|
|
136
|
+
const newContext = {
|
|
137
|
+
...ctx,
|
|
138
|
+
visitedRefs: new Set([...ctx.visitedRefs, ref]),
|
|
139
|
+
currentDepth: ctx.currentDepth + 1,
|
|
140
|
+
};
|
|
141
|
+
try {
|
|
142
|
+
// Parse the reference path
|
|
143
|
+
const resolved = this.parseRefPath(ref, swagger);
|
|
144
|
+
// If the resolved schema has a $ref, recursively resolve it
|
|
145
|
+
if (resolved.$ref) {
|
|
146
|
+
return this.resolveRef(resolved.$ref, swagger, newContext);
|
|
147
|
+
}
|
|
148
|
+
// Handle object properties
|
|
149
|
+
if (resolved.type === 'object' && resolved.properties) {
|
|
150
|
+
const resolvedProperties = {};
|
|
151
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
152
|
+
Object.entries(resolved.properties).forEach(([key, value]) => {
|
|
153
|
+
resolvedProperties[key] = this.resolveSchemaReference(value, swagger, newContext);
|
|
154
|
+
});
|
|
155
|
+
return {
|
|
156
|
+
...resolved,
|
|
157
|
+
properties: resolvedProperties,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
// Handle array items
|
|
161
|
+
if (resolved.type === 'array' && resolved.items) {
|
|
162
|
+
return {
|
|
163
|
+
...resolved,
|
|
164
|
+
items: this.resolveSchemaReference(resolved.items, swagger, newContext),
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
// Handle composition keywords (allOf, anyOf, oneOf)
|
|
168
|
+
if (resolved.allOf || resolved.anyOf || resolved.oneOf) {
|
|
169
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
170
|
+
const result = { ...resolved };
|
|
171
|
+
if (resolved.allOf) {
|
|
172
|
+
// NOTE: allOf is any[] type because OpenAPI schemas can contain arbitrary composition structures
|
|
173
|
+
result.allOf = resolved.allOf.map((subSchema // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
174
|
+
) => this.resolveSchemaReference(subSchema, swagger, newContext));
|
|
175
|
+
}
|
|
176
|
+
if (resolved.anyOf) {
|
|
177
|
+
// NOTE: anyOf is any[] type because OpenAPI schemas can contain arbitrary composition structures
|
|
178
|
+
result.anyOf = resolved.anyOf.map((subSchema // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
179
|
+
) => this.resolveSchemaReference(subSchema, swagger, newContext));
|
|
180
|
+
}
|
|
181
|
+
if (resolved.oneOf) {
|
|
182
|
+
// NOTE: oneOf is any[] type because OpenAPI schemas can contain arbitrary composition structures
|
|
183
|
+
result.oneOf = resolved.oneOf.map((subSchema // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
184
|
+
) => this.resolveSchemaReference(subSchema, swagger, newContext));
|
|
185
|
+
}
|
|
186
|
+
return result;
|
|
187
|
+
}
|
|
188
|
+
return resolved;
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
// Remove ref from visited set on error to allow retry
|
|
192
|
+
newContext.visitedRefs.delete(ref);
|
|
193
|
+
throw error;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Creates a new resolution context
|
|
198
|
+
*/
|
|
199
|
+
createContext() {
|
|
200
|
+
return {
|
|
201
|
+
visitedRefs: new Set(),
|
|
202
|
+
maxDepth: this.options.maxDepth ?? 10,
|
|
203
|
+
currentDepth: 0,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Parses a $ref path and navigates to the referenced schema
|
|
208
|
+
*/
|
|
209
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
210
|
+
parseRefPath(ref, swagger) {
|
|
211
|
+
if (!ref.startsWith('#/')) {
|
|
212
|
+
throw new InvalidReferenceError(`Unsupported reference format: ${ref}`);
|
|
213
|
+
}
|
|
214
|
+
const parts = ref.split('/').slice(1); // Remove the '#' part
|
|
215
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
216
|
+
let current = swagger;
|
|
217
|
+
for (const part of parts) {
|
|
218
|
+
if (!current || typeof current !== 'object') {
|
|
219
|
+
throw new InvalidReferenceError(`Cannot resolve reference: ${ref} (failed at ${part})`);
|
|
220
|
+
}
|
|
221
|
+
// NOTE: Dynamic property access on any type to traverse OpenAPI document structure
|
|
222
|
+
current = current[part];
|
|
223
|
+
if (current === undefined) {
|
|
224
|
+
throw new InvalidReferenceError(`Cannot resolve reference: ${ref} (${part} not found)`);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return current;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Utility method to get a clean resolved schema without internal metadata
|
|
231
|
+
*/
|
|
232
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
233
|
+
getCleanResolvedSchema(resolvedSchema) {
|
|
234
|
+
if (resolvedSchema.isCircular) {
|
|
235
|
+
return {
|
|
236
|
+
$ref: resolvedSchema.$ref,
|
|
237
|
+
circularReference: true,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
return resolvedSchema.resolved;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Validates if a reference path exists in the OpenAPI document
|
|
244
|
+
*/
|
|
245
|
+
validateRef(ref, swagger) {
|
|
246
|
+
try {
|
|
247
|
+
this.parseRefPath(ref, swagger);
|
|
248
|
+
return true;
|
|
249
|
+
}
|
|
250
|
+
catch {
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
//# sourceMappingURL=schemaResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaResolver.js","sourceRoot":"","sources":["../../src/utils/schemaResolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,sBAAsB,EACtB,qBAAqB,EACrB,qB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