forked from rapi-doc/RapiDoc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
248 lines (240 loc) · 6.47 KB
/
index.html
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
<title>RapiDoc</title>
<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/default.min.css">
<script src="//cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js"></script>
</head>
<script>
window.addEventListener('DOMContentLoaded', (event) => {
const docEl = document.getElementById('thedoc');
docEl.addEventListener('before-try', (e) => {
e.detail.request.headers.append('AAA-BBB', 'CCC DDDD');
});
});
</script>
<body>
<!--
Some sample spec to try
https://api.apis.guru/v2/specs/stripe.com/2019-02-19/swagger.json
https://api.apis.guru/v2/specs/github.com/v3/swagger.json
https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json
https://petstore.swagger.io/v2/swagger.json
https://assets.zuora.com/zuora-documentation/swagger.yaml <<< Large spec with lot of markdown
./specs/petstore_anyof.yaml <<< contains complex one-of with inline primitives and recursive objects
./specs/oneof1.yaml <<< nested oneof
https://cesdev.eng.sonicwall.com/api/q/openapi
-->
<rapi-doc
spec-url = "./specs/temp.yaml"
id="thedoc"
theme = "dark"
render-style="read"
schema-style="tree"
show-method-in-nav-bar = "true"
use-path-in-nav-bar = "true"
show-components = "true"
show-info = "true"
show-header = "true"
allow-search = "false"
allow-advanced-search = "true"
allow-spec-url-load="false"
allow-spec-file-download="true"
allow-server-selection = "true"
allow-authentication = "true"
update-route="false"
match-type="regex"
persist-auth="true"
scroll-behavior="smooth"
></rapi-doc>
<!--
<rapi-doc-mini
style= "width:600px; padding:0 10px"
id = "thedoc"
spec-url="./specs/code-highlight.yaml"
theme = "light"
schema-style = 'table'
sort-endpoints-by = "method"
layout = "column"
match-paths = "post /code"
paths-expanded = "true"
> </rapi-doc-mini>
<br/>
<rapi-doc-mini
style= "width:600px; padding:0 10px"
id = "thedoc"
spec-url="./specs/code-highlight.yaml"
theme = "light"
schema-style = 'table'
sort-endpoints-by = "method"
layout = "column"
match-paths = "get /code"
> </rapi-doc-mini>
-->
<!--
<rapi-doc
id = "thedoc"
spec-url="./specs/code-highlight.yaml"
theme = "light"
render-style = "view"
schema-style = 'tree'
sort-endpoints-by = "method"
show-info = "false"
show-header = "false"
allow-server-selection = "false"
allow-authentication = "false"
> </rapi-doc>
<rapi-doc
id = "thedoc"
spec-url="https://petstore.swagger.io/v2/swagger.json1"
render-style = "read"
load-fonts = "false"
show-header = "false"
>
<div slot="nav-logo" style="width:100%; display: flex;justify-content: center;">
<button class='btn medium' onclick="document.getElementById('thedoc').setAttribute('schema-style', 'table')" >Table</button>
<button class='btn medium' onclick="document.getElementById('thedoc').setAttribute('schema-style', 'tree')" >Tree</button>
</div>
<div slot="put-/pet" style="width:100%; display: flex;justify-content: center;">
<b style="color:red"> Hello world</b>
</div>
</rapi-doc>
-->
<!--
<rapi-doc id = "thedoc" ></rapi-doc>
<script>
document.addEventListener('DOMContentLoaded', (event) => {
let docEl = document.getElementById("thedoc");
let strSpec = `
{
"openapi": "3.0.1",
"info": {
"title": "My API",
"version": "v1"
},
"paths": {
"/api/Todo/complicated": {
"get": {
"tags": [
"Todo"
],
"summary": "Complicated action.",
"responses": {
"200": {
"description": "Returns a complicated class.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ComplicatedClass"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Tag": {
"enum": [
0,
1,
2
],
"type": "integer",
"description": "Tag for TodoItem.",
"format": "int32"
},
"InnerEnum": {
"enum": [
1
],
"type": "integer",
"description": "Inner enum.",
"format": "int32"
},
"SecondInnerEnum": {
"enum": [
0
],
"type": "integer",
"description": "Second inner enum.",
"format": "int32"
},
"SecondInnerEnumSecondInnerClass": {
"type": "object",
"properties": {
"innerEnum": {
"allOf": [
{
"$ref": "#/components/schemas/SecondInnerEnum"
}
],
"description": "Second inner enum."
}
},
"additionalProperties": false,
"description": "Second inner class."
},
"InnerClass": {
"type": "object",
"properties": {
"innerEnum": {
"type": "array",
"items": {
"$ref": "#/components/schemas/InnerEnum"
},
"description": "List of inner enums.",
"nullable": true
},
"secondInnerClass": {
"allOf": [
{
"$ref": "#/components/schemas/SecondInnerEnumSecondInnerClass"
}
],
"description": "Second inner class.",
"nullable": true
}
},
"additionalProperties": false,
"description": "Inner class."
},
"ComplicatedClass": {
"type": "object",
"properties": {
"tag": {
"allOf": [
{
"$ref": "#/components/schemas/Tag"
}
],
"description": "Tag."
},
"innerClass": {
"allOf": [
{
"$ref": "#/components/schemas/InnerClass"
}
],
"description": "Inner class.",
"nullable": true
}
},
"additionalProperties": false,
"description": "Complicated class for testing enums."
}
}
}
}
`;
let objSpec = JSON.parse(strSpec);
docEl.loadSpec(objSpec);
})
</script>
-->
</body>
</html>