rapidoc 9.1.0 → 9.1.4

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 (67) hide show
  1. package/dist/index.html +1 -1
  2. package/dist/index.html.gz +0 -0
  3. package/dist/rapidoc-min.js +2 -5
  4. package/dist/rapidoc-min.js.LICENSE.txt +17 -1
  5. package/dist/rapidoc-min.js.LICENSE.txt.gz +0 -0
  6. package/dist/rapidoc-min.js.gz +0 -0
  7. package/dist/report.html +6 -5
  8. package/docker/Dockerfile +5 -5
  9. package/docs/api.html +48 -40
  10. package/docs/examples/auth-test1.html +113 -0
  11. package/docs/examples/auth.html +37 -34
  12. package/docs/examples/badges.html +1 -1
  13. package/docs/examples/dynamic-query-params.html +1 -0
  14. package/docs/examples/mongo.html +33 -0
  15. package/docs/examples/readwrite.html +40 -0
  16. package/docs/examples/slots.html +7 -0
  17. package/docs/examples.html +3 -2
  18. package/docs/index.html +2 -2
  19. package/docs/list.html +15 -3
  20. package/docs/quickstart.html +1 -1
  21. package/docs/rapidoc-min.js +2 -5
  22. package/docs/rapidoc-mini.html +20 -20
  23. package/docs/specs/auth-test1.yaml +35 -0
  24. package/docs/specs/auth.yaml +2 -2
  25. package/docs/specs/code-highlight.yaml +1 -1
  26. package/docs/specs/data-types.yaml +0 -1
  27. package/docs/specs/dynamic-query-params.yaml +41 -0
  28. package/docs/specs/examples.yaml +11 -0
  29. package/docs/specs/mongo.yaml +78 -0
  30. package/docs/specs/multipart-formdata.yaml +3 -0
  31. package/docs/specs/petstore_extended.yaml +1 -1
  32. package/docs/specs/readwrite.yaml +90 -0
  33. package/docs/specs/server.yaml +4 -4
  34. package/docs/specs/temp.json +24 -105
  35. package/docs/specs/temp.yaml +20 -282
  36. package/docs/welcome.html +3 -3
  37. package/index.html +11 -6
  38. package/package.json +22 -21
  39. package/src/components/api-request.js +105 -63
  40. package/src/components/api-response.js +10 -10
  41. package/src/components/json-tree.js +2 -1
  42. package/src/components/schema-table.js +51 -14
  43. package/src/components/schema-tree.js +59 -18
  44. package/src/components/tag-input.js +8 -1
  45. package/src/index.js +2 -1
  46. package/src/json-schema-viewer.js +341 -0
  47. package/src/rapidoc-mini.js +5 -1
  48. package/src/rapidoc.js +11 -7
  49. package/src/styles/font-styles.js +3 -2
  50. package/src/styles/nav-styles.js +2 -2
  51. package/src/templates/components-template.js +9 -10
  52. package/src/templates/endpoint-template.js +1 -1
  53. package/src/templates/expanded-endpoint-template.js +1 -1
  54. package/src/templates/focused-endpoint-template.js +1 -1
  55. package/src/templates/header-template.js +1 -1
  56. package/src/templates/json-schema-viewer-template.js +184 -0
  57. package/src/templates/main-body-template.js +4 -1
  58. package/src/templates/navbar-template.js +3 -3
  59. package/src/templates/overview-template.js +6 -3
  60. package/src/templates/security-scheme-template.js +78 -38
  61. package/src/templates/server-template.js +1 -1
  62. package/src/utils/common-utils.js +2 -1
  63. package/src/utils/schema-utils.js +24 -19
  64. package/src/utils/spec-parser.js +24 -3
  65. package/webpack.config.js +1 -12
  66. package/dist/rapidoc-min.js.map +0 -1
  67. package/dist/rapidoc-min.js.map.gz +0 -0
package/docker/Dockerfile CHANGED
@@ -1,3 +1,6 @@
1
+ # to Build the Docker image from root folder execute
2
+ # docker build -t mrin9/rapidoc -f ./docker/Dockerfile .
3
+
1
4
  # Run the Docker image (view a spec thats hosted on a web-server)
2
5
  # docker run -it --rm -p 80:80 -e SPEC_URL="http://petstore.swagger.io/v2/swagger.json" mrin9/rapidoc
3
6
 
@@ -30,17 +33,14 @@ RUN npm run build
30
33
 
31
34
  # production stage
32
35
  FROM nginx:stable-alpine as production-stage
33
- COPY --from=build-stage /app/dist /app
34
- COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
35
36
 
36
37
  ENV PAGE_TITLE="RapiDoc"
37
38
  ENV PAGE_FAVICON="favicon.png"
38
39
  ENV SPEC_URL="http://petstore.swagger.io/v2/swagger.json"
39
40
  ENV PORT=80
40
- ENV RAPIDOC_OPTIONS=
41
41
 
42
42
  # copy files to the nginx folder
43
- COPY --from=0 build/dist /usr/share/nginx/html
43
+ COPY --from=build-stage /app/dist /usr/share/nginx/html
44
44
  COPY docker/index.tpl.html /usr/share/nginx/html/index.html
45
45
  COPY logo.png /usr/share/nginx/html/favicon.png
46
46
  COPY docker/nginx.conf /etc/nginx/
@@ -48,4 +48,4 @@ COPY docker/docker-run.sh /usr/local/bin
48
48
 
49
49
  EXPOSE 80
50
50
 
51
- CMD ["sh", "/usr/local/bin/docker-run.sh"]
51
+ CMD ["sh", "/usr/local/bin/docker-run.sh"]
package/docs/api.html CHANGED
@@ -14,8 +14,8 @@
14
14
 
15
15
  <meta charset="utf-8">
16
16
  <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
17
- <meta name="description" content="RapiDoc is Web Component for viewing Swagger & OpenAPI Spec. Supports themes, styling and various rendering styles">
18
- <meta name="keywords" content="RapiDoc, ReDoc, Swagger, SwaggerUI, Custom Element, Web Component, OpenAPI,REST, themes, dark mode, markdown, API documentation">
17
+ <meta name="description" content="RapiDoc is a Web Component for viewing Swagger & OpenAPI Spec. Supports themes, styling and various rendering styles">
18
+ <meta name="keywords" content="RapiDoc, openapi viewer, openapi to html, openapi renderer, ReDoc, Swagger, SwaggerUI, Custom Element, Web Component, OpenAPI, REST, themes, dark mode, markdown, API documentation">
19
19
 
20
20
  <link rel="shortcut icon" type="image/png" href="./images/logo.png"/>
21
21
 
@@ -147,6 +147,13 @@
147
147
  </span> Request fields will be filled with example value (if provided in spec) </td>
148
148
  <td class='default-col'>true</td>
149
149
  </tr>
150
+
151
+ <tr>
152
+ <td class="attr-col mono bold right">persist-auth </td>
153
+ <td class="gray"><span class='bold dark-gray'>Allowed:<span class='blue'> true | false </span>
154
+ </span> Authentication will be persisted to localStorage </td>
155
+ <td class='default-col'>false</td>
156
+ </tr>
150
157
  </table>
151
158
 
152
159
  <a id="att-colors"></a>
@@ -251,28 +258,6 @@
251
258
  </td>
252
259
  <td class='default-col'></td>
253
260
  </tr>
254
-
255
- <tr>
256
- <td class=" attr-col mono bold right">nav-bg-image </td>
257
- <td class="gray">
258
- URL of navigation bar's background image
259
- &nbsp;|&nbsp; <a href="./examples/nav-bg-image.html">Example</a>
260
- </td>
261
- <td class='default-col'>(empty)</td>
262
- </tr>
263
- <tr>
264
- <td class=" attr-col mono bold right">nav-bg-image-size </td>
265
- <td class="gray">navigation bar's background image size (same as css background-size property) allowed values are <br><span class='blue'>
266
- auto | length | cover | contain | initial | inherit </span></td>
267
- <td class='default-col'></td>
268
- </tr>
269
- <tr>
270
- <td class=" attr-col mono bold right">nav-bg-image-repeat </td>
271
- <td class="gray"> navigation bar's background image repeat (same as css background-repeat property) allowed values are <br><span class='blue'>
272
- repeat | repeat-x | repeat-y | no-repeat | initial | inherit </span> </td>
273
- <td class='default-col'></td>
274
- </tr>
275
-
276
261
  <tr>
277
262
  <td class=" attr-col mono bold right">nav-text-color </td>
278
263
  <td class="gray"> Navigation bar's Text color </td>
@@ -374,7 +359,7 @@
374
359
  <tr>
375
360
  <td class="mono bold right">schema-hide-read-only </td>
376
361
  <td class="gray"> <span class='bold dark-gray'>Allowed:<span class='blue'> always | never | (combination of: post | put | patch)</span></span> -
377
- read-only fileds in request schemas is <span class='blue'> always </span> hidden but are shown in response.
362
+ read-only fields in request schemas is <span class='blue'> always </span> hidden but are shown in response.
378
363
  <br/>
379
364
  If you do not want to hide read-only fields or hide them based on action you can configure this setting to 'never' or any combination of post | put | patch to indicate where to hide
380
365
  <br/>
@@ -386,7 +371,7 @@
386
371
  <tr>
387
372
  <td class="mono bold right">schema-hide-write-only </td>
388
373
  <td class="gray"> <span class='bold dark-gray'>Allowed:<span class='blue'> always | never</span></span> -
389
- write-only fileds in response schemas is <span class='blue'> always </span> hidden but are shown in request.
374
+ write-only fields in response schemas is <span class='blue'> always </span> hidden but are shown in request.
390
375
  <br/>
391
376
  If you do not want to hide write-only fields then set to 'never'
392
377
  <br/>
@@ -445,8 +430,7 @@
445
430
  show/hide the components section both in document and menu
446
431
  (available only in focused render-style)
447
432
  <br/>
448
- Will show the components section along with schemas, responses, examples, requestBodies, headers, securitySchemes, links and callbacks
449
- Also will be shown in the menu on the left (in read mode)
433
+ Will show the components section containing schemas, responses, examples, requestBodies, headers, securitySchemes, links and callbacks
450
434
  </td>
451
435
  <td>false</td>
452
436
  </tr>
@@ -481,6 +465,13 @@
481
465
  </td>
482
466
  <td>true</td>
483
467
  </tr>
468
+ <tr>
469
+ <td class="mono bold right">allow-spec-file-download</td>
470
+ <td class="gray">
471
+ If set to 'true', it provide buttons in the overview section to download the spec or open it in a new tab.
472
+ </td>
473
+ <td>false</td>
474
+ </tr>
484
475
  <tr>
485
476
  <td class="mono bold right">allow-search</td>
486
477
  <td class="gray">
@@ -632,12 +623,22 @@
632
623
  To programmatically provide username and password. <span class='mono blue'>securitySchemeId</span> should be a valid securityScheme which you have defined in the spec
633
624
  </td>
634
625
  </tr>
626
+ <tr>
627
+ <td class="mono bold right" style="text-align: left;">setApiKey(<br/>
628
+ &nbsp;&nbsp;securitySchemeId, token<br/>
629
+ )
630
+ </td>
631
+ <td class="gray" colspan="2">
632
+ To programmatically provide api-key. <span class='mono blue'>securitySchemeId</span> should be a valid securityScheme which you have defined in the spec
633
+ </td>
634
+ </tr>
635
635
  <tr>
636
636
  <td class="mono bold right">setApiServer(apiServerUrl) </td>
637
637
  <td class="gray" colspan="2">
638
638
  To programmatically set API Server. <span class='mono blue'>apiServerUrl</span> should be a valid server url which you have defined in the spec
639
639
  </td>
640
640
  </tr>
641
+
641
642
  <tr>
642
643
  <td class="mono bold right">scrollTo(path) </td>
643
644
  <td class="gray" colspan="2">
@@ -729,7 +730,7 @@
729
730
  <div style="width:710px">
730
731
  <span class="mono bold">slots</span>
731
732
  <span>
732
- are placeholders inside a web component that you can fill with your own markup.
733
+ are predefined placeholders inside a RapiDoc component. You can use these slots to place your custom html in certain desired locations inside RapiDoc.
733
734
  Below is an example on how to inject HTML/CSS/JS at various locations in RapiDoc
734
735
  </span>
735
736
  <pre class="shadow1 code-block" style="max-width: calc(100% - 8px)">
@@ -737,13 +738,13 @@
737
738
  &lt;html&gt;
738
739
  ...
739
740
  &lt;rapi-doc spec-url = "https://petstore.swagger.io/v2/swagger.json"&gt;
740
- &lt;slot&gt; &lt;!-- This is a default slot --&gt;
741
+ &lt;div&gt; &lt;!-- HTML Elements without slot attribute goes into default location--&gt;
741
742
  &lt;h1&gt; My HTML Heading &lt;/h1&gt;
742
- &lt;/slot&gt;
743
+ &lt;/div&gt;
743
744
 
744
- &lt;slot name="nav-logo"&gt; &lt;!-- This is a named slot --&gt;
745
- &lt;img src="https://via.placeholder.com/100" style="width:50px; height:50px"/&gt;
746
- &lt;/slot&gt;
745
+ &lt;!-- provide slot attribute to place an element at desired location --&gt;
746
+ &lt;img slot="nav-logo" src="https://via.placeholder.com/100" style="width:50px; height:50px"/&gt;
747
+
747
748
  &lt;/rapi-doc&gt;
748
749
  ...
749
750
  &lt;/html&gt;
@@ -762,7 +763,7 @@
762
763
  </tr>
763
764
  <tr>
764
765
  <td class="mono bold right">logo</td>
765
- <td class="gray">use this slot to replace the logo </td>
766
+ <td class="gray">use this slot to replace the logo on the header </td>
766
767
  </tr>
767
768
  <tr>
768
769
  <td class="mono bold right">header</td>
@@ -774,20 +775,27 @@
774
775
  </tr>
775
776
  <tr>
776
777
  <td class="mono bold right">nav-logo</td>
777
- <td class="gray"> contents appear at Side navigation bar (only available in read-mode)</td>
778
+ <td class="gray"> contents appear at the top of Side navigation bar usually used for logo. (only available in read-mode)</td>
778
779
  </tr>
779
780
 
780
781
  <tr>
781
782
  <td class="mono bold right">overview</td>
782
- <td class="gray"> contents appear at overview section</td>
783
+ <td class="gray"> contents appear at overview section - top of the document. You can link to this section using <span class="mono blue"> #overview </span>
784
+ </td> </td>
783
785
  </tr>
784
786
  <tr>
785
787
  <td class="mono bold right">servers</td>
786
- <td class="gray"> contents appear at server section</td>
788
+ <td class="gray"> contents appear at server section which is under the overview slot. You can link to this section using <span class="mono blue"> #servers </span> </td>
787
789
  </tr>
788
790
  <tr>
789
791
  <td class="mono bold right">auth</td>
790
- <td class="gray"> contents appear at authentication section</td>
792
+ <td class="gray"> contents appear at authentication section which is under the overview > servers slot. You can link to this section using <span class="mono blue"> #auth </span></td>
793
+ </tr>
794
+ <tr>
795
+ <td class="mono bold right">operations-top</td>
796
+ <td class="gray"> contents appear at the top of all the operations but below overview > servers > auth section.
797
+ Use this section to provide content that applies to all the operations. You can link this section using <span class="mono blue"> #operations-top </span>
798
+ </td>
791
799
  </tr>
792
800
  <tr>
793
801
  <td class="mono bold right">tag--{tag-name}</td>
@@ -796,7 +804,7 @@
796
804
  <tr>
797
805
  <td class="mono bold right">{method}-{path}</td>
798
806
  <td class="gray"> each path is identified by an id. which is in the format of {method}-{path},
799
- and certain invalid charecters such as {, }, #, space is replaced by hyphen (-).
807
+ and certain invalid characters such as {, }, #, space is replaced by hyphen (-).
800
808
  Use this slot to insert HTML content into a specifi tag
801
809
  </td>
802
810
  </tr>
@@ -0,0 +1,113 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <!-- Global site tag (gtag.js) - Google Analytics -->
5
+ <script async src="https://www.googletagmanager.com/gtag/js?id=UA-132775238-1"></script>
6
+ <script>
7
+ window.dataLayer = window.dataLayer || [];
8
+ function gtag(){dataLayer.push(arguments);}
9
+ gtag('js', new Date());
10
+
11
+ gtag('config', 'UA-132775238-1');
12
+ </script>
13
+
14
+ <meta charset="utf-8">
15
+ <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
16
+ <script type="module" src="../rapidoc-min.js"></script>
17
+ <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;600&family=Roboto+Mono&display=swap" rel="stylesheet">
18
+ <style>
19
+ .size { width: 100px; height: 30px; font-size:13px; margin: 0 2px; padding: 0 8px; border-radius: 2px; outline:none; color: #fff;}
20
+ .btn { background-color: #2069e0; cursor:pointer; border: 1px solid transparent;}
21
+ .txt {background-color: #2e2e2e; border: 1px solid #2069e0;}
22
+ .table{ border:1px solid #444; border-collapse: collapse;}
23
+ .table td{ font-size:12px; font-family: 'Roboto Mono'; border: 1px solid #444; padding:8px;}
24
+ .table th{ font-size:11px; font-family: 'Open Sans'; border: 1px solid #444; padding:8px; background: #222;}
25
+ datalist {
26
+ background-color: #222;
27
+ border: 1px solid #2069e0;
28
+ }
29
+ rapi-doc{
30
+ width:100%;
31
+ }
32
+ </style>
33
+ </head>
34
+ <body>
35
+ <rapi-doc id="thedoc"
36
+ spec-url="../specs/auth-test1.yaml"
37
+ show-info = "true"
38
+ theme = "dark"
39
+ render-style="read"
40
+ show-header="false"
41
+ >
42
+ <div slot='operations-top'>
43
+ <div style="font-size:14px; border:0; background-color: #282828; border-radius:4px; padding:16px; margin:16px 75px">
44
+ <table>
45
+ <tr>
46
+ <td> HTTP Basic</td>
47
+ <td>
48
+ <input class='size txt' id='http-security-scheme-id' value="http-basic" type='text' placeholder='Security Scheme ID' spellcheck='false' style="width:120px">
49
+ <input class='size txt' id='http-username' type='text' value="new-username" placeholder='User name' spellcheck='false' >
50
+ <input class='size txt' id='http-password' type='text' value="new-pwd" placeholder='Password' spellcheck='false' >
51
+ <button class='size btn' onclick='setSecurity(event, "http")'>Apply</button>
52
+ </td>
53
+ </tr>
54
+ <tr>
55
+ <td> API Key</td>
56
+ <td>
57
+ <input class='size txt' id='api-security-scheme-id' value="api_key1" type='text' placeholder='Security Scheme ID' spellcheck='false' style="width:120px">
58
+ <input class='size txt' id='api-key-value' type='text' value="new-token" placeholder='API Key Value' spellcheck='false' >
59
+ <button class='size btn' onclick='setSecurity(event, "apikey")'>Apply</button>
60
+ </td>
61
+ </tr>
62
+ <tr>
63
+ <td colspan="2"><button class='size btn' style="width:200px" onclick='clearSecurityKeys(event)'>Clear all Keys</button></td>
64
+ </tr>
65
+ </table>
66
+ </div>
67
+ </div>
68
+ </rapi-doc>
69
+ <script>
70
+ function setApiServer(ev) {
71
+ const docEl = document.getElementById('thedoc');
72
+ const trEl = ev.target.closest('tr');
73
+ const serverUrl = trEl.querySelector('#server-url').value;
74
+ result = docEl.setApiServer(serverUrl);
75
+ ev.target.innerText = result ? 'Applied !' : 'Failed';
76
+ ev.target.style.backgroundColor = result ? 'green' : 'orangered';
77
+ window.setTimeout(function(){
78
+ ev.target.innerText = 'Apply';
79
+ ev.target.style.backgroundColor = '#2069e0';
80
+ }, 5000)
81
+
82
+ }
83
+
84
+ function clearSecurityKeys(ev) {
85
+ const docEl = document.getElementById('thedoc');
86
+ docEl.removeAllSecurityKeys();
87
+ }
88
+
89
+ function setSecurity(ev, securityType) {
90
+ const docEl = document.getElementById('thedoc');
91
+ const trEl = ev.target.closest('tr');
92
+ let result;
93
+ if (securityType === 'http') {
94
+ const securitySchemeId = trEl.querySelector('#http-security-scheme-id').value;
95
+ const username = trEl.querySelector('#http-username').value;
96
+ const password = trEl.querySelector('#http-password').value;
97
+ result = docEl.setHttpUserNameAndPassword(securitySchemeId, username, password);
98
+ } else if (securityType === 'apikey') {
99
+ const securitySchemeId = trEl.querySelector('#api-security-scheme-id').value;
100
+ const newApiToken = trEl.querySelector('#api-key-value').value;
101
+ result = docEl.setApiKey(securitySchemeId, newApiToken);
102
+ }
103
+ ev.target.innerText = result ? 'Applied !' : 'Failed';
104
+ ev.target.style.backgroundColor = result ? 'green' : 'orangered';
105
+ window.setTimeout(function(){
106
+ ev.target.innerText = 'Apply';
107
+ ev.target.style.backgroundColor = '#2069e0';
108
+ }, 5000)
109
+ }
110
+ </script>
111
+
112
+ </body>
113
+ </html>
@@ -16,11 +16,16 @@
16
16
  <script type="module" src="../rapidoc-min.js"></script>
17
17
  <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;600&family=Roboto+Mono&display=swap" rel="stylesheet">
18
18
  <style>
19
- .size { width: 80px; height: 30px; font-size:13px; margin: 0 2px; padding: 0 8px; border-radius: 2px; outline:none; color: #fff;}
19
+ .size { width: 100px; height: 30px; font-size:13px; margin: 0 2px; padding: 0 8px; border-radius: 2px; outline:none; color: #fff;}
20
20
  .btn { background-color: #2069e0; cursor:pointer; border: 1px solid transparent;}
21
21
  .txt {background-color: #2e2e2e; border: 1px solid #2069e0;}
22
22
  .table{ border:1px solid #444; border-collapse: collapse;}
23
23
  .table td{ font-size:12px; font-family: 'Roboto Mono'; border: 1px solid #444; padding:8px;}
24
+ .table th{ font-size:11px; font-family: 'Open Sans'; border: 1px solid #444; padding:8px; background: #222;}
25
+ datalist {
26
+ background-color: #222;
27
+ border: 1px solid #2069e0;
28
+ }
24
29
  rapi-doc{
25
30
  width:100%;
26
31
  }
@@ -41,29 +46,30 @@
41
46
  *This section is not RapiDoc generated. It is user injected HTML/JS into a <span style="font-family:'Roboto Mono'"> &lt;slot&gt;</span> element to demonstrate how to programatically apply security keys
42
47
  </div>
43
48
 
44
- <div style="margin-top:16px">
45
- RapiDoc provides you with two helper methods which you can use to supply security keys programatically.
46
- <ol>
47
- <li> <span style="font-family:'Roboto Mono'">setHttpUserNameAndPassword()</span></li>
48
- <li> <span style="font-family:'Roboto Mono'">setApiKey()</span></li>
49
- </ol>
49
+ <div style="margin:24px 0 8px 0">
50
+ RapiDoc provides you with two helper methods which you can use to supply security keys programatically. You can use one of these method based on the security scheme type
50
51
  </div>
51
- <p>
52
+ <table class="table" style="border:1px solid #444; font-family:'Roboto Mono'">
53
+ <tr><th>SCHEME-TYPE</th><th>METHOD USED TO UPDATE</th></tr>
54
+ <tr> <td>basic</td><td>setHttpUserNameAndPassword('http-basic', 'newUserName', 'newPassword')</td></tr>
55
+ <tr> <td>other than basic</td><td style="border-bottom: 1px dashed #383838;" rowspan="3">setApiKey('api_key1', 'newApiToken')</td></tr>
56
+ </table>
57
+
58
+ <div style="margin:24px 0 8px 0">
52
59
  The table below list all the scurity schemes included in this spec. Check the corrosponding method that can be used to supply an access-token
53
- <table class="table" style="border:1px solid #444; font-family:'Roboto Mono'">
54
- <tr><th>TYPE</th><th>SECURITY SCHEME ID</th><th>METHOD USED TO UPDATE</th></tr>
55
- <tr> <td>http</td><td>http-basic</td> <td rowspan="2">RapiDocEl.setHttpUserNameAndPassword('http-basic', 'newUserName', 'newPassword')</td></tr>
56
- <tr> <td>http</td><td>http-bearer</td></tr>
57
- <tr> <td>oauth2</td><td>ms-oauth</td><td style="border-bottom: 1px dashed #383838;" rowspan="3">RapiDocEl.setApiKey('api_key1', 'newApiToken')</td></tr>
58
- <tr> <td>apiKey</td><td>api_key1</td></tr>
59
- <tr> <td>apiKey</td><td>api_key2</td></tr>
60
- <tr> <td>apiKey</td><td>api_key_cookie</td><td>
61
- <span style="font-family:'Open Sans'; color:#777">
62
- If the apiKey needs to send using a cookie, then it wont be set as RapiDoc do not support creation or reading of cookies
63
- </span>
64
- </td></tr>
65
- </table>
66
- </p>
60
+ </div>
61
+ <table class="table" style="border:1px solid #444; font-family:'Roboto Mono'">
62
+ <tr><th>SECURITY SCHEME</th><th>SCHEME TYPE</th><th>METHOD USED TO UPDATE</th></tr>
63
+ <tr> <td>http-basic</td><td>basic</td> <td>setHttpUserNameAndPassword('http-basic', 'newUserName', 'newPassword')</td></tr>
64
+ <tr> <td>http-bearer</td><td>bearer</td> <td>setApiKey('http-bearer', 'newToken')</td></tr>
65
+ <tr> <td>api_key1</td><td> <span style="color:#777"> (not-specified)</span></td> <td>setApiKey('api_key1', 'newToken')</td></tr>
66
+ <tr> <td>api_key2</td><td> <span style="color:#777"> (not-specified)</span></td> <td>setApiKey('api_key2', 'newToken')</td></tr>
67
+ <tr> <td>ms-oauth</td><td> <span style="color:#777"> (not-specified)</span></td> <td>setApiKey('ms-oauth', 'newToken')</td></tr>
68
+ <tr> <td>api_key_cookie</td><td> <span style="color:#777"> (not-specified)</span></td>
69
+ <td> <span style="color:#777"> (wont work as this scheme sends api-key in a cookie, and rapidoc dont create/read cookies)</span></td>
70
+ </tr>
71
+ </table>
72
+
67
73
  <div style="margin:32px 0 16px 0; color:#777; font-weight:bold">
68
74
  Below form is used for taking user input and apply the security key using javascipt
69
75
  </div>
@@ -79,20 +85,19 @@
79
85
  </tr>
80
86
  <tr>
81
87
  <td> API Key</td>
82
- <td>
83
- <input class='size txt' id='api-security-scheme-id' value="api_key1" type='text' placeholder='Security Scheme ID' spellcheck='false' style="width:120px">
88
+ <td>
89
+ <select class='size txt' style="width:138px" id='api-security-scheme-id' placeholder='Security Scheme ID'>
90
+ <option value="api_key1">api_key1</option>
91
+ <option value="api_key2">api_key2</option>
92
+ <option value="http-bearer">http-bearer</option>
93
+ <option value="ms-oauth">ms-oauth</option>
94
+ <option value="invalid-key">invalid-key</option>
95
+ </select>
96
+
84
97
  <input class='size txt' id='api-key-value' type='text' value="new-token" placeholder='API Key Value' spellcheck='false' >
85
98
  <button class='size btn' onclick='setSecurity(event, "apikey")'>Apply</button>
86
99
  </td>
87
100
  </tr>
88
- <tr>
89
- <td>OAuth</td>
90
- <td>
91
- <input class='size txt' id='oauth-security-scheme-id' value="ms-oauth" type='text' placeholder='Security Scheme ID' spellcheck='false' style="width:120px">
92
- <input class='size txt' id='oauth-key-value' type='text' value="new-token" placeholder='Access Token' spellcheck='false' >
93
- <button class='size btn' onclick='setSecurity(event, "oauth2")'>Apply</button>
94
- </td>
95
- </tr>
96
101
  <tr>
97
102
  <td colspan="2"><button class='size btn' style="width:200px" onclick='clearSecurityKeys(event)'>Clear all Keys</button></td>
98
103
  </tr>
@@ -110,8 +115,6 @@
110
115
  <td colspan="2"><button class='size btn' style="width:110px" onclick='setApiServer(event)'>Set API Server</button></td>
111
116
  </tr>
112
117
  </table>
113
-
114
-
115
118
  </div>
116
119
  </div>
117
120
  </rapi-doc>
@@ -19,7 +19,7 @@
19
19
  theme = "light"
20
20
  show-info = "true"
21
21
  show-header = "false"
22
- render-style = "view"
22
+ render-style = "read"
23
23
  allow-try = "false"
24
24
  >
25
25
  </rapi-doc>
@@ -29,6 +29,7 @@
29
29
  show-header = "false"
30
30
  regular-font = 'Open Sans'
31
31
  mono-font = "Roboto Mono"
32
+ default-schema-tab = "example"
32
33
  > </rapi-doc>
33
34
  </body>
34
35
  </html>
@@ -0,0 +1,33 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <!-- Global site tag (gtag.js) - Google Analytics -->
5
+ <script async src="https://www.googletagmanager.com/gtag/js?id=UA-132775238-1"></script>
6
+ <script>
7
+ window.dataLayer = window.dataLayer || [];
8
+ function gtag(){dataLayer.push(arguments);}
9
+ gtag('js', new Date());
10
+ gtag('config', 'UA-132775238-1');
11
+ </script>
12
+
13
+ <meta charset="utf-8">
14
+ <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
15
+ <script type="module" src="../rapidoc-min.js"></script>
16
+ </head>
17
+ <body>
18
+ <!--
19
+ <rapi-doc id="thedoc"
20
+ spec-url = "../specs/mongo.yaml"
21
+ allow-authentication = "false"
22
+ show-header="false"
23
+ show-info="false"
24
+ allow-server-selection="false"
25
+ render-style = "focused"
26
+ sort-tags = "true"
27
+ primary-color="#f54c47"
28
+ show-components = "true"
29
+ > </rapi-doc>
30
+ -->
31
+ <json-schema-viewer id="thedoc" spec-url = "../specs/mongo.yaml" ></json-schema-viewer>
32
+ </body>
33
+ </html>
@@ -0,0 +1,40 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <!-- Global site tag (gtag.js) - Google Analytics -->
5
+ <script async src='https://www.googletagmanager.com/gtag/js?id=UA-132775238-1'></script>
6
+ <script>
7
+ window.dataLayer = window.dataLayer || [];
8
+ function gtag(){dataLayer.push(arguments);}
9
+ gtag('js', new Date());
10
+ gtag('config', 'UA-132775238-1');
11
+ </script>
12
+ <meta charset='utf-8'>
13
+ <meta name='viewport' content='width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes'>
14
+ <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;600&family=Roboto+Mono&display=swap" rel="stylesheet">
15
+ <link href='../index.css' rel='stylesheet'>
16
+ <script type='module' src='../rapidoc-min.js'></script>
17
+ </head>
18
+ <body>
19
+ <rapi-doc spec-url="../specs/readwrite.yaml"
20
+ id = "thedoc"
21
+ allow-authentication = "false"
22
+ allow-search = "false"
23
+ show-info = "false"
24
+ show-header = "false"
25
+ render-style = "read"
26
+ allow-try = "false"
27
+ regular-font = 'Open Sans'
28
+ mono-font = "Roboto Mono"
29
+ theme = "dark"
30
+ schema-style='tree'
31
+ >
32
+ <div slot="nav-logo" style="width:100%; display: flex; flex-direction:column;">
33
+ <div style="display: flex;justify-content: center; margin: 2px 0">
34
+ <button class='btn medium' onclick="document.getElementById('thedoc').setAttribute('schema-style', 'tree')" >Tree</button>
35
+ <button class='btn medium' onclick="document.getElementById('thedoc').setAttribute('schema-style', 'table')" >Table</button>
36
+ </div>
37
+ </div>
38
+ </rapi-doc>
39
+ </body>
40
+ </html>
@@ -68,6 +68,13 @@
68
68
  </div>
69
69
  </span>
70
70
 
71
+ <span slot="operations-top" >
72
+ <p style="margin-top:10px; padding:16px 36px; background-color:#a5522e; color:#fff; text-align:center;" >
73
+ <b> overview</b> slot | <span style="font-size:12px"> Good for contents that applies to all operations/api</span>
74
+ </p>
75
+ </span>
76
+
77
+
71
78
  <p slot="tag--user" style="margin-top:10px; padding:16px 36px; background-color:#ac7339; color:#fff; text-align:center;" >
72
79
  <b> tag--user</b> slot
73
80
  </p>
@@ -77,7 +77,7 @@
77
77
  &lt;!doctype html&gt; &lt;!-- Important: must specify --&gt;
78
78
  &lt;html&gt;
79
79
  &lt;head&gt;
80
- &lt;meta charset="utf-8"&gt; &lt;!-- Important: rapi-doc uses utf8 charecters --&gt;
80
+ &lt;meta charset="utf-8"&gt; &lt;!-- Important: rapi-doc uses utf8 characters --&gt;
81
81
  &lt;script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"&gt;&lt;/script&gt;
82
82
  &lt;/head&gt;
83
83
  &lt;body&gt;
@@ -188,7 +188,8 @@
188
188
  &lt;img
189
189
  slot="nav-logo"
190
190
  src="https://img.icons8.com/color/48/000000/youtube-play.png"
191
- /&gt;
191
+ /&gt;
192
+ /&gt;
192
193
  &lt;/rapi-doc&gt;
193
194
  </code>
194
195
  </pre>
package/docs/index.html CHANGED
@@ -15,7 +15,7 @@
15
15
  <meta charset="utf-8">
16
16
  <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
17
17
  <meta name="description" content="RapiDoc is Web Component for viewing Swagger & OpenAPI Spec. Supports themes, styling and various rendering styles">
18
- <meta name="keywords" content="API, RapiDoc, ReDoc, stoplight, readme, Swagger, SwaggerUI, Custom Element, async-api, Web Component, web-hooks, OpenAPI, REST, themes, dark mode, markdown, API documentation, open api console, API mock, rest documentation">
18
+ <meta name="keywords" content="RapiDoc, openapi viewer, openapi to html, openapi renderer, ReDoc, Swagger, SwaggerUI, Custom Element, Web Component, OpenAPI, REST, themes, dark mode, markdown, API documentation, API mock">
19
19
 
20
20
  <link rel="shortcut icon" type="image/png" href="./images/logo.png"/>
21
21
 
@@ -267,7 +267,7 @@
267
267
  &lt;!doctype html&gt; &lt;!-- Important: must specify --&gt;
268
268
  &lt;html&gt;
269
269
  &lt;head&gt;
270
- &lt;meta charset="utf-8"&gt; &lt;!-- Important: rapi-doc uses utf8 charecters --&gt;
270
+ &lt;meta charset="utf-8"&gt; &lt;!-- Important: rapi-doc uses utf8 characters --&gt;
271
271
  &lt;script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"&gt;&lt;/script&gt;
272
272
  &lt;/head&gt;
273
273
  &lt;body&gt;