forked from Redocly/redocly-cli
/
bundle.test.ts.snap
467 lines (448 loc) · 10 KB
/
bundle.test.ts.snap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`bundle should add to meta ref from redocly registry 1`] = `
fileDependencies: {}
rootType:
properties:
openapi: null
info:
properties:
title:
type: string
version:
type: string
description:
type: string
termsOfService:
type: string
contact:
properties:
name:
type: string
url:
type: string
email:
type: string
extensionsPrefix: x-
name: Contact
license:
properties:
name:
type: string
url:
type: string
required:
- name
extensionsPrefix: x-
name: License
x-logo:
properties:
url:
type: string
altText:
type: string
backgroundColor:
type: string
href:
type: string
name: Logo
required:
- title
- version
extensionsPrefix: x-
name: Info
servers:
name: ServerList
properties: {}
items:
properties:
url:
type: string
description:
type: string
variables:
name: ServerVariablesMap
properties: {}
required:
- url
extensionsPrefix: x-
name: Server
security:
name: SecurityRequirementList
properties: {}
items:
properties: {}
additionalProperties:
type: array
items:
type: string
name: SecurityRequirement
tags:
name: TagList
properties: {}
items:
properties:
name:
type: string
description:
type: string
externalDocs:
properties:
description:
type: string
url:
type: string
required:
- url
extensionsPrefix: x-
name: ExternalDocs
x-traitTag:
type: boolean
x-displayName:
type: string
required:
- name
extensionsPrefix: x-
name: Tag
externalDocs:
properties:
description:
type: string
url:
type: string
required:
- url
extensionsPrefix: x-
name: ExternalDocs
paths:
properties: {}
name: Paths
components:
properties:
parameters:
name: NamedParameters
properties: {}
schemas:
name: NamedSchemas
properties: {}
responses:
name: NamedResponses
properties: {}
examples:
name: NamedExamples
properties: {}
requestBodies:
name: NamedRequestBodies
properties: {}
headers:
name: NamedHeaders
properties: {}
securitySchemes:
name: NamedSecuritySchemes
properties: {}
links:
name: NamedLinks
properties: {}
callbacks:
name: NamedCallbacks
properties: {}
extensionsPrefix: x-
name: Components
x-webhooks:
properties: {}
name: WebhooksMap
x-tagGroups:
name: TagGroups
properties: {}
items:
properties:
name:
type: string
tags:
type: array
items:
type: string
extensionsPrefix: x-
name: TagGroup
x-ignoredHeaderParameters:
type: array
items:
type: string
required:
- openapi
- paths
- info
extensionsPrefix: x-
name: Root
refTypes: {}
visitorsData:
registry-dependencies:
links:
- https://api.redocly.com/registry/params
`;
exports[`bundle should bundle external refs 1`] = `
openapi: 3.0.0
paths:
/pet:
parameters:
- $ref: '#/components/parameters/path-param'
put:
parameters:
- $ref: '#/components/parameters/param-a'
- $ref: '#/components/parameters/param-b'
- name: test
get:
parameters:
- $ref: '#/components/parameters/param-a'
- $ref: '#/components/parameters/param-c'
post:
parameters:
- $ref: '#/paths/~1pet/put/parameters/2'
components:
parameters:
param-a:
name: param_a
schema:
$ref: '#/components/schemas/schema-a'
examples:
first:
$ref: '#/components/examples/param-a-first'
second:
$ref: '#/components/examples/second'
path-param:
name: path_param
examples:
first:
$ref: '#/components/examples/first'
param-c:
name: param_c
param-b:
name: param_b
examples:
first:
value: b1
param-a-first:
value: a1
second:
value: a2
schemas:
schema-a:
type: string
`;
exports[`bundle should bundle external refs and use schema title if useSchemaTitleAsRef is true 1`] = `
openapi: 3.1.0
paths:
/football/match:
get:
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/FootballMatch'
/basketball/match:
get:
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/BasketballMatch'
components:
schemas:
FootballMatch:
title: FootballMatch
type: object
BasketballMatch:
title: BasketballMatch
type: object
`;
exports[`bundle should bundle external refs and warn for conflicting names 1`] = `
openapi: 3.0.0
paths:
/pet:
parameters:
- $ref: '#/components/parameters/path-param'
put:
parameters:
- $ref: '#/components/parameters/param-b'
- $ref: '#/components/parameters/param-b-2'
get:
parameters:
- $ref: '#/components/parameters/param-a'
- $ref: '#/components/parameters/param-c'
components:
parameters:
param-a:
name: test
param-b:
name: param_b_alt
path-param:
name: path_param
param-c:
name: param_c
param-b-2:
name: param_b
`;
exports[`bundle should dereferenced correctly when used with dereference 1`] = `
openapi: 3.0.0
paths:
/pet:
get:
operationId: get
parameters:
- name: shared-a
- name: get_b
post:
operationId: post
parameters:
- name: shared-a
components:
parameters:
shared_a:
name: shared-a
`;
exports[`bundle should not bundle url refs if used with keepUrlRefs 1`] = `
openapi: 3.0.0
paths:
/pet:
parameters:
- $ref: '#/components/parameters/path-param'
put:
parameters:
- $ref: https://someexternal.schema
- $ref: '#/components/parameters/param-b'
- name: test
get:
parameters:
- $ref: http://someexternal.schema
- $ref: '#/components/parameters/param-c'
components:
parameters:
path-param:
name: path_param
param-c:
name: param_c
param-b:
name: param_b
`;
exports[`bundle should not place referenced schema inline when component in question is not of type "schemas" 1`] = `
openapi: 3.0.0
paths:
/pet:
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/requestBody'
components:
schemas:
requestBody:
content:
application/json:
schema:
type: object
properties:
a:
type: string
b:
type: number
`;
exports[`bundle should place referenced schema inline when referenced schema name resolves to original schema name 1`] = `
openapi: 3.1.0
info:
title: My API
description: It ain't so wonderful, but at least it's mine.
version: '1.0'
contact:
email: me@theintenet.com
name: me
paths:
/test:
get:
summary: test
responses:
'200':
description: test
content:
application/json:
schema:
$ref: '#/components/schemas/vendor.schema'
components:
schemas:
vendor:
$ref: '#/components/schemas/vendor.schema'
myvendor:
$ref: '#/components/schemas/vendor.schema'
simple:
type: string
A:
type: string
test:
$ref: '#/components/schemas/rename-2'
rename:
type: string
rename-2:
type: number
vendor.schema:
title: vendor
type: object
description: Vendors
properties:
key:
type: string
description: System-assigned key for the vendor.
readOnly: true
id:
type: string
description: >
Unique identifier of the vendor.
You must specify a unique vendor ID when creating a vendor unless
document sequencing is configured, in which case the ID is
auto-generated.
name:
type: string
description: Name of the vendor.
isOneTimeUse:
type: boolean
description: One-time use
default: false
`;
exports[`bundle should pull hosted schema 1`] = `
openapi: 3.0.3
info:
title: bugtest
version: '1.0'
description: Demo
license:
name: DEMO
url: https://demo.com
servers:
- url: http://demo.com/api
paths:
/customer:
summary: Customer scope
get:
summary: Get demo no refs
operationId: GetCustomer
description: Returns Demo No Refs
responses:
'200':
description: Demo No Refs
content:
application/json:
schema:
$ref: '#/components/schemas/Customer'
components:
schemas:
Customer:
type: object
properties:
customerName:
type: string
accounts:
type: array
items:
$ref: '#/components/schemas/someexternal'
someexternal: External schema content
`;