UNPKG

6.33 kBHTMLView Raw
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</head>
9
10<script>
11 window.addEventListener('DOMContentLoaded', (event) => {
12 const docEl = document.getElementById('thedoc');
13 docEl.addEventListener('before-try', (e) => {
14 e.detail.request.headers.append('AAA-BBB', 'CCC DDDD');
15 });
16 });
17</script>
18
19<body>
20<!--
21 Some sample spec to try
22 https://api.apis.guru/v2/specs/stripe.com/2019-02-19/swagger.json
23 https://api.apis.guru/v2/specs/github.com/v3/swagger.json
24 https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json
25 https://petstore.swagger.io/v2/swagger.json
26 https://assets.zuora.com/zuora-documentation/swagger.yaml <<< Large spec with lot of markdown
27 ./specs/petstore_anyof.yaml <<< contains complex one-of with inline primitives and recursive objects
28 ./specs/oneof1.yaml <<< nested oneof
29-->
30<rapi-doc
31 spec-url = "./specs/petstore.yaml"
32 route-prefix="#tab-pets/"
33 id="thedoc"
34 theme = "dark"
35 render-style="read"
36 schema-style="tree"
37 use-path-in-nav-bar="true"
38 show-components = "true"
39 show-info = "true"
40 show-header = "true"
41 allow-search = "false"
42 allow-advanced-search = "true"
43 allow-spec-url-load="false"
44 allow-spec-file-load="false"
45 allow-spec-file-download="true"
46 allow-server-selection = "true"
47 allow-authentication = "true"
48 match-type="regex"
49 persist-auth="true"
50></rapi-doc>
51<!--
52 <rapi-doc-mini
53 style= "width:600px; padding:0 10px"
54 id = "thedoc"
55 spec-url="./specs/code-highlight.yaml"
56 theme = "light"
57 schema-style = 'table'
58 sort-endpoints-by = "method"
59 layout = "column"
60 match-paths = "post /code"
61 paths-expanded = "true"
62 > </rapi-doc-mini>
63 <br/>
64 <rapi-doc-mini
65 style= "width:600px; padding:0 10px"
66 id = "thedoc"
67 spec-url="./specs/code-highlight.yaml"
68 theme = "light"
69 schema-style = 'table'
70 sort-endpoints-by = "method"
71 layout = "column"
72 match-paths = "get /code"
73 > </rapi-doc-mini>
74-->
75
76 <!--
77
78 <rapi-doc
79 id = "thedoc"
80 spec-url="./specs/code-highlight.yaml"
81 theme = "light"
82 render-style = "view"
83 schema-style = 'tree'
84 sort-endpoints-by = "method"
85 show-info = "false"
86 show-header = "false"
87 allow-server-selection = "false"
88 allow-authentication = "false"
89 > </rapi-doc>
90
91
92 <rapi-doc
93 id = "thedoc"
94 spec-url="https://petstore.swagger.io/v2/swagger.json1"
95 render-style = "read"
96 load-fonts = "false"
97 show-header = "false"
98 >
99 <div slot="nav-logo" style="width:100%; display: flex;justify-content: center;">
100 <button class='btn medium' onclick="document.getElementById('thedoc').setAttribute('schema-style', 'table')" >Table</button>
101 <button class='btn medium' onclick="document.getElementById('thedoc').setAttribute('schema-style', 'tree')" >Tree</button>
102 </div>
103 <div slot="put-/pet" style="width:100%; display: flex;justify-content: center;">
104 <b style="color:red"> Hello world</b>
105 </div>
106 </rapi-doc>
107-->
108<!--
109 <rapi-doc id = "thedoc" ></rapi-doc>
110 <script>
111 document.addEventListener('DOMContentLoaded', (event) => {
112 let docEl = document.getElementById("thedoc");
113 let strSpec = `
114 {
115 "openapi": "3.0.1",
116 "info": {
117 "title": "My API",
118 "version": "v1"
119 },
120 "paths": {
121 "/api/Todo/complicated": {
122 "get": {
123 "tags": [
124 "Todo"
125 ],
126 "summary": "Complicated action.",
127 "responses": {
128 "200": {
129 "description": "Returns a complicated class.",
130 "content": {
131 "application/json": {
132 "schema": {
133 "$ref": "#/components/schemas/ComplicatedClass"
134 }
135 }
136 }
137 }
138 }
139 }
140 }
141 },
142 "components": {
143 "schemas": {
144 "Tag": {
145 "enum": [
146 0,
147 1,
148 2
149 ],
150 "type": "integer",
151 "description": "Tag for TodoItem.",
152 "format": "int32"
153 },
154 "InnerEnum": {
155 "enum": [
156 1
157 ],
158 "type": "integer",
159 "description": "Inner enum.",
160 "format": "int32"
161 },
162 "SecondInnerEnum": {
163 "enum": [
164 0
165 ],
166 "type": "integer",
167 "description": "Second inner enum.",
168 "format": "int32"
169 },
170 "SecondInnerEnumSecondInnerClass": {
171 "type": "object",
172 "properties": {
173 "innerEnum": {
174 "allOf": [
175 {
176 "$ref": "#/components/schemas/SecondInnerEnum"
177 }
178 ],
179 "description": "Second inner enum."
180 }
181 },
182 "additionalProperties": false,
183 "description": "Second inner class."
184 },
185 "InnerClass": {
186 "type": "object",
187 "properties": {
188 "innerEnum": {
189 "type": "array",
190 "items": {
191 "$ref": "#/components/schemas/InnerEnum"
192 },
193 "description": "List of inner enums.",
194 "nullable": true
195 },
196 "secondInnerClass": {
197 "allOf": [
198 {
199 "$ref": "#/components/schemas/SecondInnerEnumSecondInnerClass"
200 }
201 ],
202 "description": "Second inner class.",
203 "nullable": true
204 }
205 },
206 "additionalProperties": false,
207 "description": "Inner class."
208 },
209 "ComplicatedClass": {
210 "type": "object",
211 "properties": {
212 "tag": {
213 "allOf": [
214 {
215 "$ref": "#/components/schemas/Tag"
216 }
217 ],
218 "description": "Tag."
219 },
220 "innerClass": {
221 "allOf": [
222 {
223 "$ref": "#/components/schemas/InnerClass"
224 }
225 ],
226 "description": "Inner class.",
227 "nullable": true
228 }
229 },
230 "additionalProperties": false,
231 "description": "Complicated class for testing enums."
232 }
233 }
234 }
235}
236 `;
237 let objSpec = JSON.parse(strSpec);
238 docEl.loadSpec(objSpec);
239 })
240 </script>
241-->
242</body>
243
244</html>
\No newline at end of file