rswag-ui 2.5.0 → 2.5.1.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rswag/ui/middleware.rb +1 -1
- data/node_modules/swagger-ui-dist/README.md +22 -0
- data/node_modules/swagger-ui-dist/absolute-path.js +14 -0
- data/node_modules/swagger-ui-dist/favicon-16x16.png +0 -0
- data/node_modules/swagger-ui-dist/favicon-32x32.png +0 -0
- data/node_modules/swagger-ui-dist/index.html +60 -0
- data/node_modules/swagger-ui-dist/index.js +17 -0
- data/node_modules/swagger-ui-dist/oauth2-redirect.html +75 -0
- data/node_modules/swagger-ui-dist/package.json +18 -0
- data/node_modules/swagger-ui-dist/swagger-ui-bundle.js +3 -0
- data/node_modules/swagger-ui-dist/swagger-ui-bundle.js.map +1 -0
- data/node_modules/swagger-ui-dist/swagger-ui-es-bundle-core.js +3 -0
- data/node_modules/swagger-ui-dist/swagger-ui-es-bundle-core.js.map +1 -0
- data/node_modules/swagger-ui-dist/swagger-ui-es-bundle.js +3 -0
- data/node_modules/swagger-ui-dist/swagger-ui-es-bundle.js.map +1 -0
- data/node_modules/swagger-ui-dist/swagger-ui-standalone-preset.js +3 -0
- data/node_modules/swagger-ui-dist/swagger-ui-standalone-preset.js.map +1 -0
- data/node_modules/swagger-ui-dist/swagger-ui.css +4 -0
- data/node_modules/swagger-ui-dist/swagger-ui.css.map +1 -0
- data/node_modules/swagger-ui-dist/swagger-ui.js +3 -0
- data/node_modules/swagger-ui-dist/swagger-ui.js.map +1 -0
- metadata +24 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cc4415d0b0e10a29add5bd9f096de3e3684d6aee4973a84fd21cf3960021b1e
|
4
|
+
data.tar.gz: 0e744d811803c9aa07727d7c212b2541e19fbc3722d4c19206b7d120a7c2fa3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b92264e7c9bb16050db05b7ecdaa7e6d937f71fd06b2c5eca2daf5c6ad2b077f14a6461d139125aa6bc0339a63674cfbf2b37312a984ba95141ed3f36c9674b
|
7
|
+
data.tar.gz: dc0347c10ff2d9b04aeb1f3b4d2ca5b22638b7798f9c19c9634db0d740005588b46b36c156dacf29ad54f8a9e731fee3ac35969326839b9198351dd0e15bfa6e
|
data/lib/rswag/ui/middleware.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Swagger UI Dist
|
2
|
+
[](http://badge.fury.io/js/swagger-ui-dist)
|
3
|
+
|
4
|
+
# API
|
5
|
+
|
6
|
+
This module, `swagger-ui-dist`, exposes Swagger-UI's entire dist folder as a dependency-free npm module.
|
7
|
+
Use `swagger-ui` instead, if you'd like to have npm install dependencies for you.
|
8
|
+
|
9
|
+
`SwaggerUIBundle` and `SwaggerUIStandalonePreset` can be imported:
|
10
|
+
```javascript
|
11
|
+
import { SwaggerUIBundle, SwaggerUIStandalonePreset } from "swagger-ui-dist"
|
12
|
+
```
|
13
|
+
|
14
|
+
To get an absolute path to this directory for static file serving, use the exported `getAbsoluteFSPath` method:
|
15
|
+
|
16
|
+
```javascript
|
17
|
+
const swaggerUiAssetPath = require("swagger-ui-dist").getAbsoluteFSPath()
|
18
|
+
|
19
|
+
// then instantiate server that serves files from the swaggerUiAssetPath
|
20
|
+
```
|
21
|
+
|
22
|
+
For anything else, check the [Swagger-UI](https://github.com/swagger-api/swagger-ui) repository.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/*
|
2
|
+
* getAbsoluteFSPath
|
3
|
+
* @return {string} When run in NodeJS env, returns the absolute path to the current directory
|
4
|
+
* When run outside of NodeJS, will return an error message
|
5
|
+
*/
|
6
|
+
const getAbsoluteFSPath = function () {
|
7
|
+
// detect whether we are running in a browser or nodejs
|
8
|
+
if (typeof module !== "undefined" && module.exports) {
|
9
|
+
return require("path").resolve(__dirname)
|
10
|
+
}
|
11
|
+
throw new Error('getAbsoluteFSPath can only be called within a Nodejs environment');
|
12
|
+
}
|
13
|
+
|
14
|
+
module.exports = getAbsoluteFSPath
|
Binary file
|
Binary file
|
@@ -0,0 +1,60 @@
|
|
1
|
+
<!-- HTML for static distribution bundle build -->
|
2
|
+
<!DOCTYPE html>
|
3
|
+
<html lang="en">
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
<title>Swagger UI</title>
|
7
|
+
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
|
8
|
+
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
|
9
|
+
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
|
10
|
+
<style>
|
11
|
+
html
|
12
|
+
{
|
13
|
+
box-sizing: border-box;
|
14
|
+
overflow: -moz-scrollbars-vertical;
|
15
|
+
overflow-y: scroll;
|
16
|
+
}
|
17
|
+
|
18
|
+
*,
|
19
|
+
*:before,
|
20
|
+
*:after
|
21
|
+
{
|
22
|
+
box-sizing: inherit;
|
23
|
+
}
|
24
|
+
|
25
|
+
body
|
26
|
+
{
|
27
|
+
margin:0;
|
28
|
+
background: #fafafa;
|
29
|
+
}
|
30
|
+
</style>
|
31
|
+
</head>
|
32
|
+
|
33
|
+
<body>
|
34
|
+
<div id="swagger-ui"></div>
|
35
|
+
|
36
|
+
<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
|
37
|
+
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
|
38
|
+
<script>
|
39
|
+
window.onload = function() {
|
40
|
+
// Begin Swagger UI call region
|
41
|
+
const ui = SwaggerUIBundle({
|
42
|
+
url: "https://petstore.swagger.io/v2/swagger.json",
|
43
|
+
dom_id: '#swagger-ui',
|
44
|
+
deepLinking: true,
|
45
|
+
presets: [
|
46
|
+
SwaggerUIBundle.presets.apis,
|
47
|
+
SwaggerUIStandalonePreset
|
48
|
+
],
|
49
|
+
plugins: [
|
50
|
+
SwaggerUIBundle.plugins.DownloadUrl
|
51
|
+
],
|
52
|
+
layout: "StandaloneLayout"
|
53
|
+
});
|
54
|
+
// End Swagger UI call region
|
55
|
+
|
56
|
+
window.ui = ui;
|
57
|
+
};
|
58
|
+
</script>
|
59
|
+
</body>
|
60
|
+
</html>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
try {
|
2
|
+
module.exports.SwaggerUIBundle = require("./swagger-ui-bundle.js")
|
3
|
+
module.exports.SwaggerUIStandalonePreset = require("./swagger-ui-standalone-preset.js")
|
4
|
+
} catch(e) {
|
5
|
+
// swallow the error if there's a problem loading the assets.
|
6
|
+
// allows this module to support providing the assets for browserish contexts,
|
7
|
+
// without exploding in a Node context.
|
8
|
+
//
|
9
|
+
// see https://github.com/swagger-api/swagger-ui/issues/3291#issuecomment-311195388
|
10
|
+
// for more information.
|
11
|
+
}
|
12
|
+
|
13
|
+
// `absolutePath` and `getAbsoluteFSPath` are both here because at one point,
|
14
|
+
// we documented having one and actually implemented the other.
|
15
|
+
// They were both retained so we don't break anyone's code.
|
16
|
+
module.exports.absolutePath = require("./absolute-path.js")
|
17
|
+
module.exports.getAbsoluteFSPath = require("./absolute-path.js")
|
@@ -0,0 +1,75 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html lang="en-US">
|
3
|
+
<head>
|
4
|
+
<title>Swagger UI: OAuth2 Redirect</title>
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
<script>
|
8
|
+
'use strict';
|
9
|
+
function run () {
|
10
|
+
var oauth2 = window.opener.swaggerUIRedirectOauth2;
|
11
|
+
var sentState = oauth2.state;
|
12
|
+
var redirectUrl = oauth2.redirectUrl;
|
13
|
+
var isValid, qp, arr;
|
14
|
+
|
15
|
+
if (/code|token|error/.test(window.location.hash)) {
|
16
|
+
qp = window.location.hash.substring(1);
|
17
|
+
} else {
|
18
|
+
qp = location.search.substring(1);
|
19
|
+
}
|
20
|
+
|
21
|
+
arr = qp.split("&");
|
22
|
+
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';});
|
23
|
+
qp = qp ? JSON.parse('{' + arr.join() + '}',
|
24
|
+
function (key, value) {
|
25
|
+
return key === "" ? value : decodeURIComponent(value);
|
26
|
+
}
|
27
|
+
) : {};
|
28
|
+
|
29
|
+
isValid = qp.state === sentState;
|
30
|
+
|
31
|
+
if ((
|
32
|
+
oauth2.auth.schema.get("flow") === "accessCode" ||
|
33
|
+
oauth2.auth.schema.get("flow") === "authorizationCode" ||
|
34
|
+
oauth2.auth.schema.get("flow") === "authorization_code"
|
35
|
+
) && !oauth2.auth.code) {
|
36
|
+
if (!isValid) {
|
37
|
+
oauth2.errCb({
|
38
|
+
authId: oauth2.auth.name,
|
39
|
+
source: "auth",
|
40
|
+
level: "warning",
|
41
|
+
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
|
42
|
+
});
|
43
|
+
}
|
44
|
+
|
45
|
+
if (qp.code) {
|
46
|
+
delete oauth2.state;
|
47
|
+
oauth2.auth.code = qp.code;
|
48
|
+
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
|
49
|
+
} else {
|
50
|
+
let oauthErrorMsg;
|
51
|
+
if (qp.error) {
|
52
|
+
oauthErrorMsg = "["+qp.error+"]: " +
|
53
|
+
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
|
54
|
+
(qp.error_uri ? "More info: "+qp.error_uri : "");
|
55
|
+
}
|
56
|
+
|
57
|
+
oauth2.errCb({
|
58
|
+
authId: oauth2.auth.name,
|
59
|
+
source: "auth",
|
60
|
+
level: "error",
|
61
|
+
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
|
62
|
+
});
|
63
|
+
}
|
64
|
+
} else {
|
65
|
+
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
|
66
|
+
}
|
67
|
+
window.close();
|
68
|
+
}
|
69
|
+
|
70
|
+
window.addEventListener('DOMContentLoaded', function () {
|
71
|
+
run();
|
72
|
+
});
|
73
|
+
</script>
|
74
|
+
</body>
|
75
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
{
|
2
|
+
"name": "swagger-ui-dist",
|
3
|
+
"version": "3.52.5",
|
4
|
+
"main": "index.js",
|
5
|
+
"repository": "git@github.com:swagger-api/swagger-ui.git",
|
6
|
+
"contributors": [
|
7
|
+
"(in alphabetical order)",
|
8
|
+
"Anna Bodnia <anna.bodnia@gmail.com>",
|
9
|
+
"Buu Nguyen <buunguyen@gmail.com>",
|
10
|
+
"Josh Ponelat <jponelat@gmail.com>",
|
11
|
+
"Kyle Shockey <kyleshockey1@gmail.com>",
|
12
|
+
"Robert Barnwell <robert@robertismy.name>",
|
13
|
+
"Sahar Jafari <shr.jafari@gmail.com>"
|
14
|
+
],
|
15
|
+
"license": "Apache-2.0",
|
16
|
+
"dependencies": {},
|
17
|
+
"devDependencies": {}
|
18
|
+
}
|