Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
blueswen committed Aug 16, 2022
1 parent 4200e6b commit 2890958
Show file tree
Hide file tree
Showing 30 changed files with 553 additions and 147 deletions.
4 changes: 2 additions & 2 deletions demo-mkdocs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ A MkDocs plugin supports for add [Swagger UI](https://github.com/swagger-api/swa
1. Python Package
1. beautifulsoup4>=4.11.1
2. [Swagger UI dist](https://www.npmjs.com/package/swagger-ui-dist) javascript file and css file
1. swagger-ui-dist>=4.13.0
1. swagger-ui-dist==4.13.2

## Usage

Expand Down Expand Up @@ -55,7 +55,7 @@ A MkDocs plugin supports for add [Swagger UI](https://github.com/swagger-api/swa
| filter | String or Boolean | Default: False. If set, enables filtering. The top bar will show an edit box that you can use to filter the tagged operations that are shown. Can be Boolean to enable or disable, or a string, in which case filtering will be enabled using that string as the filter expression. Filtering is case sensitive matching the filter expression anywhere inside the tag. |
| syntaxHighlightTheme | String | Default: "agate". [Highlight.js](https://highlightjs.org/static/demo/) syntax coloring theme to use. It can be "agate", "arta", "monokai", "nord", "obsidian" or "tomorrow-night" |
| tryItOutEnabled | Boolean | Default: False. Controls whether the "Try it out" section should be enabled by default. |
| oauth2RedirectUrl | String | Default: None. OAuth redirect URL. |
| oauth2RedirectUrl | String | Default: [site url]/assets/swagger-ui/oauth2-redirect.html. OAuth redirect URL. |
| supportedSubmitMethods | Array | Default: All Http Methods. Array=["get", "put", "post", "delete", "options", "head", "patch", "trace"]. List of HTTP methods that have the "Try it out" feature enabled. An empty array disables "Try it out" for all operations. This does not filter the operations from the display. |
| validatorUrl | String | Default: "https://validator.swagger.io/validator". By default, Swagger UI attempts to validate specs against swagger.io's online validator in multiple OAS Swagger UI. You can use this parameter to set a different validator URL, for example for locally deployed validators ([Validator Badge](https://github.com/swagger-api/validator-badge)). Setting it "none" to disable validation. |
Expand Down
2 changes: 2 additions & 0 deletions docs/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@





<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/javascripts/swagger-ui-bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/javascripts/swagger-ui-bundle.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/javascripts/swagger-ui-standalone-preset.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/stylesheets/swagger-ui.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/stylesheets/swagger-ui.css.map

Large diffs are not rendered by default.

79 changes: 79 additions & 0 deletions docs/assets/swagger-ui/oauth2-redirect.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<!doctype html>
<html lang="en-US">
<head>
<title>Swagger UI: OAuth2 Redirect</title>
</head>
<body>
<script>
'use strict';
function run () {
var oauth2 = window.opener.swaggerUIRedirectOauth2;
var sentState = oauth2.state;
var redirectUrl = oauth2.redirectUrl;
var isValid, qp, arr;

if (/code|token|error/.test(window.location.hash)) {
qp = window.location.hash.substring(1);
} else {
qp = location.search.substring(1);
}

arr = qp.split("&");
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';});
qp = qp ? JSON.parse('{' + arr.join() + '}',
function (key, value) {
return key === "" ? value : decodeURIComponent(value);
}
) : {};

isValid = qp.state === sentState;

if ((
oauth2.auth.schema.get("flow") === "accessCode" ||
oauth2.auth.schema.get("flow") === "authorizationCode" ||
oauth2.auth.schema.get("flow") === "authorization_code"
) && !oauth2.auth.code) {
if (!isValid) {
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "warning",
message: "Authorization may be unsafe, passed state was changed in server. The passed state wasn't returned from auth server."
});
}

if (qp.code) {
delete oauth2.state;
oauth2.auth.code = qp.code;
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
} else {
let oauthErrorMsg;
if (qp.error) {
oauthErrorMsg = "["+qp.error+"]: " +
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
(qp.error_uri ? "More info: "+qp.error_uri : "");
}

oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "error",
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server."
});
}
} else {
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
}
window.close();
}

if (document.readyState !== 'loading') {
run();
} else {
document.addEventListener('DOMContentLoaded', function () {
run();
});
}
</script>
</body>
</html>
4 changes: 2 additions & 2 deletions docs/demo/build-in-multiple/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,10 @@ <h2 id="markdown">Markdown</h2>
<a href="#__codelineno-0-5" id="__codelineno-0-5" name="__codelineno-0-5"></a><span class="p">&lt;</span><span class="nt">swagger-ui</span> <span class="na">grouped</span> <span class="na">name</span><span class="o">=</span><span class="s">"Sample Third"</span> <span class="na">src</span><span class="o">=</span><span class="s">"./openapi-spec/sample-third.yaml"</span><span class="p">/&gt;</span>
</code></pre></div>
<h2 id="multiple-oas-in-single-swagger-ui">Multiple OAS in single Swagger UI</h2>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="2741ecb4" src="swagger-2741ecb4.html" style="overflow:hidden;width:100%;" width="100%"></iframe>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="214bc153" src="swagger-214bc153.html" style="overflow:hidden;width:100%;" width="100%"></iframe>
</p>
<h2 id="other-independent-swagger-ui">Other independent Swagger UI</h2>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="4f7e35d6" src="swagger-4f7e35d6.html" style="overflow:hidden;width:100%;" width="100%"></iframe></p>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="f55d0a45" src="swagger-f55d0a45.html" style="overflow:hidden;width:100%;" width="100%"></iframe></p>
</article>
<script>var input,hash=location.hash.slice(1);hash.startsWith("__tabbed_")&&((input=document.getElementById(hash)).checked=!0)</script>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"patch",
"trace"
],
"syntaxHighlight.theme": "agate"
"syntaxHighlight.theme": "agate",
"oauth2RedirectUrl": "https://blueswen.github.io/mkdocs-swagger-ui-tag/assets/swagger-ui/oauth2-redirect.html"

})

Expand All @@ -63,7 +64,7 @@
}

const resize_ob = new ResizeObserver(function(entries) {
parent.update_swagger_ui_iframe_height("2741ecb4");
parent.update_swagger_ui_iframe_height("214bc153");
});

// start observing for resize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"patch",
"trace"
],
"syntaxHighlight.theme": "agate"
"syntaxHighlight.theme": "agate",
"oauth2RedirectUrl": "https://blueswen.github.io/mkdocs-swagger-ui-tag/assets/swagger-ui/oauth2-redirect.html"

})

Expand All @@ -50,7 +51,7 @@
}

const resize_ob = new ResizeObserver(function(entries) {
parent.update_swagger_ui_iframe_height("65d73bff");
parent.update_swagger_ui_iframe_height("f55d0a45");
});

// start observing for resize
Expand Down
4 changes: 2 additions & 2 deletions docs/demo/multiple/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ <h2 id="markdown">Markdown</h2>
<a href="#__codelineno-0-2" id="__codelineno-0-2" name="__codelineno-0-2"></a><span class="p">&lt;</span><span class="nt">swagger-ui</span> <span class="na">src</span><span class="o">=</span><span class="s">"https://petstore.swagger.io/v2/swagger.json"</span><span class="p">/&gt;</span>
</code></pre></div>
<h2 id="swagger-ui">Swagger UI</h2>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="a8224419" src="swagger-a8224419.html" style="overflow:hidden;width:100%;" width="100%"></iframe>
<iframe class="swagger-ui-iframe" frameborder="0" id="d4626579" src="swagger-d4626579.html" style="overflow:hidden;width:100%;" width="100%"></iframe></p>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="7fe4a43e" src="swagger-7fe4a43e.html" style="overflow:hidden;width:100%;" width="100%"></iframe>
<iframe class="swagger-ui-iframe" frameborder="0" id="6a03f9f3" src="swagger-6a03f9f3.html" style="overflow:hidden;width:100%;" width="100%"></iframe></p>
</article>
<script>var input,hash=location.hash.slice(1);hash.startsWith("__tabbed_")&&((input=document.getElementById(hash)).checked=!0)</script>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"patch",
"trace"
],
"syntaxHighlight.theme": "agate"
"syntaxHighlight.theme": "agate",
"oauth2RedirectUrl": "https://blueswen.github.io/mkdocs-swagger-ui-tag/assets/swagger-ui/oauth2-redirect.html"

})

Expand All @@ -50,7 +51,7 @@
}

const resize_ob = new ResizeObserver(function(entries) {
parent.update_swagger_ui_iframe_height("d4626579");
parent.update_swagger_ui_iframe_height("6a03f9f3");
});

// start observing for resize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"patch",
"trace"
],
"syntaxHighlight.theme": "agate"
"syntaxHighlight.theme": "agate",
"oauth2RedirectUrl": "https://blueswen.github.io/mkdocs-swagger-ui-tag/assets/swagger-ui/oauth2-redirect.html"

})

Expand All @@ -50,7 +51,7 @@
}

const resize_ob = new ResizeObserver(function(entries) {
parent.update_swagger_ui_iframe_height("4f7e35d6");
parent.update_swagger_ui_iframe_height("7fe4a43e");
});

// start observing for resize
Expand Down
2 changes: 1 addition & 1 deletion docs/demo/oauth2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ <h2 id="markdown">Markdown</h2>
<a href="#__codelineno-0-9" id="__codelineno-0-9" name="__codelineno-0-9"></a> <span class="na">usePkceWithAuthorizationCodeGrant</span><span class="o">=</span><span class="s">"false"</span><span class="p">/&gt;</span>
</code></pre></div>
<h2 id="swagger-ui">Swagger UI</h2>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="e523e77e" src="swagger-e523e77e.html" style="overflow:hidden;width:100%;" width="100%"></iframe></p>
<p><iframe class="swagger-ui-iframe" frameborder="0" id="24d3849a" src="swagger-24d3849a.html" style="overflow:hidden;width:100%;" width="100%"></iframe></p>
</article>
<script>var input,hash=location.hash.slice(1);hash.startsWith("__tabbed_")&&((input=document.getElementById(hash)).checked=!0)</script>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"patch",
"trace"
],
"syntaxHighlight.theme": "agate"
"syntaxHighlight.theme": "agate",
"oauth2RedirectUrl": "https://blueswen.github.io/mkdocs-swagger-ui-tag/assets/swagger-ui/oauth2-redirect.html"

})

Expand All @@ -52,7 +53,7 @@
}

const resize_ob = new ResizeObserver(function(entries) {
parent.update_swagger_ui_iframe_height("e523e77e");
parent.update_swagger_ui_iframe_height("24d3849a");
});

// start observing for resize
Expand Down
Loading

0 comments on commit 2890958

Please sign in to comment.