rswag-ui 2.5.0 → 2.5.1.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfb8dd44e70e7ed3f665577ecf7b1a224570fc4d23856fda660f5d9840551fb2
4
- data.tar.gz: f0225e14d38fb41d6a3ad57cd7b3dc573b8c601a81ff0b618b91254a8b2c8e6d
3
+ metadata.gz: 8cc4415d0b0e10a29add5bd9f096de3e3684d6aee4973a84fd21cf3960021b1e
4
+ data.tar.gz: 0e744d811803c9aa07727d7c212b2541e19fbc3722d4c19206b7d120a7c2fa3d
5
5
  SHA512:
6
- metadata.gz: e59d50cde145e38b58fc2a92b35989456a659b1fa9170ce52ea8049aea0005353e73b191800f5078053920f82af2cc0b3f8707b06831ac020f2ff7d897cfd600
7
- data.tar.gz: 45a0d51bf1e8f325c596666673431d0fbd10b08116ea2933913cf06f9aaff120469910e0dcc797e4fd28083dd06c76657d6de891aae9f5dc36451e5011302152
6
+ metadata.gz: 3b92264e7c9bb16050db05b7ecdaa7e6d937f71fd06b2c5eca2daf5c6ad2b077f14a6461d139125aa6bc0339a63674cfbf2b37312a984ba95141ed3f36c9674b
7
+ data.tar.gz: dc0347c10ff2d9b04aeb1f3b4d2ca5b22638b7798f9c19c9634db0d740005588b46b36c156dacf29ad54f8a9e731fee3ac35969326839b9198351dd0e15bfa6e
@@ -37,7 +37,7 @@ module Rswag
37
37
  end
38
38
 
39
39
  def template_filename
40
- @config.template_locations.find { |filename| File.exists?(filename) }
40
+ @config.template_locations.find { |filename| File.exist?(filename) }
41
41
  end
42
42
  end
43
43
  end
@@ -0,0 +1,22 @@
1
+ # Swagger UI Dist
2
+ [![NPM version](https://badge.fury.io/js/swagger-ui-dist.svg)](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
@@ -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
+ }