@furystack/rest 8.0.42 → 8.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/README.md +37 -1
  3. package/esm/api-endpoint-schema.d.ts +47 -2
  4. package/esm/api-endpoint-schema.d.ts.map +1 -1
  5. package/esm/index.d.ts +4 -1
  6. package/esm/index.d.ts.map +1 -1
  7. package/esm/index.js +4 -1
  8. package/esm/index.js.map +1 -1
  9. package/esm/openapi-document.d.ts +303 -0
  10. package/esm/openapi-document.d.ts.map +1 -0
  11. package/esm/openapi-document.js +2 -0
  12. package/esm/openapi-document.js.map +1 -0
  13. package/esm/openapi-resolve-refs.d.ts +20 -0
  14. package/esm/openapi-resolve-refs.d.ts.map +1 -0
  15. package/esm/openapi-resolve-refs.js +68 -0
  16. package/esm/openapi-resolve-refs.js.map +1 -0
  17. package/esm/openapi-resolve-refs.spec.d.ts +2 -0
  18. package/esm/openapi-resolve-refs.spec.d.ts.map +1 -0
  19. package/esm/openapi-resolve-refs.spec.js +294 -0
  20. package/esm/openapi-resolve-refs.spec.js.map +1 -0
  21. package/esm/openapi-to-rest-api.d.ts +197 -0
  22. package/esm/openapi-to-rest-api.d.ts.map +1 -0
  23. package/esm/openapi-to-rest-api.js +2 -0
  24. package/esm/openapi-to-rest-api.js.map +1 -0
  25. package/esm/openapi-to-rest-api.spec.d.ts +2 -0
  26. package/esm/openapi-to-rest-api.spec.d.ts.map +1 -0
  27. package/esm/openapi-to-rest-api.spec.js +665 -0
  28. package/esm/openapi-to-rest-api.spec.js.map +1 -0
  29. package/esm/openapi-to-schema.d.ts +24 -0
  30. package/esm/openapi-to-schema.d.ts.map +1 -0
  31. package/esm/openapi-to-schema.js +145 -0
  32. package/esm/openapi-to-schema.js.map +1 -0
  33. package/esm/openapi-to-schema.spec.d.ts +2 -0
  34. package/esm/openapi-to-schema.spec.d.ts.map +1 -0
  35. package/esm/openapi-to-schema.spec.js +610 -0
  36. package/esm/openapi-to-schema.spec.js.map +1 -0
  37. package/esm/rest-api.d.ts +21 -4
  38. package/esm/rest-api.d.ts.map +1 -1
  39. package/esm/swagger-document.d.ts +2 -195
  40. package/esm/swagger-document.d.ts.map +1 -1
  41. package/esm/swagger-document.js +2 -1
  42. package/esm/swagger-document.js.map +1 -1
  43. package/package.json +3 -3
  44. package/src/api-endpoint-schema.ts +56 -3
  45. package/src/index.ts +4 -1
  46. package/src/openapi-document.ts +328 -0
  47. package/src/openapi-resolve-refs.spec.ts +324 -0
  48. package/src/openapi-resolve-refs.ts +71 -0
  49. package/src/openapi-to-rest-api.spec.ts +823 -0
  50. package/src/openapi-to-rest-api.ts +263 -0
  51. package/src/openapi-to-schema.spec.ts +707 -0
  52. package/src/openapi-to-schema.ts +163 -0
  53. package/src/rest-api.ts +26 -5
  54. package/src/swagger-document.ts +2 -220
@@ -0,0 +1,665 @@
1
+ import { describe, it, expectTypeOf } from 'vitest';
2
+ describe('ConvertOpenApiPath', () => {
3
+ it('Should convert single {param} to :param', () => {
4
+ expectTypeOf().toEqualTypeOf();
5
+ });
6
+ it('Should convert multiple params', () => {
7
+ expectTypeOf().toEqualTypeOf();
8
+ });
9
+ it('Should pass through paths without params', () => {
10
+ expectTypeOf().toEqualTypeOf();
11
+ });
12
+ it('Should handle root path', () => {
13
+ expectTypeOf().toEqualTypeOf();
14
+ });
15
+ it('Should handle param at the end', () => {
16
+ expectTypeOf().toEqualTypeOf();
17
+ });
18
+ it('Should handle adjacent segments with params', () => {
19
+ expectTypeOf().toEqualTypeOf();
20
+ });
21
+ });
22
+ describe('JsonSchemaToType', () => {
23
+ describe('Primitive types', () => {
24
+ it('Should map string', () => {
25
+ expectTypeOf().toEqualTypeOf();
26
+ });
27
+ it('Should map number', () => {
28
+ expectTypeOf().toEqualTypeOf();
29
+ });
30
+ it('Should map integer to number', () => {
31
+ expectTypeOf().toEqualTypeOf();
32
+ });
33
+ it('Should map boolean', () => {
34
+ expectTypeOf().toEqualTypeOf();
35
+ });
36
+ it('Should map null', () => {
37
+ expectTypeOf().toEqualTypeOf();
38
+ });
39
+ });
40
+ describe('String enums', () => {
41
+ it('Should map string enum to union', () => {
42
+ expectTypeOf().toEqualTypeOf();
43
+ });
44
+ it('Should map single-value enum', () => {
45
+ expectTypeOf().toEqualTypeOf();
46
+ });
47
+ });
48
+ describe('Arrays', () => {
49
+ it('Should map string array', () => {
50
+ expectTypeOf().toEqualTypeOf();
51
+ });
52
+ it('Should map number array', () => {
53
+ expectTypeOf().toEqualTypeOf();
54
+ });
55
+ it('Should map nested object array', () => {
56
+ expectTypeOf().toEqualTypeOf();
57
+ });
58
+ });
59
+ describe('Objects', () => {
60
+ it('Should map object with all-optional properties', () => {
61
+ expectTypeOf().toEqualTypeOf();
62
+ });
63
+ it('Should map object with required properties', () => {
64
+ expectTypeOf().toEqualTypeOf();
65
+ });
66
+ it('Should map object with all required properties', () => {
67
+ expectTypeOf().toHaveProperty('name');
68
+ expectTypeOf().toEqualTypeOf();
69
+ expectTypeOf().toEqualTypeOf();
70
+ });
71
+ it('Should map object without properties to Record<string, unknown>', () => {
72
+ expectTypeOf().toEqualTypeOf();
73
+ });
74
+ });
75
+ describe('Fallback', () => {
76
+ it('Should return unknown for unrecognized schemas', () => {
77
+ expectTypeOf().toEqualTypeOf();
78
+ });
79
+ it('Should return unknown for empty object', () => {
80
+ expectTypeOf().toEqualTypeOf();
81
+ });
82
+ });
83
+ });
84
+ describe('OpenApiToRestApi', () => {
85
+ describe('HTTP methods', () => {
86
+ it('Should extract GET endpoints', () => {
87
+ const doc = {
88
+ openapi: '3.1.0',
89
+ info: { title: 'Test', version: '1.0.0' },
90
+ paths: {
91
+ '/items': { get: { responses: { '200': { description: 'OK' } } } },
92
+ },
93
+ };
94
+ expectTypeOf().toExtend();
95
+ expectTypeOf().toHaveProperty('GET');
96
+ });
97
+ it('Should extract POST endpoints', () => {
98
+ const doc = {
99
+ openapi: '3.1.0',
100
+ info: { title: 'Test', version: '1.0.0' },
101
+ paths: {
102
+ '/items': { post: { responses: { '201': { description: 'Created' } } } },
103
+ },
104
+ };
105
+ expectTypeOf().toHaveProperty('POST');
106
+ });
107
+ it('Should extract PUT endpoints', () => {
108
+ const doc = {
109
+ openapi: '3.1.0',
110
+ info: { title: 'Test', version: '1.0.0' },
111
+ paths: {
112
+ '/items/{id}': { put: { responses: { '200': { description: 'OK' } } } },
113
+ },
114
+ };
115
+ expectTypeOf().toHaveProperty('PUT');
116
+ });
117
+ it('Should extract DELETE endpoints', () => {
118
+ const doc = {
119
+ openapi: '3.1.0',
120
+ info: { title: 'Test', version: '1.0.0' },
121
+ paths: {
122
+ '/items/{id}': { delete: { responses: { '200': { description: 'OK' } } } },
123
+ },
124
+ };
125
+ expectTypeOf().toHaveProperty('DELETE');
126
+ });
127
+ it('Should extract PATCH endpoints', () => {
128
+ const doc = {
129
+ openapi: '3.1.0',
130
+ info: { title: 'Test', version: '1.0.0' },
131
+ paths: {
132
+ '/items/{id}': { patch: { responses: { '200': { description: 'OK' } } } },
133
+ },
134
+ };
135
+ expectTypeOf().toHaveProperty('PATCH');
136
+ });
137
+ it('Should extract HEAD endpoints', () => {
138
+ const doc = {
139
+ openapi: '3.1.0',
140
+ info: { title: 'Test', version: '1.0.0' },
141
+ paths: {
142
+ '/items': { head: { responses: { '200': { description: 'OK' } } } },
143
+ },
144
+ };
145
+ expectTypeOf().toHaveProperty('HEAD');
146
+ });
147
+ it('Should extract OPTIONS endpoints', () => {
148
+ const doc = {
149
+ openapi: '3.1.0',
150
+ info: { title: 'Test', version: '1.0.0' },
151
+ paths: {
152
+ '/items': { options: { responses: { '200': { description: 'OK' } } } },
153
+ },
154
+ };
155
+ expectTypeOf().toHaveProperty('OPTIONS');
156
+ });
157
+ it('Should extract TRACE endpoints', () => {
158
+ const doc = {
159
+ openapi: '3.1.0',
160
+ info: { title: 'Test', version: '1.0.0' },
161
+ paths: {
162
+ '/items': { trace: { responses: { '200': { description: 'OK' } } } },
163
+ },
164
+ };
165
+ expectTypeOf().toHaveProperty('TRACE');
166
+ });
167
+ it('Should handle multiple methods on the same path', () => {
168
+ const doc = {
169
+ openapi: '3.1.0',
170
+ info: { title: 'Test', version: '1.0.0' },
171
+ paths: {
172
+ '/items': {
173
+ get: { responses: { '200': { description: 'OK' } } },
174
+ post: { responses: { '201': { description: 'Created' } } },
175
+ },
176
+ },
177
+ };
178
+ expectTypeOf().toHaveProperty('GET');
179
+ expectTypeOf().toHaveProperty('POST');
180
+ });
181
+ it('Should only include methods that have endpoints', () => {
182
+ const doc = {
183
+ openapi: '3.1.0',
184
+ info: { title: 'Test', version: '1.0.0' },
185
+ paths: {
186
+ '/items': { get: { responses: { '200': { description: 'OK' } } } },
187
+ },
188
+ };
189
+ expectTypeOf().not.toHaveProperty('POST');
190
+ expectTypeOf().not.toHaveProperty('PUT');
191
+ expectTypeOf().not.toHaveProperty('DELETE');
192
+ expectTypeOf().not.toHaveProperty('PATCH');
193
+ });
194
+ });
195
+ describe('Response types', () => {
196
+ it('Should extract typed 200 response', () => {
197
+ const doc = {
198
+ openapi: '3.1.0',
199
+ info: { title: 'Test', version: '1.0.0' },
200
+ paths: {
201
+ '/users': {
202
+ get: {
203
+ responses: {
204
+ '200': {
205
+ description: 'OK',
206
+ content: { 'application/json': { schema: { type: 'array', items: { type: 'string' } } } },
207
+ },
208
+ },
209
+ },
210
+ },
211
+ },
212
+ };
213
+ expectTypeOf().toExtend();
214
+ });
215
+ it('Should extract typed 201 response', () => {
216
+ const doc = {
217
+ openapi: '3.1.0',
218
+ info: { title: 'Test', version: '1.0.0' },
219
+ paths: {
220
+ '/users': {
221
+ post: {
222
+ responses: {
223
+ '201': {
224
+ description: 'Created',
225
+ content: {
226
+ 'application/json': {
227
+ schema: { type: 'object', properties: { id: { type: 'string' } } },
228
+ },
229
+ },
230
+ },
231
+ },
232
+ },
233
+ },
234
+ },
235
+ };
236
+ expectTypeOf().toEqualTypeOf();
237
+ });
238
+ it('Should return unknown for responses without schemas', () => {
239
+ const doc = {
240
+ openapi: '3.1.0',
241
+ info: { title: 'Test', version: '1.0.0' },
242
+ paths: {
243
+ '/health': { get: { responses: { '200': { description: 'OK' } } } },
244
+ },
245
+ };
246
+ expectTypeOf().toEqualTypeOf();
247
+ });
248
+ it('Should return unknown for non-JSON content types', () => {
249
+ const doc = {
250
+ openapi: '3.1.0',
251
+ info: { title: 'Test', version: '1.0.0' },
252
+ paths: {
253
+ '/file': {
254
+ get: {
255
+ responses: {
256
+ '200': {
257
+ description: 'OK',
258
+ content: { 'application/octet-stream': { schema: { type: 'string' } } },
259
+ },
260
+ },
261
+ },
262
+ },
263
+ },
264
+ };
265
+ expectTypeOf().toEqualTypeOf();
266
+ });
267
+ });
268
+ describe('Path parameters', () => {
269
+ it('Should extract single path parameter', () => {
270
+ const doc = {
271
+ openapi: '3.1.0',
272
+ info: { title: 'Test', version: '1.0.0' },
273
+ paths: {
274
+ '/users/{id}': {
275
+ get: { responses: { '200': { description: 'OK' } } },
276
+ },
277
+ },
278
+ };
279
+ expectTypeOf().toHaveProperty('id');
280
+ expectTypeOf().toBeString();
281
+ });
282
+ it('Should extract multiple path parameters', () => {
283
+ const doc = {
284
+ openapi: '3.1.0',
285
+ info: { title: 'Test', version: '1.0.0' },
286
+ paths: {
287
+ '/users/{userId}/posts/{postId}': {
288
+ get: { responses: { '200': { description: 'OK' } } },
289
+ },
290
+ },
291
+ };
292
+ expectTypeOf().toHaveProperty('userId');
293
+ expectTypeOf().toHaveProperty('postId');
294
+ expectTypeOf().toBeString();
295
+ expectTypeOf().toBeString();
296
+ });
297
+ it('Should not have url property for paths without params', () => {
298
+ const doc = {
299
+ openapi: '3.1.0',
300
+ info: { title: 'Test', version: '1.0.0' },
301
+ paths: {
302
+ '/users': {
303
+ get: { responses: { '200': { description: 'OK' } } },
304
+ },
305
+ },
306
+ };
307
+ expectTypeOf().not.toHaveProperty('url');
308
+ });
309
+ });
310
+ describe('Request body', () => {
311
+ it('Should extract JSON request body', () => {
312
+ const doc = {
313
+ openapi: '3.1.0',
314
+ info: { title: 'Test', version: '1.0.0' },
315
+ paths: {
316
+ '/users': {
317
+ post: {
318
+ requestBody: {
319
+ content: {
320
+ 'application/json': {
321
+ schema: {
322
+ type: 'object',
323
+ properties: { name: { type: 'string' }, email: { type: 'string' } },
324
+ required: ['name', 'email'],
325
+ },
326
+ },
327
+ },
328
+ },
329
+ responses: { '201': { description: 'Created' } },
330
+ },
331
+ },
332
+ },
333
+ };
334
+ expectTypeOf().toExtend();
335
+ });
336
+ it('Should not have body property when no request body', () => {
337
+ const doc = {
338
+ openapi: '3.1.0',
339
+ info: { title: 'Test', version: '1.0.0' },
340
+ paths: {
341
+ '/items': {
342
+ get: { responses: { '200': { description: 'OK' } } },
343
+ },
344
+ },
345
+ };
346
+ expectTypeOf().not.toHaveProperty('body');
347
+ });
348
+ });
349
+ describe('Query parameters', () => {
350
+ it('Should extract typed query parameters', () => {
351
+ const doc = {
352
+ openapi: '3.1.0',
353
+ info: { title: 'Test', version: '1.0.0' },
354
+ paths: {
355
+ '/search': {
356
+ get: {
357
+ parameters: [
358
+ { name: 'q', in: 'query', schema: { type: 'string' } },
359
+ { name: 'limit', in: 'query', schema: { type: 'integer' } },
360
+ ],
361
+ responses: { '200': { description: 'OK' } },
362
+ },
363
+ },
364
+ },
365
+ };
366
+ expectTypeOf().toEqualTypeOf();
367
+ });
368
+ it('Should default to string for query params without schema', () => {
369
+ const doc = {
370
+ openapi: '3.1.0',
371
+ info: { title: 'Test', version: '1.0.0' },
372
+ paths: {
373
+ '/search': {
374
+ get: {
375
+ parameters: [{ name: 'q', in: 'query' }],
376
+ responses: { '200': { description: 'OK' } },
377
+ },
378
+ },
379
+ },
380
+ };
381
+ expectTypeOf().toEqualTypeOf();
382
+ });
383
+ it('Should not mix path params into query', () => {
384
+ const doc = {
385
+ openapi: '3.1.0',
386
+ info: { title: 'Test', version: '1.0.0' },
387
+ paths: {
388
+ '/users/{id}': {
389
+ get: {
390
+ parameters: [
391
+ { name: 'id', in: 'path', required: true, schema: { type: 'string' } },
392
+ { name: 'fields', in: 'query', schema: { type: 'string' } },
393
+ ],
394
+ responses: { '200': { description: 'OK' } },
395
+ },
396
+ },
397
+ },
398
+ };
399
+ expectTypeOf().toHaveProperty('fields');
400
+ expectTypeOf().toBeString();
401
+ expectTypeOf().toHaveProperty('id');
402
+ expectTypeOf().toBeString();
403
+ });
404
+ it('Should not have query property when no query parameters', () => {
405
+ const doc = {
406
+ openapi: '3.1.0',
407
+ info: { title: 'Test', version: '1.0.0' },
408
+ paths: {
409
+ '/items': {
410
+ get: {
411
+ parameters: [{ name: 'id', in: 'path', required: true, schema: { type: 'string' } }],
412
+ responses: { '200': { description: 'OK' } },
413
+ },
414
+ },
415
+ },
416
+ };
417
+ expectTypeOf().not.toHaveProperty('query');
418
+ });
419
+ });
420
+ describe('Edge cases', () => {
421
+ it('Should handle document with no paths', () => {
422
+ const doc = {
423
+ openapi: '3.1.0',
424
+ info: { title: 'Test', version: '1.0.0' },
425
+ };
426
+ expectTypeOf().toExtend();
427
+ });
428
+ it('Should handle document with empty paths', () => {
429
+ const doc = {
430
+ openapi: '3.1.0',
431
+ info: { title: 'Test', version: '1.0.0' },
432
+ paths: {},
433
+ };
434
+ expectTypeOf().toExtend();
435
+ });
436
+ it('Should handle multiple paths', () => {
437
+ const doc = {
438
+ openapi: '3.1.0',
439
+ info: { title: 'Test', version: '1.0.0' },
440
+ paths: {
441
+ '/a': { get: { responses: { '200': { description: 'OK' } } } },
442
+ '/b': { get: { responses: { '200': { description: 'OK' } } } },
443
+ '/c': { post: { responses: { '201': { description: 'Created' } } } },
444
+ },
445
+ };
446
+ expectTypeOf().toHaveProperty('/a');
447
+ expectTypeOf().toHaveProperty('/b');
448
+ expectTypeOf().toHaveProperty('/c');
449
+ });
450
+ });
451
+ describe('$ref resolution', () => {
452
+ it('Should resolve $ref in response schema', () => {
453
+ const doc = {
454
+ openapi: '3.1.0',
455
+ info: { title: 'Test', version: '1.0.0' },
456
+ paths: {
457
+ '/users': {
458
+ get: {
459
+ responses: {
460
+ '200': {
461
+ description: 'OK',
462
+ content: {
463
+ 'application/json': { schema: { $ref: '#/components/schemas/User' } },
464
+ },
465
+ },
466
+ },
467
+ },
468
+ },
469
+ },
470
+ components: {
471
+ schemas: {
472
+ User: {
473
+ type: 'object',
474
+ properties: { id: { type: 'string' }, name: { type: 'string' } },
475
+ },
476
+ },
477
+ },
478
+ };
479
+ expectTypeOf().toHaveProperty('id');
480
+ expectTypeOf().toHaveProperty('name');
481
+ });
482
+ it('Should resolve $ref in request body schema', () => {
483
+ const doc = {
484
+ openapi: '3.1.0',
485
+ info: { title: 'Test', version: '1.0.0' },
486
+ paths: {
487
+ '/users': {
488
+ post: {
489
+ requestBody: {
490
+ content: {
491
+ 'application/json': { schema: { $ref: '#/components/schemas/CreateUser' } },
492
+ },
493
+ },
494
+ responses: { '201': { description: 'Created' } },
495
+ },
496
+ },
497
+ },
498
+ components: {
499
+ schemas: {
500
+ CreateUser: {
501
+ type: 'object',
502
+ properties: { name: { type: 'string' } },
503
+ required: ['name'],
504
+ },
505
+ },
506
+ },
507
+ };
508
+ expectTypeOf().toHaveProperty('name');
509
+ });
510
+ });
511
+ describe('Schema composition', () => {
512
+ it('Should handle oneOf as union type', () => {
513
+ const doc = {
514
+ openapi: '3.1.0',
515
+ info: { title: 'Test', version: '1.0.0' },
516
+ paths: {
517
+ '/shape': {
518
+ get: {
519
+ responses: {
520
+ '200': {
521
+ description: 'OK',
522
+ content: {
523
+ 'application/json': {
524
+ schema: {
525
+ oneOf: [
526
+ { type: 'object', properties: { radius: { type: 'number' } } },
527
+ { type: 'object', properties: { width: { type: 'number' } } },
528
+ ],
529
+ },
530
+ },
531
+ },
532
+ },
533
+ },
534
+ },
535
+ },
536
+ },
537
+ };
538
+ expectTypeOf().toExtend();
539
+ expectTypeOf().toExtend();
540
+ });
541
+ it('Should handle allOf as intersection type', () => {
542
+ const doc = {
543
+ openapi: '3.1.0',
544
+ info: { title: 'Test', version: '1.0.0' },
545
+ paths: {
546
+ '/item': {
547
+ get: {
548
+ responses: {
549
+ '200': {
550
+ description: 'OK',
551
+ content: {
552
+ 'application/json': {
553
+ schema: {
554
+ allOf: [
555
+ { type: 'object', properties: { id: { type: 'string' } } },
556
+ { type: 'object', properties: { name: { type: 'string' } } },
557
+ ],
558
+ },
559
+ },
560
+ },
561
+ },
562
+ },
563
+ },
564
+ },
565
+ },
566
+ };
567
+ expectTypeOf().toHaveProperty('id');
568
+ expectTypeOf().toHaveProperty('name');
569
+ });
570
+ it('Should handle const values', () => {
571
+ const doc = {
572
+ openapi: '3.1.0',
573
+ info: { title: 'Test', version: '1.0.0' },
574
+ paths: {
575
+ '/status': {
576
+ get: {
577
+ responses: {
578
+ '200': {
579
+ description: 'OK',
580
+ content: {
581
+ 'application/json': { schema: { const: 'active' } },
582
+ },
583
+ },
584
+ },
585
+ },
586
+ },
587
+ },
588
+ };
589
+ expectTypeOf().toEqualTypeOf();
590
+ });
591
+ it('Should handle nullable types (3.1 tuple style)', () => {
592
+ const doc = {
593
+ openapi: '3.1.0',
594
+ info: { title: 'Test', version: '1.0.0' },
595
+ paths: {
596
+ '/item': {
597
+ get: {
598
+ responses: {
599
+ '200': {
600
+ description: 'OK',
601
+ content: {
602
+ 'application/json': {
603
+ schema: { type: ['string', 'null'] },
604
+ },
605
+ },
606
+ },
607
+ },
608
+ },
609
+ },
610
+ },
611
+ };
612
+ expectTypeOf().toEqualTypeOf();
613
+ });
614
+ });
615
+ describe('Metadata extraction', () => {
616
+ it('Should extract tags at type level', () => {
617
+ const doc = {
618
+ openapi: '3.1.0',
619
+ info: { title: 'Test', version: '1.0.0' },
620
+ paths: {
621
+ '/items': {
622
+ get: {
623
+ tags: ['store'],
624
+ responses: { '200': { description: 'OK' } },
625
+ },
626
+ },
627
+ },
628
+ };
629
+ expectTypeOf().toHaveProperty('tags');
630
+ });
631
+ it('Should extract deprecated flag at type level', () => {
632
+ const doc = {
633
+ openapi: '3.1.0',
634
+ info: { title: 'Test', version: '1.0.0' },
635
+ paths: {
636
+ '/old': {
637
+ get: {
638
+ deprecated: true,
639
+ responses: { '200': { description: 'OK' } },
640
+ },
641
+ },
642
+ },
643
+ };
644
+ expectTypeOf().toHaveProperty('deprecated');
645
+ });
646
+ it('Should extract summary and description at type level', () => {
647
+ const doc = {
648
+ openapi: '3.1.0',
649
+ info: { title: 'Test', version: '1.0.0' },
650
+ paths: {
651
+ '/items': {
652
+ get: {
653
+ summary: 'List items',
654
+ description: 'Returns all items',
655
+ responses: { '200': { description: 'OK' } },
656
+ },
657
+ },
658
+ },
659
+ };
660
+ expectTypeOf().toHaveProperty('summary');
661
+ expectTypeOf().toHaveProperty('description');
662
+ });
663
+ });
664
+ });
665
+ //# sourceMappingURL=openapi-to-rest-api.spec.js.map