Skip to content

Commit

Permalink
upgrade swagger UI 3.22.0 -> 3.45.1
Browse files Browse the repository at this point in the history
* feat: update Swagger UI

* fix: update oas3 car example

* fix: restore configUrl from ui/index.html

* feat: add README for ui folder
  • Loading branch information
astagi committed Mar 28, 2021
1 parent 0f8631f commit 2c731ec
Show file tree
Hide file tree
Showing 17 changed files with 53 additions and 138 deletions.
4 changes: 2 additions & 2 deletions examples/cars_oas3/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from blueprints.repair import blueprint as repair_blueprint
from sanic import Sanic

from sanic_openapi import oas3_blueprint
from sanic_openapi import openapi3_blueprint

app = Sanic("Cars API example")

Expand All @@ -15,7 +15,7 @@
app.blueprint(manufacturer_blueprint)
app.blueprint(repair_blueprint)

app.blueprint(oas3_blueprint)
app.blueprint(openapi3_blueprint)

app.config.API_VERSION = '1.0.0'
app.config.API_TITLE = 'Car API'
Expand Down
6 changes: 6 additions & 0 deletions sanic_openapi/ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Swagger UI v3.45.1

[Swagger UI](https://swagger.io/tools/swagger-ui/) allows anyone — be it your development team or your end consumers — to visualize and interact with the API’s resources without having any of the implementation logic in place. It’s automatically generated from your OpenAPI (formerly known as Swagger) Specification, with the visual documentation making it easy for back end implementation and client side consumption.

## License
Swagger UI is licensed under the Apache License 2.0
12 changes: 6 additions & 6 deletions sanic_openapi/ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
<style>
Expand Down Expand Up @@ -33,8 +33,8 @@
<body>
<div id="swagger-ui"></div>

<script src="./swagger-ui-bundle.js"> </script>
<script src="./swagger-ui-standalone-preset.js"> </script>
<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
<script>
window.onload = function() {
// Begin Swagger UI call region
Expand All @@ -51,11 +51,11 @@
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
});
// End Swagger UI call region

window.ui = ui
}
window.ui = ui;
};
</script>
</body>
</html>
30 changes: 19 additions & 11 deletions sanic_openapi/ui/oauth2-redirect.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<!doctype html>
<html lang="en-US">
<body onload="run()">
</body>
</html>
<head>
<title>Swagger UI: OAuth2 Redirect</title>
</head>
<body>
<script>
'use strict';
function run () {
Expand All @@ -17,19 +18,20 @@
qp = location.search.substring(1);
}

arr = qp.split("&")
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';})
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)
return key === "" ? value : decodeURIComponent(value);
}
) : {}
) : {};

isValid = qp.state === sentState
isValid = qp.state === sentState;

if ((
oauth2.auth.schema.get("flow") === "accessCode"||
oauth2.auth.schema.get("flow") === "authorizationCode"
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({
Expand All @@ -45,7 +47,7 @@
oauth2.auth.code = qp.code;
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
} else {
let oauthErrorMsg
let oauthErrorMsg;
if (qp.error) {
oauthErrorMsg = "["+qp.error+"]: " +
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
Expand All @@ -64,4 +66,10 @@
}
window.close();
}

window.addEventListener('DOMContentLoaded', function () {
run();
});
</script>
</body>
</html>
94 changes: 2 additions & 92 deletions sanic_openapi/ui/swagger-ui-bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sanic_openapi/ui/swagger-ui-bundle.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions sanic_openapi/ui/swagger-ui-es-bundle-core.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions sanic_openapi/ui/swagger-ui-es-bundle-core.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions sanic_openapi/ui/swagger-ui-es-bundle.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions sanic_openapi/ui/swagger-ui-es-bundle.js.map

Large diffs are not rendered by default.

15 changes: 2 additions & 13 deletions sanic_openapi/ui/swagger-ui-standalone-preset.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sanic_openapi/ui/swagger-ui-standalone-preset.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion sanic_openapi/ui/swagger-ui.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sanic_openapi/ui/swagger-ui.css.map

Large diffs are not rendered by default.

10 changes: 2 additions & 8 deletions sanic_openapi/ui/swagger-ui.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sanic_openapi/ui/swagger-ui.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion sanic_openapi/ui/version

This file was deleted.

0 comments on commit 2c731ec

Please sign in to comment.