Skip to content

Commit ca54ee0

Browse files
committed
improved example specs
1 parent 93a5173 commit ca54ee0

File tree

5 files changed

+77
-140
lines changed

5 files changed

+77
-140
lines changed

docs/examples/file-upload.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
</head>
2323
<body>
2424
<rapi-doc spec-url="../specs/file-upload.yaml"
25+
show-info = "false"
26+
allow-server-selection = "false"
2527
allow-authentication = "false"
2628
show-header = "false"
2729
render-style = "read"

docs/rapidoc-min.js

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

docs/specs/dynamic-form-params.yaml

Lines changed: 20 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,54 +4,31 @@ info:
44
version: 1.0.0
55
description: >
66
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,
469
paths:
47-
/submit-1:
10+
/dynamic-form-parameters:
4811
post:
4912
tags:
5013
- Form Params
5114
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+
```
5229
requestBody:
5330
content:
54-
application/x-www-form-urlencoded:
31+
multipart/form-data:
5532
schema:
5633
type: object
5734
description: >
@@ -79,14 +56,14 @@ paths:
7956
responses:
8057
'200':
8158
description: OK
82-
/submit-2:
59+
/fixed-form-parameters:
8360
post:
8461
tags:
8562
- Form Params
8663
summary: Fixed Params
8764
requestBody:
8865
content:
89-
application/x-www-form-urlencoded:
66+
multipart/form-data:
9067
schema:
9168
type: object
9269
description: name and age are fixed form params

docs/specs/file-upload.yaml

Lines changed: 46 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -2,74 +2,27 @@ openapi: 3.0.0
22
info:
33
title: Various ways to upload files (binary content)
44
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-
675
paths:
68-
/upload-1-file:
6+
/upload-single-file:
697
post:
708
tags:
719
- File Upload
7210
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+
```
7326
requestBody:
7427
content:
7528
multipart/form-data:
@@ -83,13 +36,30 @@ paths:
8336
format: binary
8437
responses:
8538
'200':
86-
description: OK
39+
summary: OK
8740

8841
/upload-multiple-file:
8942
post:
9043
tags:
9144
- File Upload
9245
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+
```
9363
requestBody:
9464
content:
9565
multipart/form-data:
@@ -112,6 +82,18 @@ paths:
11282
tags:
11383
- File Upload
11484
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+
```
11597
requestBody:
11698
content:
11799
application/octet-stream:

docs/specs/server.yaml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ info:
66
Various ways to define API servers in the spec including variables
77
88
```
9-
openapi: 3.0.2
10-
info:
11-
version: '1.0'
12-
title: Server Variables
13-
description: For testing Server variables
149
servers:
1510
- url: 'http://example.com/api'
1611
description: Test server (just for example)
@@ -45,25 +40,6 @@ info:
4540
enum:
4641
- v1
4742
- 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
6743
```
6844
servers:
6945
- url: 'http://example.com/api'

0 commit comments

Comments
 (0)