Skip to content

Commit

Permalink
fixed example generation for all-of, one-of and any-of
Browse files Browse the repository at this point in the history
  • Loading branch information
mrin9 committed Sep 18, 2019
1 parent a1ae2de commit 24ab436
Show file tree
Hide file tree
Showing 18 changed files with 445 additions and 270 deletions.
2 changes: 1 addition & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
https://assets.zuora.com/zuora-documentation/swagger.yaml <<< Large spec with lot of markdown
./examples/specs/petstore_anyof.yaml
-->
<rapi-doc id="thedoc" spec-url="./examples/specs/petstore_anyof.yaml"> </rapi-doc>
<rapi-doc id="thedoc" spec-url="./examples/specs/allof.json"> </rapi-doc>

<!--
<script>
Expand Down
Binary file modified dist/index.html.gz
Binary file not shown.
28 changes: 14 additions & 14 deletions dist/rapidoc-min.js

Large diffs are not rendered by default.

Binary file modified dist/rapidoc-min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/rapidoc-min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified dist/rapidoc-min.js.map.gz
Binary file not shown.
5 changes: 3 additions & 2 deletions dist/report.html

Large diffs are not rendered by default.

76 changes: 42 additions & 34 deletions docs/examples/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</head>

<body>
<div class="banner container" id="banner">
<div class="banner container" id="banner" style="padding:20px 32px">
<div class="header">
<img class="logo" src="../images/logo.png" style="width:48px;height:48px;margin-right:10px;" />
<div class="product-name">&lt;rapi-doc&gt;</div>
Expand All @@ -38,13 +38,9 @@
<a class="menu-item" data-action="url" href="https://mrin9.github.io/RapiPdf/"> RapiPDF </a>
</nav>
</div>

<div>
<div class="banner-content">
<div>
<h1 class="banner-title">Web Component for OpenAPI Spec Viewing</h1>
<div class="banner-content-inner">
<p style="font-size:18px">List of all examples</p>
</div>
</div>
</div>
</div>
Expand All @@ -55,59 +51,71 @@ <h1 class="banner-title">Web Component for OpenAPI Spec Viewing</h1>
<div class="table-block">
<table class="m-table">
<tr>
<th style="text-align:left">Link</th>
<th style="text-align:left">Description </th>
<th style="text-align:left">List of Examples</th>
</tr>
<tr>
<td class="mono-bold"> <a href="./example100.html"> Playground </a> </td>
<td class="gray">Shows various things that can be controlled using script </td>
<td class="mono-bold">
<a href="./example100.html"> Playground </a>
<span class="gray descr"> Shows various things that can be controlled using script </span>
</td>
</tr>
<tr>
<td class="mono-bold"> <a href="./example1.html"> Example 1 </a> </td>
<td class="gray">Basic usage </td>
<td class="mono-bold">
<a href="./example1.html"> Basic Usage </a> </td>
</td>
</tr>
<tr>
<td class="mono-bold"> <a href="./example2.html"> Example 2 </a> </td>
<td class="gray">Apply a dark theme </td>
<td class="mono-bold">
<a href="./example2.html"> Dark Theme </a>
</td>
</tr>
<tr>
<td class="mono-bold"> <a href="./example3.html"> Example 3 </a> </td>
<td class="gray">Change header color and primary color on a dark theme </td>
<td class="mono-bold">
<a href="./example3.html"> Change Header Color </a>
</td>
</tr>
<tr>
<td class="mono-bold"> <a href="./example4.html"> Example 4 </a> </td>
<td class="gray">Embed it in another html </td>
<td class="mono-bold">
<a href="./example4.html"> Embeded </a>
<span class="gray descr"> Shows how rapi-doc element can be embeded into a different html document </span>
</td>
</tr>
<tr>
<td class="mono-bold"> <a href="./example5.html"> Example 5 </a> </td>
<td class="gray">Change the font </td>
<td class="mono-bold">
<a href="./example5.html"> Apply Custom Font </a>
</td>
</tr>
<tr>
<td class="mono-bold"> <a href="./example6.html"> Example 6 </a> </td>
<td class="gray">Change the logo </td>
<td class="mono-bold">
<a href="./example6.html"> Change Logo </a>
</td>
</tr>
<tr>
<td class="mono-bold"> <a href="./example7.html"> Example 7 </a> </td>
<td class="gray">Add your own html in various sections (slots) </td>
<td class="mono-bold">
<a href="./example7.html"> Add your own HTML</a>
<div class="gray descr"> Show how to add custom HTML elements such as paragraphs, buttons textboxes etc in various sections (slots) </div>
</td>
</tr>
<tr>
<td class="mono-bold"> <a href="./example8.html"> Example 8 </a> </td>
<td class="gray">Add custom html and functionality (like Authentication) <br/>
The example shows a text-box and a blue button is added on the header. Clicking on the button
will read authentication-token provided by the user in the text-box and apply it to rapi-doc web component
</td>
<td class="mono-bold">
<a href="./example8.html"> Add custom functionality </a>
<div class="gray descr">
The example shows a text-box and a blue button is added on the header. Clicking on the button
will read authentication-token provided by the user in the text-box and apply it to rapi-doc web component
</div>
</td>
</tr>
<tr>
<td class="mono-bold"> <a href="./example9.html"> Example 9 </a> </td>
<td class="gray">Instead of passing a spec-url, you can even pass a valid json object</td>
<td class="mono-bold">
<a href="./example9.html"> JSON Object as OpenAPI-spec </a>
</td>
</tr>
<tr>
<td class="mono-bold">
<a href="./oneof.html"> one-of </a>
<a href="./anyof.html"> any-of </a>
<a href="./oneof.html"> one-of </a>,
<a href="./anyof.html"> any-of </a> and
<a href="./allof.html"> all-of </a>
</td>
<td class="gray">Shows open-api spec contating model composition using all-off, one-of and any-of</td>
</tr>
</table>
</div>
Expand Down
12 changes: 4 additions & 8 deletions docs/examples/specs/allof.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,9 @@
},
"Employee": {
"description": "Employee Details (Worker or Manager)",
"oneOf": [
{
"$ref": "#/definitions/name"
},
{
"$ref": "#/definitions/job"
}
"allOf": [
{ "$ref": "#/definitions/name"},
{ "$ref": "#/definitions/job"}
]
}
}
Expand All @@ -68,7 +64,7 @@
"properties": {
"jobTitle": { "type": "string", "description": "Job title" },
"department": { "type": "string", "description": "Department name"},
"salary": { "type": "number", "description": "Salary per annum"}
"salary": {"type": "number", "description": "Salary per annum"}
}
}
},
Expand Down
80 changes: 80 additions & 0 deletions docs/examples/specs/allof1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"swagger": "2.0",
"info": {
"title": "all-of Models",
"description": "Spec containing model composition using all-of. Checkout the model definition under the RESPONSE section"
},
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/api/employee": {
"get": {
"tags": [
"Employee Details"
],
"summary": "List of employees",
"operationId": "empDetails",
"responses": {
"200": {
"description": "Checkout the model tab to view object schemas defined using all-of",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/employee"
}
}
}
}
}
}
},
"definitions": {
"employee": {
"type": "object",
"additionalProperties": false,
"properties": {
"Id": {
"type": "string",
"description": "Employee ID"
},
"Employee": {
"description": "Employee Details (Worker or Manager)",
"allOf": [
{ "$ref": "#/definitions/name"},
{ "$ref": "#/definitions/job"},
{ "$ref": "#/definitions/dob"},
{ "$ref": "#/definitions/salary"}
]
}
}
},
"name": {
"type": "object",
"additionalProperties": false,
"properties": {
"firstName": { "type": "string", "description": "First name" },
"lastName": { "type": "string", "description": "Last Name" }
}
},
"job": {
"type": "object",
"additionalProperties": false,
"properties": {
"jobTitle": { "type": "string", "description": "Job title" },
"department": { "type": "string", "description": "Department name"}
}
},
"dob": {"type": "string", "format": "date", "description": "Date of birth"},
"salary": {"type": "number", "description": "Salary per annum"}
},
"tags": [
{
"name": "Employee Details",
"description": "Employee Details"
}
]
}
6 changes: 2 additions & 4 deletions docs/examples/specs/anyof.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
"description": "Employee Details (Worker or Manager)",
"anyOf": [
{ "$ref": "#/definitions/name"},
{ "$ref": "#/definitions/job"},
{ "$ref": "#/definitions/dob"}
{ "$ref": "#/definitions/job"}
]
}
}
Expand Down Expand Up @@ -73,8 +72,7 @@
"description": "Salary per annum"
}
}
},
"dob": { "type": "string", "format":"date" , "description": "Date of birth" }
}

},
"tags": [
Expand Down
6 changes: 6 additions & 0 deletions docs/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ code{ font-family: 'Roboto Mono', monospace;}
.gray{
color:#777;
}
.descr {
font-family: 'Varela Round', sans-serif;
font-size:13px;
font-weight: normal;
margin-left:12px;
}

.m-table {
border-spacing: 0;
Expand Down
28 changes: 14 additions & 14 deletions docs/rapidoc-min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
https://assets.zuora.com/zuora-documentation/swagger.yaml <<< Large spec with lot of markdown
./examples/specs/petstore_anyof.yaml
-->
<rapi-doc id="thedoc" spec-url="./examples/specs/petstore_anyof.yaml"> </rapi-doc>
<rapi-doc id="thedoc" spec-url="./examples/specs/allof.json"> </rapi-doc>

<!--
<script>
Expand Down
23 changes: 13 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rapidoc",
"version": "5.2.0",
"version": "5.2.1",
"description": "RapiDoc - Open API spec viewer with built in console",
"author": "Mrinmoy Majumdar <[email protected]>",
"repository": {
Expand All @@ -20,7 +20,10 @@
"Web Component",
"rapidoc",
"swagger",
"swagger ui"
"swagger ui",
"openapi ui",
"openapi themes",
"swagger themes"
],
"main": "rapidoc.js",
"module": "rapidoc.js",
Expand All @@ -29,15 +32,15 @@
"lit-element": "2.2.1",
"lit-html": "1.0.0",
"marked": "^0.7.0",
"swagger2openapi": "^4.0.2"
"swagger2openapi": "^5.3.1"
},
"scripts": {
"build": "NODE_ENV=production webpack",
"serve": "webpack-dev-server --mode=development"
},
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/core": "^7.6.0",
"@babel/preset-env": "^7.6.0",
"babel-loader": "^8.0.6",
"babel-plugin-template-html-minifier": "^3.1.0",
"clean-webpack-plugin": "^3.0.0",
Expand All @@ -50,9 +53,9 @@
"node-sass": "^4.12.0",
"sass-loader": "^8.0.0",
"style-loader": "^1.0.0",
"webpack": "^4.39.3",
"webpack-bundle-analyzer": "^3.4.1",
"webpack-cli": "^3.3.7",
"webpack-dev-server": "^3.8.0"
"webpack": "^4.40.2",
"webpack-bundle-analyzer": "^3.5.0",
"webpack-cli": "^3.3.9",
"webpack-dev-server": "^3.8.1"
}
}
}
Loading

0 comments on commit 24ab436

Please sign in to comment.