swagger_ui_engine_2 0.2.0 → 1.0.1
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/README.md +53 -9
- data/app/assets/javascripts/swagger_ui_engine_2/swagger-ui-bundle.js +1 -1
- data/app/assets/javascripts/swagger_ui_engine_2/swagger-ui-bundle.js.map +1 -1
- data/app/assets/javascripts/swagger_ui_engine_2/swagger-ui-es-bundle-core.js +1 -1
- data/app/assets/javascripts/swagger_ui_engine_2/swagger-ui-es-bundle-core.js.map +1 -1
- data/app/assets/javascripts/swagger_ui_engine_2/swagger-ui-es-bundle.js +1 -1
- data/app/assets/javascripts/swagger_ui_engine_2/swagger-ui-es-bundle.js.map +1 -1
- data/app/assets/javascripts/swagger_ui_engine_2/swagger-ui-standalone-preset.js +1 -1
- data/app/assets/javascripts/swagger_ui_engine_2/swagger-ui-standalone-preset.js.map +1 -1
- data/app/assets/javascripts/swagger_ui_engine_2/swagger-ui.js +1 -1
- data/app/assets/javascripts/swagger_ui_engine_2/swagger-ui.js.map +1 -0
- data/app/controllers/swagger_ui_engine2/swagger_docs_controller.rb +2 -2
- data/app/helpers/swagger_ui_engine_2/config_parser.rb +1 -2
- data/app/views/swagger_ui_engine2/swagger_docs/index.html.erb +2 -3
- data/lib/swagger_ui_engine_2/configuration.rb +4 -12
- data/lib/swagger_ui_engine_2/defaults.rb +2 -3
- data/lib/swagger_ui_engine_2/version.rb +1 -1
- metadata +7 -8
- data/app/assets/stylesheets/swagger_ui_engine_2/swagger-ui.js +0 -2
- data/app/assets/stylesheets/swagger_ui_engine_2/swagger-ui.js.map +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 51014a3f4a48468f34c5d2b365b937dfd5e73ca13b49b687d912dc287f4a5ee4
|
|
4
|
+
data.tar.gz: 68c14c5012785eeceb4f32155a677a7d490badfc8e20514607612415bb5b33ca
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9b8425a07528b24c59cb12c8fc1c6fdcc8c32ac553956561c53f79b2483b95e6ea0126cb5e786cd89eba3b08f3b1b8b01d091ca6b2e07bdb89be3c4161573a53
|
|
7
|
+
data.tar.gz: f5e6a22042a231a77edd633f10a8d2b094d26866ceb741482c1ab57fb0795c98b254bce34f0d5ef10833fb896d87c6327aa0896a333fc65b4d3d4285fa6f0479
|
data/README.md
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
# SwaggerUiEngine2
|
|
2
|
-
Short description and motivation.
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Include [swagger-ui](https://github.com/swagger-api/swagger-ui) as Rails engine and document your API with simple YAML files.
|
|
4
|
+
|
|
5
|
+
This gem is a fork of 'swagger_ui_engine'. Because it is no longer maintainable anymore.
|
|
6
|
+
|
|
7
|
+
## Versions
|
|
8
|
+
|
|
9
|
+
Swagger UI version | Rails version
|
|
10
|
+
------------------ | ----------------
|
|
11
|
+
4.6.2 | >= 6
|
|
6
12
|
|
|
7
13
|
## Installation
|
|
8
14
|
Add this line to your application's Gemfile:
|
|
9
15
|
|
|
10
16
|
```ruby
|
|
11
|
-
gem
|
|
17
|
+
gem 'swagger_ui_engine_2'
|
|
12
18
|
```
|
|
13
19
|
|
|
14
20
|
And then execute:
|
|
@@ -16,13 +22,51 @@ And then execute:
|
|
|
16
22
|
$ bundle
|
|
17
23
|
```
|
|
18
24
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
### Mount
|
|
28
|
+
|
|
29
|
+
Add to your `config/routes.rb`
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
mount SwaggerUiEngine2::Engine, at: "/api_docs"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
You can place this route under `admin_constraint` or other restricted path, or configure basic HTTP authentication.
|
|
36
|
+
|
|
37
|
+
#### Basic HTTP auth
|
|
38
|
+
|
|
39
|
+
Set admin username and password in an initializer:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
# config/initializers/swagger_ui_engine.rb
|
|
43
|
+
|
|
44
|
+
SwaggerUiEngine2.configure do |config|
|
|
45
|
+
config.admin_username = ENV['ADMIN_USERNAME']
|
|
46
|
+
config.admin_password = ENV['ADMIN_PASSWORD']
|
|
47
|
+
end
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
#### Single API documentation
|
|
51
|
+
|
|
52
|
+
You can define your main documentation url in a hash value (same way as in the versioned documentations) or pass single string with the url:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
# config/initializers/swagger_ui_engine.rb
|
|
56
|
+
|
|
57
|
+
SwaggerUiEngine2.configure do |config|
|
|
58
|
+
config.swagger_url = 'open_api.json'
|
|
59
|
+
end
|
|
22
60
|
```
|
|
23
61
|
|
|
24
|
-
|
|
25
|
-
|
|
62
|
+
### Configure
|
|
63
|
+
Config Name | Swagger parameter name | Description
|
|
64
|
+
--- | --- | ---
|
|
65
|
+
config.swagger_url | url | The URL pointing to API definition (normally swagger.json or swagger.yaml)
|
|
66
|
+
config.doc_expansion | docExpansion | Controls the default expansion setting for the operations and tags. It can be 'list' (expands only the tags), 'full' (expands the tags and operations) or 'none' (expands nothing).
|
|
67
|
+
config.model_rendering | defaultModelRendering | Controls how the model is shown when the API is first rendered. (The user can always switch the rendering for a given model by clicking the 'Model' and 'Example Value' links.)
|
|
68
|
+
config.layout | layout | The name of a component available via the plugin system to use as the top-level layout for Swagger UI. It can be 'StandaloneLayout' (shows the url) and 'BaseLayout' (hides the url) |
|
|
69
|
+
config.validator_enabled | validatorUrl | Enables documentation validator. Defaults to `false` (`validatorUrl: 'null'`).
|
|
26
70
|
|
|
27
71
|
## License
|
|
28
72
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|