Skip to content

Commit a33cbd8

Browse files
committed
Fixed - request-body pre-supplied example must be given preference
1 parent 172d26a commit a33cbd8

File tree

7 files changed

+130
-236
lines changed

7 files changed

+130
-236
lines changed

docs/examples/user-example.html renamed to docs/examples/predefined-example.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
</style>
2121
</head>
2222
<body>
23-
<rapi-doc spec-url="../specs/user-example.yaml" style="min-width:460px"> </rapi-doc>
23+
<rapi-doc spec-url="../specs/predefined-example.yaml" style="min-width:460px"> </rapi-doc>
2424
</body>
2525
</html>

docs/list.html

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,19 +137,7 @@
137137
<div style="display:flex; flex-direction: column; margin:20px 32px">
138138
<table class="m-table">
139139
<tr> <th style="text-align:left">List of Test cases</th></tr>
140-
<tr>
141-
<td class="mono-bold">
142-
<a href="./tests/performance.html"> Performance </a>
143-
<span class="gray descr"> Loading a large spec with lots of markdown </span>
144-
</td>
145-
</tr>
146140

147-
<tr>
148-
<td class="mono-bold">
149-
<a href="./tests/xxx-of-recursive.html"> Various cases </a>
150-
<span class="gray descr"> Spec containing one-of, all-of with primitive types, recursive models and readonly-attributes </span>
151-
</td>
152-
</tr>
153141
<tr>
154142
<td class="mono-bold">
155143
<a href="./examples/data-types.html"> Data types </a>
@@ -193,12 +181,26 @@
193181
<tr> <td class="mono-bold">
194182
<a href="./examples/xml.html"> XML response </a>
195183
</td></tr>
184+
<tr> <td class="mono-bold">
185+
<a href="./examples/xml.html"> Predefined Example </a>
186+
</td></tr>
196187
<tr> <td class="mono-bold">
197188
<a href="./examples/dynamic-query-params.html"> Dynamic Query Params </a>
198189
</td></tr>
199190
<tr> <td class="mono-bold">
200191
<a href="./examples/read-mode-dark.html"> Dark Read Mode </a>
201192
</td></tr>
193+
<tr><td class="mono-bold">
194+
<a href="./tests/xxx-of-recursive.html"> Various cases </a>
195+
<span class="gray descr"> Spec containing one-of, all-of with primitive types, recursive models and readonly-attributes </span>
196+
</td></tr>
197+
<tr>
198+
<td class="mono-bold">
199+
<a href="./tests/performance.html"> Performance </a>
200+
<span class="gray descr"> Loading a large spec with lots of markdown </span>
201+
</td>
202+
</tr>
203+
202204
</table>
203205
</div>
204206

docs/specs/predefined-example.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
openapi: 3.0.2
2+
info:
3+
version: '1.0'
4+
title: My OpenAPI
5+
description: OpenAPI with examples
6+
servers:
7+
- url: /api
8+
paths:
9+
/dogs:
10+
post:
11+
tags:
12+
- dog
13+
summary: Create a Dog
14+
requestBody:
15+
description: A Dog
16+
content:
17+
application/json:
18+
schema:
19+
$ref: '#/components/schemas/Dog'
20+
examples:
21+
example-1:
22+
value:
23+
name: Fido
24+
example-2:
25+
value:
26+
name: Dido
27+
responses:
28+
'201':
29+
description: Created
30+
content:
31+
application/json:
32+
schema:
33+
$ref: '#/components/schemas/Dog'
34+
examples:
35+
example-1:
36+
value:
37+
name: Fido
38+
example-2:
39+
value:
40+
name: Dido
41+
components:
42+
schemas:
43+
Dog:
44+
type: object
45+
properties:
46+
name:
47+
type: string
48+
pattern: '^[A-Za-z]+'
49+
required:
50+
- name

docs/specs/temp.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
openapi: 3.0.2
2+
info:
3+
version: '1.0'
4+
title: My OpenAPI
5+
description: OpenAPI with examples
6+
servers:
7+
- url: /api
8+
paths:
9+
/dogs:
10+
post:
11+
tags:
12+
- dog
13+
summary: Create a Dog
14+
requestBody:
15+
description: A Dog
16+
content:
17+
application/json:
18+
schema:
19+
$ref: '#/components/schemas/Dog'
20+
examples:
21+
example-1:
22+
value:
23+
name: Fido
24+
example-2:
25+
value:
26+
name: Dido
27+
responses:
28+
'201':
29+
description: Created
30+
content:
31+
application/json:
32+
schema:
33+
$ref: '#/components/schemas/Dog'
34+
examples:
35+
example-1:
36+
value:
37+
name: Fido
38+
example-2:
39+
value:
40+
name: Dido
41+
components:
42+
schemas:
43+
Dog:
44+
type: object
45+
properties:
46+
name:
47+
type: string
48+
pattern: '^[A-Za-z]+'
49+
required:
50+
- name

docs/specs/user-example.yaml

Lines changed: 0 additions & 220 deletions
This file was deleted.

docs/specs/xml.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ paths:
1313
content:
1414
application/xml:
1515
examples:
16-
xml:
16+
example-1:
1717
summary: XML Example
1818
value: |
1919
<person>

0 commit comments

Comments
 (0)