Skip to content

Commit a5fa44e

Browse files
committed
added support for uploading multiple files using form-data and request-body
1 parent 15fdad4 commit a5fa44e

File tree

11 files changed

+306
-104
lines changed

11 files changed

+306
-104
lines changed

dist/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
> </rapi-doc>
3434
-->
3535

36-
<rapi-doc spec-url="./specs/dynamic-form-params.yaml" render-style='read' allow-server-selection="false" allow-authentication="false"> </rapi-doc>
36+
<rapi-doc spec-url="./specs/file-upload.yaml" render-style='read' allow-server-selection="false" allow-authentication="false"> </rapi-doc>
3737

3838
<!--
3939
<rapi-doc

dist/index.html.gz

-6 Bytes
Binary file not shown.

dist/rapidoc-min.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rapidoc-min.js.gz

321 Bytes
Binary file not shown.

dist/report.html

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

docs/examples/file-upload.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!doctype html>
2+
<head>
3+
<!-- Global site tag (gtag.js) - Google Analytics -->
4+
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-132775238-1"></script>
5+
<script>
6+
window.dataLayer = window.dataLayer || [];
7+
function gtag(){dataLayer.push(arguments);}
8+
gtag('js', new Date());
9+
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="text/javascript" src="../rapidoc-min.js"></script>
16+
<style>
17+
rapi-doc{
18+
width:100%;
19+
}
20+
</style>
21+
</head>
22+
<body>
23+
<rapi-doc spec-url="../specs/file-upload.yaml" render-style='read' allow-server-selection="false" allow-authentication="false"> </rapi-doc>
24+
</body>
25+
</html>

docs/list.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,9 @@
218218
<tr> <td class="mono-bold">
219219
<a href="./examples/dynamic-form-params.html"> Dynamic Form Params </a>
220220
</td></tr>
221+
<tr> <td class="mono-bold">
222+
<a href="./examples/file-upload.html"> File upload </a>
223+
</td></tr>
221224
<tr> <td class="mono-bold">
222225
<a href="./examples/read-mode-dark.html"> Dark Read Mode </a>
223226
</td></tr>

docs/rapidoc-min.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/specs/file-upload.yaml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
openapi: 3.0.0
2+
info:
3+
title: Various ways to upload files (binary content)
4+
version: 1.0.0
5+
description: |
6+
7+
```
8+
openapi: 3.0.0
9+
info:
10+
title: Various ways to upload files (binary content)
11+
version: 1.0.0
12+
paths:
13+
/upload-1-file:
14+
post:
15+
tags:
16+
- File Upload
17+
summary: uploads single file using form-data
18+
requestBody:
19+
content:
20+
application/x-www-form-urlencoded:
21+
schema:
22+
type: object
23+
properties:
24+
filename:
25+
type: string
26+
format: binary
27+
responses:
28+
'200':
29+
description: OK
30+
31+
/upload-multiple-file:
32+
post:
33+
tags:
34+
- File Upload
35+
summary: uploads multiple file using form-data and type as 'array'
36+
requestBody:
37+
content:
38+
application/x-www-form-urlencoded:
39+
schema:
40+
type: object
41+
properties:
42+
filename:
43+
type: array
44+
items:
45+
type: string
46+
format: binary
47+
responses:
48+
'200':
49+
description: OK
50+
51+
/upload-using-request-body:
52+
post:
53+
tags:
54+
- File Upload
55+
summary: uploads single file using request-body content-type as application/octet-stream
56+
requestBody:
57+
content:
58+
application/octet-stream:
59+
schema:
60+
type: string
61+
format: binary
62+
responses:
63+
'200':
64+
description: successful operation
65+
```
66+
67+
paths:
68+
/upload-1-file:
69+
post:
70+
tags:
71+
- File Upload
72+
summary: uploads single file using form-data
73+
requestBody:
74+
content:
75+
application/x-www-form-urlencoded:
76+
schema:
77+
type: object
78+
properties:
79+
filename:
80+
type: string
81+
format: binary
82+
responses:
83+
'200':
84+
description: OK
85+
86+
/upload-multiple-file:
87+
post:
88+
tags:
89+
- File Upload
90+
summary: uploads multiple file using form-data and type as 'array'
91+
requestBody:
92+
content:
93+
application/x-www-form-urlencoded:
94+
schema:
95+
type: object
96+
properties:
97+
filename:
98+
type: array
99+
items:
100+
type: string
101+
format: binary
102+
responses:
103+
'200':
104+
description: OK
105+
106+
/upload-using-request-body:
107+
post:
108+
tags:
109+
- File Upload
110+
summary: uploads single file using request-body content-type as application/octet-stream
111+
requestBody:
112+
content:
113+
application/octet-stream:
114+
schema:
115+
type: string
116+
format: binary
117+
responses:
118+
'200':
119+
description: successful operation

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
> </rapi-doc>
3434
-->
3535

36-
<rapi-doc spec-url="./specs/dynamic-form-params.yaml" render-style='read' allow-server-selection="false" allow-authentication="false"> </rapi-doc>
36+
<rapi-doc spec-url="./specs/file-upload.yaml" render-style='read' allow-server-selection="false" allow-authentication="false"> </rapi-doc>
3737

3838
<!--
3939
<rapi-doc

0 commit comments

Comments
 (0)