File tree Expand file tree Collapse file tree 5 files changed +77
-140
lines changed Expand file tree Collapse file tree 5 files changed +77
-140
lines changed Original file line number Diff line number Diff line change 22
22
</ head >
23
23
< body >
24
24
< rapi-doc spec-url ="../specs/file-upload.yaml "
25
+ show-info = "false "
26
+ allow-server-selection = "false "
25
27
allow-authentication = "false "
26
28
show-header = "false "
27
29
render-style = "read "
Original file line number Diff line number Diff line change 4
4
version : 1.0.0
5
5
description : >
6
6
Following OpenAPI spec demonstrate various ways to pass form params.
7
- - you may pass predefined form params
8
- - you may create dynamic form params by defining a form-param as an object,
9
- in that case each key of the object will be treated as a seperate param
10
-
11
- ```
12
- openapi: 3.0.0
13
- info:
14
- title: Dynamic Form Params
15
- version: 1.0.0
16
- paths:
17
- /submit-1:
18
- post:
19
- summary: Dynamic Params
20
- requestBody:
21
- content:
22
- application/x-www-form-urlencoded:
23
- schema:
24
- type: object
25
- responses:
26
- '200':
27
- description: successful operation
28
-
29
- /submit-2:
30
- post:
31
- summary: Fixed Params
32
- requestBody:
33
- content:
34
- application/x-www-form-urlencoded:
35
- schema:
36
- type: object
37
- properties:
38
- name:
39
- type: string
40
- age:
41
- type: integer
42
- responses:
43
- '200':
44
- description: successful operation
45
- ```
7
+ - You may pass predefined form params
8
+ - You may create dynamic form params by defining a form-param as an object,
46
9
paths :
47
- /submit-1 :
10
+ /dynamic-form-parameters :
48
11
post :
49
12
tags :
50
13
- Form Params
51
14
summary : Dynamic Params
15
+ description : |
16
+ ```
17
+ /dynamic-form-parameters:
18
+ post:
19
+ summary: Dynamic Params
20
+ requestBody:
21
+ content:
22
+ multipart/form-data:
23
+ schema:
24
+ type: object
25
+ responses:
26
+ '200':
27
+ description: successful operation
28
+ ```
52
29
requestBody :
53
30
content :
54
- application/x-www- form-urlencoded :
31
+ multipart/ form-data :
55
32
schema :
56
33
type : object
57
34
description : >
@@ -79,14 +56,14 @@ paths:
79
56
responses :
80
57
' 200 ' :
81
58
description : OK
82
- /submit-2 :
59
+ /fixed-form-parameters :
83
60
post :
84
61
tags :
85
62
- Form Params
86
63
summary : Fixed Params
87
64
requestBody :
88
65
content :
89
- application/x-www- form-urlencoded :
66
+ multipart/ form-data :
90
67
schema :
91
68
type : object
92
69
description : name and age are fixed form params
Original file line number Diff line number Diff line change @@ -2,74 +2,27 @@ openapi: 3.0.0
2
2
info :
3
3
title : Various ways to upload files (binary content)
4
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
- multipart/form-data:
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
- multipart/form-data:
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
5
paths :
68
- /upload-1 -file :
6
+ /upload-single -file :
69
7
post :
70
8
tags :
71
9
- File Upload
72
10
summary : Uploads single file using form-data
11
+ description : |
12
+ ```
13
+ /upload-single-file:
14
+ post:
15
+ summary: Uploads single file using form-data
16
+ requestBody:
17
+ content:
18
+ multipart/form-data:
19
+ schema:
20
+ type: object
21
+ properties:
22
+ filename:
23
+ type: string
24
+ format: binary
25
+ ```
73
26
requestBody :
74
27
content :
75
28
multipart/form-data :
@@ -83,13 +36,30 @@ paths:
83
36
format : binary
84
37
responses :
85
38
' 200 ' :
86
- description : OK
39
+ summary : OK
87
40
88
41
/upload-multiple-file :
89
42
post :
90
43
tags :
91
44
- File Upload
92
45
summary : Uploads multiple file using form-data and type as 'array'
46
+ description : |
47
+ ```
48
+ /upload-multiple-file:
49
+ post:
50
+ summary: Uploads multiple file using form-data and type as 'array'
51
+ requestBody:
52
+ content:
53
+ multipart/form-data:
54
+ schema:
55
+ type: object
56
+ properties:
57
+ filename:
58
+ type: array
59
+ items:
60
+ type: string
61
+ format: binary
62
+ ```
93
63
requestBody :
94
64
content :
95
65
multipart/form-data :
@@ -112,6 +82,18 @@ paths:
112
82
tags :
113
83
- File Upload
114
84
summary : Uploads single file using request-body content-type as application/octet-stream
85
+ description : |
86
+ ```
87
+ /upload-using-request-body:
88
+ post:
89
+ summary: Uploads single file using request-body content-type as application/octet-stream
90
+ requestBody:
91
+ content:
92
+ application/octet-stream:
93
+ schema:
94
+ type: string
95
+ format: binary
96
+ ```
115
97
requestBody :
116
98
content :
117
99
application/octet-stream :
Original file line number Diff line number Diff line change 6
6
Various ways to define API servers in the spec including variables
7
7
8
8
```
9
- openapi: 3.0.2
10
- info:
11
- version: '1.0'
12
- title: Server Variables
13
- description: For testing Server variables
14
9
servers:
15
10
- url: 'http://example.com/api'
16
11
description: Test server (just for example)
45
40
enum:
46
41
- v1
47
42
- v2
48
- paths:
49
- /server-variables:
50
- get:
51
- summary: Server Variable.
52
- discription: Computed server url should be shown against `API SERVER`.
53
- responses:
54
- '200':
55
- description: successful operation
56
- content:
57
- application/json:
58
- schema:
59
- type: object
60
- properties:
61
- name:
62
- description: Person Name
63
- type: string
64
- age:
65
- description: Person Age
66
- type: integer
67
43
```
68
44
servers :
69
45
- url : ' http://example.com/api'
You can’t perform that action at this time.
0 commit comments