1 |
|
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/temp.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 | allow-try = "false"
|
56 | show-curl-before-try = "true"
|
57 | ></rapi-doc>
|
58 | <!--
|
59 | <rapi-doc-mini
|
60 | style= "width:600px; padding:0 10px"
|
61 | id = "thedoc"
|
62 | spec-url="./specs/code-highlight.yaml"
|
63 | theme = "light"
|
64 | schema-style = 'table'
|
65 | sort-endpoints-by = "method"
|
66 | layout = "column"
|
67 | match-paths = "post /code"
|
68 | paths-expanded = "true"
|
69 | > </rapi-doc-mini>
|
70 | <br/>
|
71 | <rapi-doc-mini
|
72 | style= "width:600px; padding:0 10px"
|
73 | id = "thedoc"
|
74 | spec-url="./specs/code-highlight.yaml"
|
75 | theme = "light"
|
76 | schema-style = 'table'
|
77 | sort-endpoints-by = "method"
|
78 | layout = "column"
|
79 | match-paths = "get /code"
|
80 | > </rapi-doc-mini>
|
81 | -->
|
82 |
|
83 | <!--
|
84 |
|
85 | <rapi-doc
|
86 | id = "thedoc"
|
87 | spec-url="./specs/code-highlight.yaml"
|
88 | theme = "light"
|
89 | render-style = "view"
|
90 | schema-style = 'tree'
|
91 | sort-endpoints-by = "method"
|
92 | show-info = "false"
|
93 | show-header = "false"
|
94 | allow-server-selection = "false"
|
95 | allow-authentication = "false"
|
96 | > </rapi-doc>
|
97 |
|
98 |
|
99 | <rapi-doc
|
100 | id = "thedoc"
|
101 | spec-url="https://petstore.swagger.io/v2/swagger.json1"
|
102 | render-style = "read"
|
103 | load-fonts = "false"
|
104 | show-header = "false"
|
105 | >
|
106 | <div slot="nav-logo" style="width:100%; display: flex;justify-content: center;">
|
107 | <button class='btn medium' onclick="document.getElementById('thedoc').setAttribute('schema-style', 'table')" >Table</button>
|
108 | <button class='btn medium' onclick="document.getElementById('thedoc').setAttribute('schema-style', 'tree')" >Tree</button>
|
109 | </div>
|
110 | <div slot="put-/pet" style="width:100%; display: flex;justify-content: center;">
|
111 | <b style="color:red"> Hello world</b>
|
112 | </div>
|
113 | </rapi-doc>
|
114 | -->
|
115 | <!--
|
116 | <rapi-doc id = "thedoc" ></rapi-doc>
|
117 | <script>
|
118 | document.addEventListener('DOMContentLoaded', (event) => {
|
119 | let docEl = document.getElementById("thedoc");
|
120 | let strSpec = `
|
121 | {
|
122 | "openapi": "3.0.1",
|
123 | "info": {
|
124 | "title": "My API",
|
125 | "version": "v1"
|
126 | },
|
127 | "paths": {
|
128 | "/api/Todo/complicated": {
|
129 | "get": {
|
130 | "tags": [
|
131 | "Todo"
|
132 | ],
|
133 | "summary": "Complicated action.",
|
134 | "responses": {
|
135 | "200": {
|
136 | "description": "Returns a complicated class.",
|
137 | "content": {
|
138 | "application/json": {
|
139 | "schema": {
|
140 | "$ref": "#/components/schemas/ComplicatedClass"
|
141 | }
|
142 | }
|
143 | }
|
144 | }
|
145 | }
|
146 | }
|
147 | }
|
148 | },
|
149 | "components": {
|
150 | "schemas": {
|
151 | "Tag": {
|
152 | "enum": [
|
153 | 0,
|
154 | 1,
|
155 | 2
|
156 | ],
|
157 | "type": "integer",
|
158 | "description": "Tag for TodoItem.",
|
159 | "format": "int32"
|
160 | },
|
161 | "InnerEnum": {
|
162 | "enum": [
|
163 | 1
|
164 | ],
|
165 | "type": "integer",
|
166 | "description": "Inner enum.",
|
167 | "format": "int32"
|
168 | },
|
169 | "SecondInnerEnum": {
|
170 | "enum": [
|
171 | 0
|
172 | ],
|
173 | "type": "integer",
|
174 | "description": "Second inner enum.",
|
175 | "format": "int32"
|
176 | },
|
177 | "SecondInnerEnumSecondInnerClass": {
|
178 | "type": "object",
|
179 | "properties": {
|
180 | "innerEnum": {
|
181 | "allOf": [
|
182 | {
|
183 | "$ref": "#/components/schemas/SecondInnerEnum"
|
184 | }
|
185 | ],
|
186 | "description": "Second inner enum."
|
187 | }
|
188 | },
|
189 | "additionalProperties": false,
|
190 | "description": "Second inner class."
|
191 | },
|
192 | "InnerClass": {
|
193 | "type": "object",
|
194 | "properties": {
|
195 | "innerEnum": {
|
196 | "type": "array",
|
197 | "items": {
|
198 | "$ref": "#/components/schemas/InnerEnum"
|
199 | },
|
200 | "description": "List of inner enums.",
|
201 | "nullable": true
|
202 | },
|
203 | "secondInnerClass": {
|
204 | "allOf": [
|
205 | {
|
206 | "$ref": "#/components/schemas/SecondInnerEnumSecondInnerClass"
|
207 | }
|
208 | ],
|
209 | "description": "Second inner class.",
|
210 | "nullable": true
|
211 | }
|
212 | },
|
213 | "additionalProperties": false,
|
214 | "description": "Inner class."
|
215 | },
|
216 | "ComplicatedClass": {
|
217 | "type": "object",
|
218 | "properties": {
|
219 | "tag": {
|
220 | "allOf": [
|
221 | {
|
222 | "$ref": "#/components/schemas/Tag"
|
223 | }
|
224 | ],
|
225 | "description": "Tag."
|
226 | },
|
227 | "innerClass": {
|
228 | "allOf": [
|
229 | {
|
230 | "$ref": "#/components/schemas/InnerClass"
|
231 | }
|
232 | ],
|
233 | "description": "Inner class.",
|
234 | "nullable": true
|
235 | }
|
236 | },
|
237 | "additionalProperties": false,
|
238 | "description": "Complicated class for testing enums."
|
239 | }
|
240 | }
|
241 | }
|
242 | }
|
243 | `;
|
244 | let objSpec = JSON.parse(strSpec);
|
245 | docEl.loadSpec(objSpec);
|
246 | })
|
247 | </script>
|
248 | -->
|
249 | </body>
|
250 |
|
251 | </html> |
\ | No newline at end of file |