Skip to content

Commit 24ab436

Browse files
committed
fixed example generation for all-of, one-of and any-of
1 parent a1ae2de commit 24ab436

18 files changed

+445
-270
lines changed

dist/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
https://assets.zuora.com/zuora-documentation/swagger.yaml <<< Large spec with lot of markdown
1818
./examples/specs/petstore_anyof.yaml
1919
-->
20-
<rapi-doc id="thedoc" spec-url="./examples/specs/petstore_anyof.yaml"> </rapi-doc>
20+
<rapi-doc id="thedoc" spec-url="./examples/specs/allof.json"> </rapi-doc>
2121

2222
<!--
2323
<script>

dist/index.html.gz

5 Bytes
Binary file not shown.

dist/rapidoc-min.js

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

dist/rapidoc-min.js.gz

16.4 KB
Binary file not shown.

dist/rapidoc-min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rapidoc-min.js.map.gz

1 Byte
Binary file not shown.

dist/report.html

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

docs/examples/list.html

Lines changed: 42 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</head>
2828

2929
<body>
30-
<div class="banner container" id="banner">
30+
<div class="banner container" id="banner" style="padding:20px 32px">
3131
<div class="header">
3232
<img class="logo" src="../images/logo.png" style="width:48px;height:48px;margin-right:10px;" />
3333
<div class="product-name">&lt;rapi-doc&gt;</div>
@@ -38,13 +38,9 @@
3838
<a class="menu-item" data-action="url" href="https://mrin9.github.io/RapiPdf/"> RapiPDF </a>
3939
</nav>
4040
</div>
41-
4241
<div>
43-
<div class="banner-content">
42+
<div>
4443
<h1 class="banner-title">Web Component for OpenAPI Spec Viewing</h1>
45-
<div class="banner-content-inner">
46-
<p style="font-size:18px">List of all examples</p>
47-
</div>
4844
</div>
4945
</div>
5046
</div>
@@ -55,59 +51,71 @@ <h1 class="banner-title">Web Component for OpenAPI Spec Viewing</h1>
5551
<div class="table-block">
5652
<table class="m-table">
5753
<tr>
58-
<th style="text-align:left">Link</th>
59-
<th style="text-align:left">Description </th>
54+
<th style="text-align:left">List of Examples</th>
6055
</tr>
6156
<tr>
62-
<td class="mono-bold"> <a href="./example100.html"> Playground </a> </td>
63-
<td class="gray">Shows various things that can be controlled using script </td>
57+
<td class="mono-bold">
58+
<a href="./example100.html"> Playground </a>
59+
<span class="gray descr"> Shows various things that can be controlled using script </span>
60+
</td>
6461
</tr>
6562
<tr>
66-
<td class="mono-bold"> <a href="./example1.html"> Example 1 </a> </td>
67-
<td class="gray">Basic usage </td>
63+
<td class="mono-bold">
64+
<a href="./example1.html"> Basic Usage </a> </td>
65+
</td>
6866
</tr>
6967
<tr>
70-
<td class="mono-bold"> <a href="./example2.html"> Example 2 </a> </td>
71-
<td class="gray">Apply a dark theme </td>
68+
<td class="mono-bold">
69+
<a href="./example2.html"> Dark Theme </a>
70+
</td>
7271
</tr>
7372
<tr>
74-
<td class="mono-bold"> <a href="./example3.html"> Example 3 </a> </td>
75-
<td class="gray">Change header color and primary color on a dark theme </td>
73+
<td class="mono-bold">
74+
<a href="./example3.html"> Change Header Color </a>
75+
</td>
7676
</tr>
7777
<tr>
78-
<td class="mono-bold"> <a href="./example4.html"> Example 4 </a> </td>
79-
<td class="gray">Embed it in another html </td>
78+
<td class="mono-bold">
79+
<a href="./example4.html"> Embeded </a>
80+
<span class="gray descr"> Shows how rapi-doc element can be embeded into a different html document </span>
81+
</td>
8082
</tr>
8183
<tr>
82-
<td class="mono-bold"> <a href="./example5.html"> Example 5 </a> </td>
83-
<td class="gray">Change the font </td>
84+
<td class="mono-bold">
85+
<a href="./example5.html"> Apply Custom Font </a>
86+
</td>
8487
</tr>
8588
<tr>
86-
<td class="mono-bold"> <a href="./example6.html"> Example 6 </a> </td>
87-
<td class="gray">Change the logo </td>
89+
<td class="mono-bold">
90+
<a href="./example6.html"> Change Logo </a>
91+
</td>
8892
</tr>
8993
<tr>
90-
<td class="mono-bold"> <a href="./example7.html"> Example 7 </a> </td>
91-
<td class="gray">Add your own html in various sections (slots) </td>
94+
<td class="mono-bold">
95+
<a href="./example7.html"> Add your own HTML</a>
96+
<div class="gray descr"> Show how to add custom HTML elements such as paragraphs, buttons textboxes etc in various sections (slots) </div>
97+
</td>
9298
</tr>
9399
<tr>
94-
<td class="mono-bold"> <a href="./example8.html"> Example 8 </a> </td>
95-
<td class="gray">Add custom html and functionality (like Authentication) <br/>
96-
The example shows a text-box and a blue button is added on the header. Clicking on the button
97-
will read authentication-token provided by the user in the text-box and apply it to rapi-doc web component
98-
</td>
100+
<td class="mono-bold">
101+
<a href="./example8.html"> Add custom functionality </a>
102+
<div class="gray descr">
103+
The example shows a text-box and a blue button is added on the header. Clicking on the button
104+
will read authentication-token provided by the user in the text-box and apply it to rapi-doc web component
105+
</div>
106+
</td>
99107
</tr>
100108
<tr>
101-
<td class="mono-bold"> <a href="./example9.html"> Example 9 </a> </td>
102-
<td class="gray">Instead of passing a spec-url, you can even pass a valid json object</td>
109+
<td class="mono-bold">
110+
<a href="./example9.html"> JSON Object as OpenAPI-spec </a>
111+
</td>
103112
</tr>
104113
<tr>
105114
<td class="mono-bold">
106-
<a href="./oneof.html"> one-of </a>
107-
<a href="./anyof.html"> any-of </a>
115+
<a href="./oneof.html"> one-of </a>,
116+
<a href="./anyof.html"> any-of </a> and
108117
<a href="./allof.html"> all-of </a>
109118
</td>
110-
<td class="gray">Shows open-api spec contating model composition using all-off, one-of and any-of</td>
111119
</tr>
112120
</table>
113121
</div>

docs/examples/specs/allof.json

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,9 @@
4343
},
4444
"Employee": {
4545
"description": "Employee Details (Worker or Manager)",
46-
"oneOf": [
47-
{
48-
"$ref": "#/definitions/name"
49-
},
50-
{
51-
"$ref": "#/definitions/job"
52-
}
46+
"allOf": [
47+
{ "$ref": "#/definitions/name"},
48+
{ "$ref": "#/definitions/job"}
5349
]
5450
}
5551
}
@@ -68,7 +64,7 @@
6864
"properties": {
6965
"jobTitle": { "type": "string", "description": "Job title" },
7066
"department": { "type": "string", "description": "Department name"},
71-
"salary": { "type": "number", "description": "Salary per annum"}
67+
"salary": {"type": "number", "description": "Salary per annum"}
7268
}
7369
}
7470
},

docs/examples/specs/allof1.json

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
{
2+
"swagger": "2.0",
3+
"info": {
4+
"title": "all-of Models",
5+
"description": "Spec containing model composition using all-of. Checkout the model definition under the RESPONSE section"
6+
},
7+
"consumes": [
8+
"application/json"
9+
],
10+
"produces": [
11+
"application/json"
12+
],
13+
"paths": {
14+
"/api/employee": {
15+
"get": {
16+
"tags": [
17+
"Employee Details"
18+
],
19+
"summary": "List of employees",
20+
"operationId": "empDetails",
21+
"responses": {
22+
"200": {
23+
"description": "Checkout the model tab to view object schemas defined using all-of",
24+
"schema": {
25+
"type": "array",
26+
"items": {
27+
"$ref": "#/definitions/employee"
28+
}
29+
}
30+
}
31+
}
32+
}
33+
}
34+
},
35+
"definitions": {
36+
"employee": {
37+
"type": "object",
38+
"additionalProperties": false,
39+
"properties": {
40+
"Id": {
41+
"type": "string",
42+
"description": "Employee ID"
43+
},
44+
"Employee": {
45+
"description": "Employee Details (Worker or Manager)",
46+
"allOf": [
47+
{ "$ref": "#/definitions/name"},
48+
{ "$ref": "#/definitions/job"},
49+
{ "$ref": "#/definitions/dob"},
50+
{ "$ref": "#/definitions/salary"}
51+
]
52+
}
53+
}
54+
},
55+
"name": {
56+
"type": "object",
57+
"additionalProperties": false,
58+
"properties": {
59+
"firstName": { "type": "string", "description": "First name" },
60+
"lastName": { "type": "string", "description": "Last Name" }
61+
}
62+
},
63+
"job": {
64+
"type": "object",
65+
"additionalProperties": false,
66+
"properties": {
67+
"jobTitle": { "type": "string", "description": "Job title" },
68+
"department": { "type": "string", "description": "Department name"}
69+
}
70+
},
71+
"dob": {"type": "string", "format": "date", "description": "Date of birth"},
72+
"salary": {"type": "number", "description": "Salary per annum"}
73+
},
74+
"tags": [
75+
{
76+
"name": "Employee Details",
77+
"description": "Employee Details"
78+
}
79+
]
80+
}

0 commit comments

Comments
 (0)