Skip to content

Commit

Permalink
feat: added new option to group endpoints by path
Browse files Browse the repository at this point in the history
  • Loading branch information
mrin9 committed Sep 30, 2019
1 parent 953f178 commit 4315f53
Show file tree
Hide file tree
Showing 29 changed files with 1,826 additions and 261 deletions.
89 changes: 89 additions & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
<title>RapiDoc</title>
</head>

<body>
<!--
Some sample spec to try
https://api.apis.guru/v2/specs/stripe.com/2019-02-19/swagger.json
https://api.apis.guru/v2/specs/github.com/v3/swagger.json
https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json
https://petstore.swagger.io/v2/swagger.json
https://assets.zuora.com/zuora-documentation/swagger.yaml <<< Large spec with lot of markdown
./specs/petstore_anyof.yaml <<< contains complex one-of with inline primitives and recursive objects
./specs/oneof1.yaml <<< nested oneof
-->
<rapi-doc
id="thedoc"
spec-url="./specs/petstore_extended.yaml"
theme="dark"
allow-api-list-style-selection = "false"
api-list-style = "group-by-path"
> </rapi-doc>

<!--
<script>
document.addEventListener('DOMContentLoaded', (event) => {
let docEl = document.getElementById("thedoc");
let strSpec = `
{
"swagger": "2.0",
"info": {
"description": "Sample to test"
},
"paths": {
"/pets": {
"get": {
"description": "Returns all pets from the system that the user has access to",
"produces": [ "application/json"],
"responses": {
"200": {
"description": "A list of pets.",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Pet"
}
}
}
}
}
}
},
"definitions": {
"Pet": {
"type": "object",
"required": [
"id",
"name"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"tag": {
"type": "string"
}
}
}
}
}
`;
let objSpec = JSON.parse(strSpec);
docEl.loadSpec(objSpec);
})
</script>
-->

<script type="text/javascript" src="rapidoc-min.js"></script></body>

</html>
Binary file added dist/index.html.gz
Binary file not shown.
168 changes: 168 additions & 0 deletions dist/rapidoc-min.js

Large diffs are not rendered by default.

Binary file added dist/rapidoc-min.js.gz
Binary file not shown.
1 change: 1 addition & 0 deletions dist/rapidoc-min.js.map

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

Binary file added dist/rapidoc-min.js.map.gz
Binary file not shown.
Binary file added dist/rapidoc-regular.woff2
Binary file not shown.
Binary file added dist/rapidoc-semi-bold.woff2
Binary file not shown.
65 changes: 65 additions & 0 deletions dist/report.html

Large diffs are not rendered by default.

Binary file added dist/roboto-mono-bold.woff2
Binary file not shown.
Binary file added dist/roboto-mono-regular.woff2
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/examples/example1.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
</style>
</head>
<body>
<rapi-doc spec-url="../specs/bitbucket.json" style="min-width:460px" show-info="true"> </rapi-doc>
<rapi-doc spec-url="../specs/bitbucket.json" style="min-width:460px"> </rapi-doc>
</body>
</html>
25 changes: 25 additions & 0 deletions docs/examples/group-by-path.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!doctype html>
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-132775238-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-132775238-1');
</script>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
<script type="text/javascript" src="../rapidoc-min.js"></script>
<style>
rapi-doc{
width:100%;
}
</style>
</head>
<body>
<rapi-doc spec-url="../specs/bitbucket.json" style="min-width:460px" api-list-style="group-by-path"> </rapi-doc>
</body>
</html>
2 changes: 1 addition & 1 deletion docs/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ code{ font-family: 'Roboto Mono', monospace;}
font-size:12px;
width:650px;
}
.attr-col{ width:180px;}
.attr-col{ width:260px;}
.default-col{ width:100px;}


Expand Down
49 changes: 32 additions & 17 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,22 +146,20 @@ <h1 class="banner-title">Web Component for OpenAPI Spec Viewing</h1>
<div style="display:flex; flex-direction: column; margin-bottom:24px">
<h2> Quickstart (<a style="font-size:16px" href="./examples/example2.html">DEMO</a>)</h2>
Just copy the below code and save it in an html file. Then open it using a browser

<pre class="shadow code-block"><code class="html" style="border-radius:4px">
&lt;!doctype html&gt; &lt;!-- Important: must specify --&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta charset="utf-8"&gt; &lt;!-- Important: rapi-doc uses utf8 charecters --&gt;
&lt;script src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;rapi-doc
spec-url="https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json"
&gt; &lt;/rapi-doc&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
</div>
<pre class="shadow code-block"><code class="html" style="border-radius:4px">&lt;!doctype html&gt; &lt;!-- Important: must specify --&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta charset="utf-8"&gt; &lt;!-- Important: rapi-doc uses utf8 charecters --&gt;
&lt;script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;rapi-doc
spec-url="https://api.apis.guru/v2/specs/bitbucket.org/2.0/swagger.json"
&gt; &lt;/rapi-doc&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
</div>


<div style="display:flex; flex-direction: column; ">
Expand Down Expand Up @@ -203,7 +201,7 @@ <h2> Mix your own HTML (<a style="font-size:16px" href="./examples/example8.html
}
&lt;/style&gt;

&lt;script src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"&gt;&lt;/script&gt;
&lt;script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"&gt;&lt;/script&gt;
&lt;script&gt;
function setApiKey(){
const docEl = document.getElementById('thedoc');
Expand Down Expand Up @@ -267,6 +265,15 @@ <h2> Attributes</h2>
<td>(empty)</td>
</tr>

<tr>
<td class="mono-bold right">api-list-style</td>
<td class="gray">
can be either <code>group-by-tag</code> or <code> group-by-path </code>. This controls how the API litings are grouped.
this can be changed from the UI too
</td>
<td>group-by-tag</td>
</tr>

<tr>
<td class="mono-bold right">allow-authentication</td>
<td class="gray">
Expand Down Expand Up @@ -342,6 +349,14 @@ <h2> Attributes</h2>
<td>true</td>
</tr>

<tr>
<td class="mono-bold right">allow-api-list-style-selection</td>
<td class="gray">
If set to 'false', user will not be able to change api list style
</td>
<td>true</td>
</tr>

<tr>
<td class="mono-bold right">show-info</td>
<td class="gray">
Expand Down
5 changes: 5 additions & 0 deletions docs/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ <h1 class="banner-title">Web Component for OpenAPI Spec Viewing</h1>
<a href="./examples/example2.html"> Dark Theme </a>
</td>
</tr>
<tr>
<td class="mono-bold">
<a href="./examples/group-by-path.html"> API listing grouped by path </a>
</td>
</tr>
<tr>
<td class="mono-bold">
<a href="./examples/example3.html"> Change Header Color </a>
Expand Down
14 changes: 7 additions & 7 deletions docs/rapidoc-min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 4315f53

Please sign in to comment.