rapidoc 9.3.7 → 9.3.8

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/index.html CHANGED
@@ -1,141 +1,904 @@
1
- <!doctype html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta charset="utf-8">
6
- <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
7
- <title>RapiDoc</title>
8
- <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.18.1/build/styles/default.min.css">
9
- <script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.18.1/build/highlight.min.js"></script>
10
- </head>
11
-
12
- <script>
13
- window.addEventListener('DOMContentLoaded', (event) => {
14
- const docEl = document.getElementById('thedoc');
15
- docEl.addEventListener('before-try', (e) => {
16
- e.detail.request.headers.append('AAA-BBB', 'CCC DDDD');
17
- });
18
- });
19
- </script>
20
-
21
- <body>
22
- <!--
23
- Some sample spec to try
24
- https://api.apis.guru/v2/specs/stripe.com/2019-02-19/swagger.json
25
- https://api.apis.guru/v2/specs/github.com/v3/swagger.json
26
- https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json
27
- https://petstore.swagger.io/v2/swagger.json
28
- https://assets.zuora.com/zuora-documentation/swagger.yaml <<< Large spec with lot of markdown
29
- ./specs/petstore_anyof.yaml <<< contains complex one-of with inline primitives and recursive objects
30
- ./specs/oneof1.yaml <<< nested oneof
31
- https://cesdev.eng.sonicwall.com/api/q/openapi
32
- -->
33
- <rapi-doc
34
- spec-url = "./specs/petstore_mini.yaml"
35
- id="thedoc"
36
- theme = "dark"
37
- render-style="focused"
38
- schema-style="tree"
39
- show-method-in-nav-bar = "true"
40
- use-path-in-nav-bar = "true"
41
- show-components = "true"
42
- show-info = "true"
43
- show-header = "true"
44
- allow-search = "true"
45
- allow-advanced-search = "true"
46
- allow-spec-url-load="false"
47
- allow-spec-file-download="true"
48
- allow-server-selection = "true"
49
- allow-authentication = "true"
50
- update-route="false"
51
- remove-endpoints-with-badge-label-as="one"
52
- match-type="regex"
53
- persist-auth="true"
54
- scroll-behavior="smooth"
55
- ></rapi-doc>
56
- <!--
57
- <rapi-doc-mini
58
- style= "width:600px; padding:0 10px"
59
- id = "thedoc"
60
- spec-url="./specs/code-highlight.yaml"
61
- theme = "light"
62
- schema-style = 'table'
63
- sort-endpoints-by = "method"
64
- layout = "column"
65
- match-paths = "post /code"
66
- paths-expanded = "true"
67
- > </rapi-doc-mini>
68
- <br/>
69
- <rapi-doc-mini
70
- style= "width:600px; padding:0 10px"
71
- id = "thedoc"
72
- spec-url="./specs/code-highlight.yaml"
73
- theme = "light"
74
- schema-style = 'table'
75
- sort-endpoints-by = "method"
76
- layout = "column"
77
- match-paths = "get /code"
78
- > </rapi-doc-mini>
79
- -->
80
-
81
- <!--
82
-
83
- <rapi-doc
84
- id = "thedoc"
85
- spec-url="./specs/code-highlight.yaml"
86
- theme = "light"
87
- render-style = "view"
88
- schema-style = 'tree'
89
- sort-endpoints-by = "method"
90
- show-info = "false"
91
- show-header = "false"
92
- allow-server-selection = "false"
93
- allow-authentication = "false"
94
- > </rapi-doc>
95
-
96
-
97
- <rapi-doc
98
- id = "thedoc"
99
- spec-url="https://petstore.swagger.io/v2/swagger.json1"
100
- render-style = "read"
101
- load-fonts = "false"
102
- show-header = "false"
103
- >
104
- <div slot="nav-logo" style="width:100%; display: flex;justify-content: center;">
105
- <button class='btn medium' onclick="document.getElementById('thedoc').setAttribute('schema-style', 'table')" >Table</button>
106
- <button class='btn medium' onclick="document.getElementById('thedoc').setAttribute('schema-style', 'tree')" >Tree</button>
107
- </div>
108
- <div slot="put-/pet" style="width:100%; display: flex;justify-content: center;">
109
- <b style="color:red"> Hello world</b>
110
- </div>
111
- </rapi-doc>
112
- -->
113
- <!--
114
- <rapi-doc id = "thedoc" ></rapi-doc>
115
- <script>
116
- document.addEventListener('DOMContentLoaded', (event) => {
117
- let docEl = document.getElementById("thedoc");
118
- let strSpec = `
119
- {
120
- "openapi": "3.0.1",
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <script
6
+ type="module"
7
+ src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"
8
+ ></script>
9
+ <script>
10
+ const spec = {
11
+ "openapi": "3.0.0",
121
12
  "info": {
122
- "title": "My API",
123
- "version": "v1"
13
+ "title": "Providing Examples",
14
+ "description": "Providing Examples",
15
+ "version": "1.0.0"
124
16
  },
125
17
  "paths": {
126
- "/api/Todo/complicated": {
18
+ "/multiple-examples-in-request-parameters/{path-param-1}/{path-param-2}": {
127
19
  "get": {
128
20
  "tags": [
129
- "Todo"
21
+ "Providing Examples"
22
+ ],
23
+ "parameters": [
24
+ {
25
+ "name": "path-param-1",
26
+ "in": "path",
27
+ "schema": {
28
+ "type": "string",
29
+ "default": "p1-opt-2"
30
+ },
31
+ "examples": {
32
+ "example1": {
33
+ "value": "p1-opt-1"
34
+ },
35
+ "example2": {
36
+ "value": "p1-opt-2"
37
+ }
38
+ }
39
+ },
40
+ {
41
+ "name": "path-param-2",
42
+ "in": "path",
43
+ "schema": {
44
+ "type": "string"
45
+ },
46
+ "examples": {
47
+ "example1": {
48
+ "value": "p2-opt-1"
49
+ },
50
+ "example2": {
51
+ "value": "p2-opt-2"
52
+ }
53
+ }
54
+ },
55
+ {
56
+ "name": "age",
57
+ "description": "Single Example",
58
+ "in": "query",
59
+ "schema": {
60
+ "type": "number"
61
+ },
62
+ "example": 24
63
+ },
64
+ {
65
+ "name": "country-code",
66
+ "description": "Multiple examples _(Notice `us` do not have a summary)_",
67
+ "in": "query",
68
+ "schema": {
69
+ "type": "string",
70
+ "default": " "
71
+ },
72
+ "examples": {
73
+ "example1": {
74
+ "value": "uk",
75
+ "summary": "United Kingdom"
76
+ },
77
+ "example2": {
78
+ "value": "us"
79
+ },
80
+ "example3": {
81
+ "value": "ch",
82
+ "summary": "China"
83
+ }
84
+ }
85
+ },
86
+ {
87
+ "name": "marital-status",
88
+ "in": "query",
89
+ "schema": {
90
+ "type": "string",
91
+ "default": "unmarried"
92
+ },
93
+ "examples": {
94
+ "example1": {
95
+ "value": "married"
96
+ },
97
+ "example2": {
98
+ "value": "unmarried"
99
+ },
100
+ "example3": {
101
+ "value": "widowed"
102
+ }
103
+ }
104
+ },
105
+ {
106
+ "name": "luckyNumbers",
107
+ "in": "query",
108
+ "schema": {
109
+ "type": "array",
110
+ "items": {
111
+ "type": "number"
112
+ },
113
+ "minItems": 4,
114
+ "maxItems": 4,
115
+ "examples": [
116
+ "",
117
+ " ",
118
+ [
119
+ 10
120
+ ],
121
+ [
122
+ 10,
123
+ 20,
124
+ 30,
125
+ 40
126
+ ]
127
+ ]
128
+ }
129
+ }
130
+ ]
131
+ }
132
+ },
133
+ "/multiple-examples-by-response-type": {
134
+ "get": {
135
+ "description": "Multiple Examples provide for each media-type (`application/json` or `application/json`)",
136
+ "tags": [
137
+ "Providing Examples"
138
+ ],
139
+ "responses": {
140
+ "200": {
141
+ "description": "Successful operation",
142
+ "content": {
143
+ "application/json": {
144
+ "schema": {
145
+ "type": "object",
146
+ "properties": {
147
+ "age": {
148
+ "description": "Person Age",
149
+ "type": "integer"
150
+ },
151
+ "fullName": {
152
+ "description": "Person Full name",
153
+ "type": "object",
154
+ "properties": {
155
+ "firstName": {
156
+ "description": "First name",
157
+ "type": "string"
158
+ },
159
+ "lastName": {
160
+ "description": "Last name",
161
+ "type": "string"
162
+ }
163
+ }
164
+ }
165
+ }
166
+ },
167
+ "examples": {
168
+ "valid-json": {
169
+ "summary": "Example with Valid JSON String",
170
+ "description": "If valid JSON is provided in the example, It will be displayed in JSON tree form. Allowing copy/expand/collapse functionality",
171
+ "value": "{\n \"person\": {\n \"fullName\": {\n \"firstName\": \"Mickey\",\n \"lastName\": \"Mouse\"\n },\n \"age\": \"9\"\n }\n}\n"
172
+ },
173
+ "invalid-json": {
174
+ "summary": "Example with Invalid JSON String",
175
+ "description": "Invalid JSON is displayed in text-area as is",
176
+ "value": "{\n person: {\n fullName: {\n firstName: Donald,\n lastName: Duck\n },\n age: 10\n }\n}\n"
177
+ },
178
+ "as-object": {
179
+ "summary": "Example specified as object",
180
+ "value": {
181
+ "fullName": {
182
+ "firstName": "Donald",
183
+ "lastName": "Duck"
184
+ },
185
+ "age": 10
186
+ }
187
+ }
188
+ }
189
+ },
190
+ "application/xml": {
191
+ "schema": {
192
+ "type": "object",
193
+ "properties": {
194
+ "age": {
195
+ "description": "Person Age",
196
+ "type": "integer"
197
+ },
198
+ "fullName": {
199
+ "description": "Person Full name",
200
+ "type": "object",
201
+ "properties": {
202
+ "firstName": {
203
+ "description": "First name",
204
+ "type": "string"
205
+ },
206
+ "lastName": {
207
+ "description": "Last name",
208
+ "type": "string"
209
+ }
210
+ }
211
+ }
212
+ }
213
+ },
214
+ "examples": {
215
+ "example-1": {
216
+ "description": "Exmple 1 Description",
217
+ "value": "<root>\n <person>\n <fullName>\n <firstName> Mickey </firstName>\n <lastName> Mouse </lastName>\n </fullName>\n <age> 9 </age>\n </person>\n</root>\n"
218
+ }
219
+ }
220
+ }
221
+ }
222
+ }
223
+ }
224
+ }
225
+ },
226
+ "/single-example-by-response-type": {
227
+ "get": {
228
+ "summary": "Single Example at schema Level",
229
+ "tags": [
230
+ "Providing Examples"
231
+ ],
232
+ "responses": {
233
+ "200": {
234
+ "description": "Successful operation",
235
+ "content": {
236
+ "application/json": {
237
+ "schema": {
238
+ "type": "object",
239
+ "properties": {
240
+ "age": {
241
+ "description": "Person Age",
242
+ "type": "integer"
243
+ },
244
+ "fullName": {
245
+ "description": "Person Full name",
246
+ "type": "object",
247
+ "properties": {
248
+ "firstName": {
249
+ "description": "First name",
250
+ "type": "string"
251
+ },
252
+ "lastName": {
253
+ "description": "Last name",
254
+ "type": "string"
255
+ }
256
+ }
257
+ }
258
+ }
259
+ },
260
+ "example": "{\n age: 10,\n fullName: {\n firstName: Donald,\n lastName: Duck\n }\n}\n"
261
+ }
262
+ }
263
+ }
264
+ }
265
+ }
266
+ },
267
+ "/example-with-array-1": {
268
+ "get": {
269
+ "summary": "Single Example at schema Level",
270
+ "tags": [
271
+ "Providing Examples"
272
+ ],
273
+ "responses": {
274
+ "200": {
275
+ "description": "Successful operation",
276
+ "content": {
277
+ "application/json": {
278
+ "schema": {
279
+ "$ref": "#/components/schemas/ArrayOfInt-1"
280
+ }
281
+ }
282
+ }
283
+ }
284
+ }
285
+ }
286
+ },
287
+ "/example-with-array-2": {
288
+ "get": {
289
+ "summary": "Single Example at schema Level",
290
+ "tags": [
291
+ "Providing Examples"
292
+ ],
293
+ "responses": {
294
+ "200": {
295
+ "description": "Successful operation",
296
+ "content": {
297
+ "application/json": {
298
+ "schema": {
299
+ "$ref": "#/components/schemas/ArrayOfInt-2"
300
+ }
301
+ }
302
+ }
303
+ }
304
+ }
305
+ }
306
+ },
307
+ "/object-example-for-a-schema": {
308
+ "get": {
309
+ "summary": "Single example having invalid JSON, under a Schema",
310
+ "tags": [
311
+ "Providing Examples"
312
+ ],
313
+ "responses": {
314
+ "200": {
315
+ "description": "Successful operation",
316
+ "content": {
317
+ "application/json": {
318
+ "schema": {
319
+ "type": "object",
320
+ "properties": {
321
+ "age": {
322
+ "description": "Person Age",
323
+ "type": "integer"
324
+ },
325
+ "fullName": {
326
+ "description": "Person Full name",
327
+ "type": "object",
328
+ "properties": {
329
+ "firstName": {
330
+ "description": "First name",
331
+ "type": "string"
332
+ },
333
+ "lastName": {
334
+ "description": "Last name",
335
+ "type": "string"
336
+ }
337
+ }
338
+ }
339
+ },
340
+ "example": "{\n person: {\n fullName: {\n firstName: Donald,\n lastName: Duck\n },\n age: 10\n }\n}\n"
341
+ }
342
+ }
343
+ }
344
+ }
345
+ }
346
+ }
347
+ },
348
+ "/array-example-for-a-schema": {
349
+ "get": {
350
+ "summary": "Single Example of Type Array Under a Schema",
351
+ "tags": [
352
+ "Providing Examples"
353
+ ],
354
+ "responses": {
355
+ "200": {
356
+ "description": "An array of currency codes",
357
+ "content": {
358
+ "application/json": {
359
+ "schema": {
360
+ "$ref": "#/components/schemas/currencies"
361
+ }
362
+ }
363
+ }
364
+ }
365
+ }
366
+ }
367
+ },
368
+ "/example-with-simple-object": {
369
+ "get": {
370
+ "summary": "Single Example of Type Array Under a Schema",
371
+ "tags": [
372
+ "Providing Examples"
373
+ ],
374
+ "responses": {
375
+ "200": {
376
+ "description": "An array of currency codes",
377
+ "content": {
378
+ "application/json": {
379
+ "schema": {
380
+ "$ref": "#/components/schemas/PersonObject"
381
+ }
382
+ }
383
+ }
384
+ }
385
+ }
386
+ }
387
+ },
388
+ "/per-field-example-with-root-as-object": {
389
+ "get": {
390
+ "summary": "Root node of the example is an object. and the object is constituted using field level example",
391
+ "tags": [
392
+ "Providing Examples"
393
+ ],
394
+ "responses": {
395
+ "200": {
396
+ "description": "Successful operation",
397
+ "content": {
398
+ "application/json": {
399
+ "schema": {
400
+ "type": "object",
401
+ "properties": {
402
+ "age": {
403
+ "description": "Person Age",
404
+ "type": "integer",
405
+ "example": 8
406
+ },
407
+ "fullName": {
408
+ "description": "Person Full name",
409
+ "type": "object",
410
+ "properties": {
411
+ "firstName": {
412
+ "description": "First name",
413
+ "type": "string",
414
+ "example": "Daisy"
415
+ },
416
+ "lastName": {
417
+ "description": "Last name",
418
+ "type": "string",
419
+ "example": "Duck"
420
+ }
421
+ }
422
+ },
423
+ "dependents": {
424
+ "type": "array",
425
+ "items": {
426
+ "type": "object",
427
+ "properties": {
428
+ "dependentName": {
429
+ "type": "string"
430
+ },
431
+ "relation": {
432
+ "type": "string"
433
+ },
434
+ "age": {
435
+ "type": "number"
436
+ }
437
+ }
438
+ }
439
+ }
440
+ }
441
+ }
442
+ }
443
+ }
444
+ }
445
+ }
446
+ }
447
+ },
448
+ "/per-field-example-with-root-as-array": {
449
+ "get": {
450
+ "summary": "Root node of the example is an array. and the object is constituted using field level example",
451
+ "tags": [
452
+ "Providing Examples"
453
+ ],
454
+ "responses": {
455
+ "200": {
456
+ "description": "Successful operation",
457
+ "content": {
458
+ "application/json": {
459
+ "schema": {
460
+ "type": "array",
461
+ "items": {
462
+ "type": "object",
463
+ "properties": {
464
+ "dependentName": {
465
+ "type": "string"
466
+ },
467
+ "relation": {
468
+ "type": "string"
469
+ },
470
+ "age": {
471
+ "type": "number"
472
+ }
473
+ },
474
+ "example": {
475
+ "dependentName": "Natasha",
476
+ "relation": "wife",
477
+ "age": 28
478
+ }
479
+ }
480
+ }
481
+ }
482
+ }
483
+ }
484
+ }
485
+ }
486
+ },
487
+ "/example-with-refs": {
488
+ "get": {
489
+ "description": "When a Schema definition is `provided` as a ref \n(provide the example at schema-level)\n",
490
+ "tags": [
491
+ "Providing Examples"
492
+ ],
493
+ "responses": {
494
+ "200": {
495
+ "description": "Successful operation",
496
+ "content": {
497
+ "application/json": {
498
+ "schema": {
499
+ "type": "array",
500
+ "items": {
501
+ "$ref": "#/components/schemas/cost"
502
+ }
503
+ },
504
+ "examples": {
505
+ "USD": {
506
+ "description": "Cost in `US Dollars`",
507
+ "value": "{\n amount: 10,\n currency: USD\n}\n"
508
+ },
509
+ "INR": {
510
+ "description": "Cost in `Indian Rupees`",
511
+ "value": "{\n amount: 700,\n currency: INR\n}\n"
512
+ }
513
+ }
514
+ }
515
+ }
516
+ }
517
+ }
518
+ }
519
+ },
520
+ "/example-with-request-body-as-string": {
521
+ "post": {
522
+ "summary": "Test RequestBody as string",
523
+ "requestBody": {
524
+ "content": {
525
+ "text/plain": {
526
+ "schema": {
527
+ "type": "string"
528
+ },
529
+ "examples": [
530
+ "one",
531
+ "two"
532
+ ]
533
+ }
534
+ }
535
+ }
536
+ }
537
+ },
538
+ "/example-with-request-body-as-integer": {
539
+ "post": {
540
+ "summary": "Test RequestBody as integer",
541
+ "requestBody": {
542
+ "content": {
543
+ "text/plain": {
544
+ "schema": {
545
+ "type": "integer"
546
+ },
547
+ "examples": [
548
+ 1,
549
+ 2
550
+ ]
551
+ }
552
+ }
553
+ }
554
+ }
555
+ },
556
+ "/example-with-request-body-as-array-of-string": {
557
+ "post": {
558
+ "summary": "Test RequestBody as array of string",
559
+ "requestBody": {
560
+ "content": {
561
+ "application/json": {
562
+ "schema": {
563
+ "type": "array",
564
+ "items": {
565
+ "type": "string"
566
+ }
567
+ }
568
+ }
569
+ }
570
+ }
571
+ }
572
+ },
573
+ "/multiple-example-in-request-body": {
574
+ "post": {
575
+ "summary": "Request body with multiple examples",
576
+ "tags": [
577
+ "Providing Examples"
578
+ ],
579
+ "requestBody": {
580
+ "description": "Request body containing **multiple** examples",
581
+ "required": true,
582
+ "content": {
583
+ "application/json": {
584
+ "schema": {
585
+ "type": "array",
586
+ "items": {
587
+ "$ref": "#/components/schemas/cost"
588
+ }
589
+ },
590
+ "examples": {
591
+ "USD": {
592
+ "description": "Cost in `US Dollars`",
593
+ "value": "{\n amount: 10,\n currency: USD\n}\n"
594
+ },
595
+ "INR": {
596
+ "description": "Cost in `Indian Rupees`",
597
+ "value": "{\n amount: 700,\n currency: INR\n}\n"
598
+ }
599
+ }
600
+ }
601
+ }
602
+ }
603
+ }
604
+ },
605
+ "/object-containg-array-property-with-example": {
606
+ "get": {
607
+ "summary": "Object schema with array type property containing example",
608
+ "tags": [
609
+ "Providing Examples"
130
610
  ],
131
- "summary": "Complicated action.",
132
611
  "responses": {
133
612
  "200": {
134
- "description": "Returns a complicated class.",
613
+ "description": "Object with array type property containing example",
135
614
  "content": {
136
615
  "application/json": {
137
616
  "schema": {
138
- "$ref": "#/components/schemas/ComplicatedClass"
617
+ "$ref": "#/components/schemas/ObjectWithArrayPropExample"
618
+ }
619
+ }
620
+ }
621
+ }
622
+ }
623
+ }
624
+ },
625
+ "/examples-anyOf": {
626
+ "get": {
627
+ "tags": [
628
+ "Providing Examples"
629
+ ],
630
+ "summary": "AnyOf schemas with examples as part of the subschema",
631
+ "responses": {
632
+ "200": {
633
+ "description": "AnyOf schemas with examples as part of the subschema",
634
+ "content": {
635
+ "application/problem+json": {
636
+ "schema": {
637
+ "anyOf": [
638
+ {
639
+ "title": "AnyOf example 1",
640
+ "description": "First example",
641
+ "type": "object",
642
+ "properties": {
643
+ "foo": {
644
+ "type": "string"
645
+ },
646
+ "bar": {
647
+ "type": "integer"
648
+ }
649
+ },
650
+ "example": {
651
+ "foo": "foo",
652
+ "bar": 42
653
+ }
654
+ },
655
+ {
656
+ "title": "Second anyOf",
657
+ "description": "Another example",
658
+ "type": "array",
659
+ "items": {
660
+ "type": "object",
661
+ "properties": {
662
+ "foo": {
663
+ "type": "string"
664
+ },
665
+ "quux": {
666
+ "type": "array",
667
+ "items": {
668
+ "type": "number"
669
+ }
670
+ }
671
+ }
672
+ },
673
+ "example": {
674
+ "foo": "foo",
675
+ "quux": [
676
+ 42,
677
+ 24
678
+ ]
679
+ }
680
+ },
681
+ {
682
+ "title": "No example defined",
683
+ "type": "array",
684
+ "items": {
685
+ "type": "object",
686
+ "properties": {
687
+ "foo": {
688
+ "type": "string"
689
+ },
690
+ "quux": {
691
+ "type": "array",
692
+ "items": {
693
+ "type": "number"
694
+ }
695
+ }
696
+ }
697
+ }
698
+ }
699
+ ]
700
+ }
701
+ }
702
+ }
703
+ }
704
+ }
705
+ }
706
+ },
707
+ "/examples-anyOf-with-general-properties": {
708
+ "get": {
709
+ "tags": [
710
+ "Providing Examples"
711
+ ],
712
+ "summary": "AnyOf schemas with general properties",
713
+ "responses": {
714
+ "200": {
715
+ "description": "AnyOf schemas with general properties",
716
+ "content": {
717
+ "application/problem+json": {
718
+ "schema": {
719
+ "title": "A composed object",
720
+ "type": "object",
721
+ "properties": {
722
+ "common": {
723
+ "type": "string"
724
+ },
725
+ "other": {
726
+ "type": "number"
727
+ }
728
+ },
729
+ "anyOf": [
730
+ {
731
+ "title": "Schema 1",
732
+ "type": "object",
733
+ "properties": {
734
+ "foo": {
735
+ "type": "string"
736
+ },
737
+ "bar": {
738
+ "type": "integer"
739
+ }
740
+ },
741
+ "example": {
742
+ "foo": "foo",
743
+ "bar": 42
744
+ }
745
+ },
746
+ {
747
+ "title": "Second schema",
748
+ "type": "object",
749
+ "properties": {
750
+ "baz": {
751
+ "type": "string",
752
+ "format": "url"
753
+ }
754
+ }
755
+ }
756
+ ]
757
+ }
758
+ }
759
+ }
760
+ }
761
+ }
762
+ }
763
+ },
764
+ "/examples-oneOf": {
765
+ "get": {
766
+ "tags": [
767
+ "Providing Examples"
768
+ ],
769
+ "summary": "OneOf schema with examples as part of the subschema",
770
+ "responses": {
771
+ "200": {
772
+ "description": "OneOf schema with examples as part of the subschema",
773
+ "content": {
774
+ "application/problem+json": {
775
+ "schema": {
776
+ "oneOf": [
777
+ {
778
+ "title": "Schema 1",
779
+ "type": "object",
780
+ "properties": {
781
+ "foo": {
782
+ "type": "string"
783
+ },
784
+ "bar": {
785
+ "type": "integer"
786
+ }
787
+ },
788
+ "example": {
789
+ "foo": "foo",
790
+ "bar": 42
791
+ }
792
+ },
793
+ {
794
+ "title": "Second schema",
795
+ "type": "object",
796
+ "properties": {
797
+ "baz": {
798
+ "type": "string",
799
+ "format": "url"
800
+ }
801
+ }
802
+ }
803
+ ]
804
+ }
805
+ }
806
+ }
807
+ }
808
+ }
809
+ }
810
+ },
811
+ "/examples-allOf": {
812
+ "get": {
813
+ "tags": [
814
+ "Providing Examples"
815
+ ],
816
+ "summary": "AllOf schemas with examples as part of the subschema",
817
+ "responses": {
818
+ "200": {
819
+ "description": "AllOf schemas with examples as part of the subschema",
820
+ "content": {
821
+ "application/problem+json": {
822
+ "schema": {
823
+ "allOf": [
824
+ {
825
+ "title": "Schema 1",
826
+ "type": "object",
827
+ "properties": {
828
+ "foo": {
829
+ "type": "string"
830
+ },
831
+ "bar": {
832
+ "type": "integer"
833
+ }
834
+ }
835
+ },
836
+ {
837
+ "title": "Second schema",
838
+ "type": "object",
839
+ "properties": {
840
+ "baz": {
841
+ "type": "string",
842
+ "format": "url"
843
+ }
844
+ }
845
+ }
846
+ ]
847
+ }
848
+ }
849
+ }
850
+ }
851
+ }
852
+ }
853
+ },
854
+ "/examples-allOf-anyOf": {
855
+ "get": {
856
+ "tags": [
857
+ "Providing Examples"
858
+ ],
859
+ "summary": "Combination of allOf & nested anyOf schemas",
860
+ "responses": {
861
+ "200": {
862
+ "description": "Combination of allOf & nested anyOf schemas",
863
+ "content": {
864
+ "application/problem+json": {
865
+ "schema": {
866
+ "allOf": [
867
+ {
868
+ "title": "Schema 1",
869
+ "type": "object",
870
+ "properties": {
871
+ "foo": {
872
+ "type": "string"
873
+ },
874
+ "bar": {
875
+ "type": "integer"
876
+ }
877
+ }
878
+ },
879
+ {
880
+ "title": "Second schema",
881
+ "anyOf": [
882
+ {
883
+ "type": "object",
884
+ "properties": {
885
+ "baz": {
886
+ "type": "string",
887
+ "format": "url"
888
+ }
889
+ }
890
+ },
891
+ {
892
+ "type": "object",
893
+ "properties": {
894
+ "foobar": {
895
+ "type": "string"
896
+ }
897
+ }
898
+ }
899
+ ]
900
+ }
901
+ ]
139
902
  }
140
903
  }
141
904
  }
@@ -146,104 +909,137 @@
146
909
  },
147
910
  "components": {
148
911
  "schemas": {
149
- "Tag": {
150
- "enum": [
151
- 0,
152
- 1,
153
- 2
154
- ],
155
- "type": "integer",
156
- "description": "Tag for TodoItem.",
157
- "format": "int32"
158
- },
159
- "InnerEnum": {
160
- "enum": [
161
- 1
162
- ],
163
- "type": "integer",
164
- "description": "Inner enum.",
165
- "format": "int32"
166
- },
167
- "SecondInnerEnum": {
168
- "enum": [
169
- 0
170
- ],
171
- "type": "integer",
172
- "description": "Second inner enum.",
173
- "format": "int32"
174
- },
175
- "SecondInnerEnumSecondInnerClass": {
912
+ "cost": {
176
913
  "type": "object",
177
914
  "properties": {
178
- "innerEnum": {
179
- "allOf": [
180
- {
181
- "$ref": "#/components/schemas/SecondInnerEnum"
182
- }
183
- ],
184
- "description": "Second inner enum."
915
+ "amount": {
916
+ "type": "integer",
917
+ "description": "Amount"
918
+ },
919
+ "currency": {
920
+ "description": "Currency Code",
921
+ "type": "string"
922
+ }
923
+ }
924
+ },
925
+ "currencies": {
926
+ "type": "array",
927
+ "items": {
928
+ "type": "object",
929
+ "properties": {
930
+ "currencyCode": {
931
+ "type": "string"
932
+ },
933
+ "evaluationDate": {
934
+ "type": "string",
935
+ "format": "date-time"
936
+ }
937
+ }
938
+ },
939
+ "example": [
940
+ {
941
+ "currencyCode": "USD",
942
+ "evaluationDate": "2017-07-21T17:32:28Z"
943
+ },
944
+ {
945
+ "currencyCode": "INR",
946
+ "evaluationDate": "2017-07-21T17:32:28Z"
185
947
  }
948
+ ]
949
+ },
950
+ "ArrayOfInt-1": {
951
+ "type": "array",
952
+ "items": {
953
+ "type": "integer",
954
+ "format": "int64"
186
955
  },
187
- "additionalProperties": false,
188
- "description": "Second inner class."
956
+ "example": [
957
+ 1,
958
+ 2,
959
+ 3,
960
+ 4
961
+ ]
189
962
  },
190
- "InnerClass": {
963
+ "ArrayOfInt-2": {
964
+ "type": "array",
965
+ "items": {
966
+ "type": "integer",
967
+ "format": "int64",
968
+ "example": 1
969
+ }
970
+ },
971
+ "PersonObject": {
191
972
  "type": "object",
192
973
  "properties": {
193
- "innerEnum": {
194
- "type": "array",
195
- "items": {
196
- "$ref": "#/components/schemas/InnerEnum"
197
- },
198
- "description": "List of inner enums.",
199
- "nullable": true
974
+ "name": {
975
+ "type": "string"
200
976
  },
201
- "secondInnerClass": {
202
- "allOf": [
203
- {
204
- "$ref": "#/components/schemas/SecondInnerEnumSecondInnerClass"
205
- }
206
- ],
207
- "description": "Second inner class.",
208
- "nullable": true
977
+ "age": {
978
+ "type": "integer"
209
979
  }
210
980
  },
211
- "additionalProperties": false,
212
- "description": "Inner class."
981
+ "example": {
982
+ "name": "name-1",
983
+ "age": 1
984
+ }
213
985
  },
214
- "ComplicatedClass": {
986
+ "ObjectWithArrayPropExample": {
215
987
  "type": "object",
216
988
  "properties": {
217
- "tag": {
218
- "allOf": [
219
- {
220
- "$ref": "#/components/schemas/Tag"
221
- }
222
- ],
223
- "description": "Tag."
989
+ "numberProp": {
990
+ "type": "number",
991
+ "example": 1000
224
992
  },
225
- "innerClass": {
226
- "allOf": [
227
- {
228
- "$ref": "#/components/schemas/InnerClass"
229
- }
230
- ],
231
- "description": "Inner class.",
232
- "nullable": true
993
+ "stringProp": {
994
+ "type": "string",
995
+ "enum": [
996
+ "value0",
997
+ "value1"
998
+ ]
999
+ },
1000
+ "arrayProp": {
1001
+ "type": "array",
1002
+ "items": {
1003
+ "type": "number"
1004
+ },
1005
+ "example": [
1006
+ 0,
1007
+ 1,
1008
+ 2
1009
+ ]
233
1010
  }
234
- },
235
- "additionalProperties": false,
236
- "description": "Complicated class for testing enums."
1011
+ }
237
1012
  }
238
1013
  }
239
1014
  }
240
- }
241
- `;
242
- let objSpec = JSON.parse(strSpec);
243
- docEl.loadSpec(objSpec);
244
- })
245
- </script>
246
- -->
247
- </body>
248
-
249
- </html>
1015
+ };
1016
+ function loadSpec() {
1017
+ const el = document.getElementById("thedoc");
1018
+ el.loadSpec(spec);
1019
+ }
1020
+ </script>
1021
+ </head>
1022
+ <body onload="loadSpec()">
1023
+ <rapi-doc id="thedoc"
1024
+ theme="light"
1025
+ show-header="false"
1026
+ show-info="false"
1027
+ allow-server-selection="false"
1028
+ allow-api-list-style-selection="false"
1029
+ on-nav-tag-click="show-description"
1030
+ render-style="focused"
1031
+ schema-style="table"
1032
+ schema-expand-level="3"
1033
+ info-description-headings-in-navbar="true"
1034
+ nav-bg-color="#fafafa"
1035
+ nav-hover-text-color="#000000"
1036
+ nav-hover-bg-color="#ECF6FD"
1037
+ primary-color="#012169"
1038
+ bg-color="#ffffff"
1039
+ font-size="largest"
1040
+ allow-authentication='false'
1041
+ fill-request-fields-with-example="false"
1042
+ show-method-in-nav-bar="as-colored-block"
1043
+ > </rapi-doc>
1044
+ </body>
1045
+ </html>