rswag-ui 2.11.0 → 2.13.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1499c87cda3463347c079d53c7e3f2b957bb2a07ab0df3ab56cdc6b920ba5a9
4
- data.tar.gz: 55876b9fa70c60a5f305b4dcafbebe6736ac69388179e6c3df8ece60f43bf4a3
3
+ metadata.gz: 3974cf8486beb436cdf6c45c2f08773e02485f932b5697fe0e859e19d4166e39
4
+ data.tar.gz: 24fdef3744a7dde26ce81c702d581257b4cec64bdf9aeb244726665b16b1f7e3
5
5
  SHA512:
6
- metadata.gz: 4abe4ed324e524f1932ae4666113d2b61d88eb7d35b2b2fcdc455ce66573832e286f9d8dbe770e71d681b69766a48f93679bb58d3315b2a8b584453dbac33892
7
- data.tar.gz: 3378edd049676eb6cd9285a9643f9b27a286daf5813fbbc25ea65d5bd370631dee5cd994e9eef7864c5eeee914b540ea332472c55bc5030b064430f3871b4407
6
+ metadata.gz: 5dc7072ef0ef2ccf84adf796db1a5ba251ad5ed3830898d4c8d028ed0ec3653b33bc0c2d743477b719412dca065614315daacf2b84d980fc52eabe1193fc0ec9
7
+ data.tar.gz: 479f7d983edbe0ded205c07691b885b21b0ae711d20b314006cccbd4eb19d32ac3b45459a42f38a28e6d2847a81954bb546b46e3ca799e303cb3ea9e17d6a740
@@ -5,7 +5,7 @@ Rswag::Ui.configure do |c|
5
5
  # host) to the corresponding endpoint and the second is a title that will be
6
6
  # displayed in the document selector.
7
7
  # NOTE: If you're using rspec-api to expose Swagger files
8
- # (under swagger_root) as JSON or YAML endpoints, then the list below should
8
+ # (under openapi_root) as JSON or YAML endpoints, then the list below should
9
9
  # correspond to the relative paths for those endpoints.
10
10
 
11
11
  c.swagger_endpoint '/api-docs/v1/swagger.yaml', 'API V1 Docs'
@@ -26,6 +26,11 @@ module Rswag
26
26
  end
27
27
 
28
28
  def swagger_endpoint(url, name)
29
+ Rswag::Ui.deprecator.warn('Rswag::Ui: WARNING: The method will be renamed to "openapi_endpoint" in v3.0')
30
+ openapi_endpoint(url, name)
31
+ end
32
+
33
+ def openapi_endpoint(url, name)
29
34
  @config_object[:urls] ||= []
30
35
  @config_object[:urls] << { url: url, name: name }
31
36
  end
@@ -41,9 +41,9 @@ module Rswag
41
41
  end
42
42
 
43
43
  def csp
44
- <<~POLICY.gsub "\n", ' '
44
+ <<~POLICY.tr "\n", ' '
45
45
  default-src 'self';
46
- img-src 'self' data:;
46
+ img-src 'self' data: https://validator.swagger.io;
47
47
  font-src 'self' https://fonts.gstatic.com;
48
48
  style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;
49
49
  script-src 'self' 'unsafe-inline';
data/lib/rswag/ui.rb CHANGED
@@ -10,5 +10,9 @@ module Rswag
10
10
  def self.config
11
11
  @config ||= Configuration.new
12
12
  end
13
+
14
+ def self.deprecator
15
+ @deprecator ||= ActiveSupport::Deprecation.new('3.0', 'rswag-ui')
16
+ end
13
17
  end
14
18
  end
@@ -0,0 +1,16 @@
1
+ html {
2
+ box-sizing: border-box;
3
+ overflow: -moz-scrollbars-vertical;
4
+ overflow-y: scroll;
5
+ }
6
+
7
+ *,
8
+ *:before,
9
+ *:after {
10
+ box-sizing: inherit;
11
+ }
12
+
13
+ body {
14
+ margin: 0;
15
+ background: #fafafa;
16
+ }
@@ -5,56 +5,15 @@
5
5
  <meta charset="UTF-8">
6
6
  <title>Swagger UI</title>
7
7
  <link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
8
+ <link rel="stylesheet" type="text/css" href="index.css" />
8
9
  <link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
9
10
  <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
11
  </head>
32
12
 
33
13
  <body>
34
14
  <div id="swagger-ui"></div>
35
-
36
15
  <script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
37
16
  <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>
17
+ <script src="./swagger-initializer.js" charset="UTF-8"> </script>
59
18
  </body>
60
19
  </html>
@@ -13,7 +13,7 @@
13
13
  var isValid, qp, arr;
14
14
 
15
15
  if (/code|token|error/.test(window.location.hash)) {
16
- qp = window.location.hash.substring(1);
16
+ qp = window.location.hash.substring(1).replace('?', '&');
17
17
  } else {
18
18
  qp = location.search.substring(1);
19
19
  }
@@ -38,7 +38,7 @@
38
38
  authId: oauth2.auth.name,
39
39
  source: "auth",
40
40
  level: "warning",
41
- message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
41
+ message: "Authorization may be unsafe, passed state was changed in server. The passed state wasn't returned from auth server."
42
42
  });
43
43
  }
44
44
 
@@ -58,7 +58,7 @@
58
58
  authId: oauth2.auth.name,
59
59
  source: "auth",
60
60
  level: "error",
61
- message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
61
+ message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server."
62
62
  });
63
63
  }
64
64
  } else {
@@ -67,9 +67,13 @@
67
67
  window.close();
68
68
  }
69
69
 
70
- window.addEventListener('DOMContentLoaded', function () {
71
- run();
72
- });
70
+ if (document.readyState !== 'loading') {
71
+ run();
72
+ } else {
73
+ document.addEventListener('DOMContentLoaded', function () {
74
+ run();
75
+ });
76
+ }
73
77
  </script>
74
78
  </body>
75
79
  </html>
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swagger-ui-dist",
3
- "version": "4.1.3",
3
+ "version": "5.9.4",
4
4
  "main": "index.js",
5
5
  "repository": "git@github.com:swagger-api/swagger-ui.git",
6
6
  "contributors": [
@@ -0,0 +1,20 @@
1
+ window.onload = function() {
2
+ //<editor-fold desc="Changeable Configuration Block">
3
+
4
+ // the following lines will be replaced by docker/configurator, when it runs in a docker-container
5
+ window.ui = SwaggerUIBundle({
6
+ url: "https://petstore.swagger.io/v2/swagger.json",
7
+ dom_id: '#swagger-ui',
8
+ deepLinking: true,
9
+ presets: [
10
+ SwaggerUIBundle.presets.apis,
11
+ SwaggerUIStandalonePreset
12
+ ],
13
+ plugins: [
14
+ SwaggerUIBundle.plugins.DownloadUrl
15
+ ],
16
+ layout: "StandaloneLayout"
17
+ });
18
+
19
+ //</editor-fold>
20
+ };