Skip to content

Commit 19f2536

Browse files
committed
added support for server variables
1 parent 1823915 commit 19f2536

23 files changed

+569
-471
lines changed

dist/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222

2323
<rapi-doc
2424
id = "thedoc"
25-
spec-url = "./specs/pet.yaml"
25+
spec-url = "./specs/server.yaml"
2626
theme = "dark"
27-
render-style = "view"
27+
render-style = "read"
2828
regular-font = 'Open Sans'
2929
schema-style = 'tree'
3030
goto-path= 'post-/person'
31-
aapi-key-name = "abcd"
32-
aapi-key-location = "header"
33-
aapi-key-value = "abcd"
31+
api-key-name = "my-key"
32+
api-key-location = "header"
33+
api-key-value = "mye-password"
3434
> </rapi-doc>
3535

3636

dist/index.html.gz

7 Bytes
Binary file not shown.

dist/rapidoc-min.js

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

dist/rapidoc-min.js.gz

508 Bytes
Binary file not shown.

dist/report.html

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

docs/examples/server-vars.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
</head>
17+
<body>
18+
<rapi-doc spec-url = "../specs/server.yaml" render-style = "read" theme="dark" show-header="false"> </rapi-doc>
19+
</body>
20+
</html>

docs/list.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@
140140
<a href="./examples/example9.html"> JSON Object as OpenAPI-spec </a>
141141
</td>
142142
</tr>
143+
<tr>
144+
<td class="mono-bold">
145+
<a href="./examples/server-vars.html"> Server Variables </a>
146+
</td>
147+
</tr>
143148
<tr>
144149
<td class="mono-bold">
145150
<a href="./examples/oneof.html"> one-of </a>,

docs/rapidoc-min.js

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

docs/specs/callback.yaml

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
openapi: 3.0.0
2+
info:
3+
title: Callback Example
4+
version: 1.0.0
5+
paths:
6+
/streams:
7+
post:
8+
description: subscribes a client to receive out-of-band data
9+
parameters:
10+
- name: callbackUrl
11+
in: query
12+
required: true
13+
description: |
14+
the location where data will be sent. Must be network accessible
15+
by the source server
16+
schema:
17+
type: string
18+
format: uri
19+
example: https://tonys-server.com
20+
responses:
21+
'201':
22+
description: subscription successfully created
23+
content:
24+
application/json:
25+
schema:
26+
description: subscription information
27+
required:
28+
- subscriptionId
29+
properties:
30+
subscriptionId:
31+
description: this unique identifier allows management of the subscription
32+
type: string
33+
example: 2531329f-fb09-4ef7-887e-84e648214436
34+
callbacks:
35+
# the name `onData` is a convenience locator
36+
onData:
37+
# when data is sent, it will be sent to the `callbackUrl` provided
38+
# when making the subscription PLUS the suffix `/data`
39+
'{$request.query.callbackUrl1}/data':
40+
post:
41+
requestBody:
42+
description: subscription POST payload
43+
content:
44+
application/json:
45+
schema:
46+
type: object
47+
properties:
48+
timestamp:
49+
type: string
50+
format: date-time
51+
userData:
52+
type: string
53+
responses:
54+
'202':
55+
description: |
56+
Your server implementation should return this HTTP status code
57+
if the data was received successfully
58+
'204':
59+
description: |
60+
Your server should return this HTTP status code if no longer interested
61+
in further updates
62+
put:
63+
requestBody:
64+
description: subscription PUT payload
65+
content:
66+
application/json:
67+
schema:
68+
type: object
69+
properties:
70+
timestamp:
71+
type: string
72+
format: date-time
73+
userData:
74+
type: string
75+
responses:
76+
'202':
77+
description: |
78+
Your server implementation should return this HTTP status code
79+
if the data was received successfully
80+
'204':
81+
description: |
82+
Your server should return this HTTP status code if no longer interested
83+
in further updates
84+
'{$request.query.callbackUrl2}/data':
85+
post:
86+
requestBody:
87+
description: subscription POST payload
88+
content:
89+
application/json:
90+
schema:
91+
type: object
92+
properties:
93+
timestamp:
94+
type: string
95+
format: date-time
96+
userData:
97+
type: string
98+
responses:
99+
'202':
100+
description: |
101+
Your server implementation should return this HTTP status code
102+
if the data was received successfully
103+
'204':
104+
description: |
105+
Your server should return this HTTP status code if no longer interested
106+
in further updates
107+
put:
108+
requestBody:
109+
description: subscription PUT payload
110+
content:
111+
application/json:
112+
schema:
113+
type: object
114+
properties:
115+
timestamp:
116+
type: string
117+
format: date-time
118+
userData:
119+
type: string
120+
responses:
121+
'202':
122+
description: |
123+
Your server implementation should return this HTTP status code
124+
if the data was received successfully
125+
'204':
126+
description: |
127+
Your server should return this HTTP status code if no longer interested
128+
in further updates
129+
onData2:
130+
# when data is sent, it will be sent to the `callbackUrl` provided
131+
# when making the subscription PLUS the suffix `/data`
132+
'{$request.query.callbackUrl}/data':
133+
post:
134+
requestBody:
135+
description: subscription payload
136+
content:
137+
application/json:
138+
schema:
139+
type: object
140+
properties:
141+
timestamp:
142+
type: string
143+
format: date-time
144+
userData:
145+
type: string
146+
responses:
147+
'202':
148+
description: |
149+
Your server implementation should return this HTTP status code
150+
if the data was received successfully
151+
'204':
152+
description: |
153+
Your server should return this HTTP status code if no longer interested
154+
in further updates

docs/specs/pet.yaml

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
openapi: "3.0.0"
2+
info:
3+
version: 1.0.0
4+
title: Swagger Petstore
5+
license:
6+
name: MIT
7+
servers:
8+
- url: http://petstore.swagger.io/v1
9+
paths:
10+
/pets:
11+
get:
12+
summary: List all pets
13+
operationId: listPets
14+
tags:
15+
- pets
16+
parameters:
17+
- name: limit
18+
in: query
19+
description: How many items to return at one time (max 100)
20+
required: false
21+
schema:
22+
type: integer
23+
format: int32
24+
responses:
25+
'200':
26+
description: A paged array of pets
27+
headers:
28+
x-next:
29+
description: A link to the next page of responses
30+
schema:
31+
type: string
32+
content:
33+
application/json:
34+
schema:
35+
$ref: "#/components/schemas/Pets"
36+
default:
37+
description: unexpected error
38+
content:
39+
application/json:
40+
schema:
41+
$ref: "#/components/schemas/Error"
42+
post:
43+
summary: Create a pet
44+
operationId: createPets
45+
tags:
46+
- pets
47+
responses:
48+
'201':
49+
description: Null response
50+
default:
51+
description: unexpected error
52+
content:
53+
application/json:
54+
schema:
55+
$ref: "#/components/schemas/Error"
56+
/pets/{petId}:
57+
get:
58+
summary: Info for a specific pet
59+
operationId: showPetById
60+
tags:
61+
- pets
62+
parameters:
63+
- name: petId
64+
in: path
65+
required: true
66+
description: The id of the pet to retrieve
67+
schema:
68+
type: string
69+
responses:
70+
'200':
71+
description: Expected response to a valid request
72+
content:
73+
application/json:
74+
schema:
75+
$ref: "#/components/schemas/Pet"
76+
default:
77+
description: unexpected error
78+
content:
79+
application/json:
80+
schema:
81+
$ref: "#/components/schemas/Error"
82+
components:
83+
securitySchemes:
84+
petstore_auth:
85+
description: |
86+
Get access to data while protecting your account credentials.
87+
OAuth2 is also a safer and more secure way to give you access.
88+
type: oauth2
89+
flows:
90+
implicit:
91+
authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
92+
scopes:
93+
'write:pets': modify pets in your account
94+
'read:pets': read your pets
95+
basicAuth: # <-- arbitrary name for the security scheme
96+
type: http
97+
scheme: basic
98+
bearerAuth: # <-- arbitrary name for the security scheme
99+
type: http
100+
scheme: bearer
101+
bearerFormat: JWT
102+
api_key1:
103+
description: For this sample, you can use the api key `special-key` to test the authorization filters.
104+
type: apiKey
105+
name: api_key1
106+
in: header
107+
api_key2:
108+
description: another api-key.
109+
type: apiKey
110+
name: api_key2
111+
in: header
112+
schemas:
113+
Pet:
114+
type: object
115+
required:
116+
- id
117+
- name
118+
properties:
119+
id:
120+
type: integer
121+
format: int64
122+
name:
123+
type: string
124+
tag:
125+
type: string
126+
Pets:
127+
type: array
128+
items:
129+
$ref: "#/components/schemas/Pet"
130+
Error:
131+
type: object
132+
required:
133+
- code
134+
- message
135+
properties:
136+
code:
137+
type: integer
138+
format: int32
139+
message:
140+
type: string
141+

0 commit comments

Comments
 (0)