Skip to content

Commit a0ecb06

Browse files
author
Zuzanna Stolińska
authored
Merge pull request #4 from ZuzannaSt/0.0.5-version
0.0.5 version
2 parents 0653230 + 83967c2 commit a0ecb06

File tree

85 files changed

+4016
-104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+4016
-104
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
.bundle/
22
log/*.log
3+
test/dummy/tmp/
4+
test/dummy/db/*.sqlite3
5+
test/dummy/db/*.sqlite3-journal
6+
test/dummy/log/*.log
37
swagger_ui_engine-*.gem
8+
9+
test/dummy/log/test.log

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# SwaggerUiEngine Changelog
2+
3+
## master
4+
5+
## 0.0.5
6+
7+
* Support Swagger UI version 2.2.10
8+
* Add tests
9+
* Fix fonts not being loaded
10+
* Describe problem solved by this gem in README
11+
12+
## 0.0.4
13+
14+
* Improve configurable options
15+
* Fix assets errors
16+
17+
## 0.0.1-0.0.3
18+
19+
Initial releases supporting Swagger UI version 2.2.8

Gemfile.lock

Lines changed: 100 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,110 @@
11
PATH
22
remote: .
33
specs:
4-
swagger_ui_engine (0.0.3)
4+
swagger_ui_engine (0.0.5)
5+
rails
56

67
GEM
78
remote: https://rubygems.org/
89
specs:
10+
actioncable (5.0.2)
11+
actionpack (= 5.0.2)
12+
nio4r (>= 1.2, < 3.0)
13+
websocket-driver (~> 0.6.1)
14+
actionmailer (5.0.2)
15+
actionpack (= 5.0.2)
16+
actionview (= 5.0.2)
17+
activejob (= 5.0.2)
18+
mail (~> 2.5, >= 2.5.4)
19+
rails-dom-testing (~> 2.0)
20+
actionpack (5.0.2)
21+
actionview (= 5.0.2)
22+
activesupport (= 5.0.2)
23+
rack (~> 2.0)
24+
rack-test (~> 0.6.3)
25+
rails-dom-testing (~> 2.0)
26+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
27+
actionview (5.0.2)
28+
activesupport (= 5.0.2)
29+
builder (~> 3.1)
30+
erubis (~> 2.7.0)
31+
rails-dom-testing (~> 2.0)
32+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
33+
activejob (5.0.2)
34+
activesupport (= 5.0.2)
35+
globalid (>= 0.3.6)
36+
activemodel (5.0.2)
37+
activesupport (= 5.0.2)
38+
activerecord (5.0.2)
39+
activemodel (= 5.0.2)
40+
activesupport (= 5.0.2)
41+
arel (~> 7.0)
42+
activesupport (5.0.2)
43+
concurrent-ruby (~> 1.0, >= 1.0.2)
44+
i18n (~> 0.7)
45+
minitest (~> 5.1)
46+
tzinfo (~> 1.1)
47+
arel (7.1.4)
48+
builder (3.2.3)
49+
concurrent-ruby (1.0.5)
50+
erubis (2.7.0)
51+
globalid (0.4.0)
52+
activesupport (>= 4.2.0)
53+
i18n (0.8.1)
54+
loofah (2.0.3)
55+
nokogiri (>= 1.5.9)
56+
mail (2.6.4)
57+
mime-types (>= 1.16, < 4)
58+
method_source (0.8.2)
59+
mime-types (3.1)
60+
mime-types-data (~> 3.2015)
61+
mime-types-data (3.2016.0521)
62+
mini_portile2 (2.1.0)
63+
minitest (5.10.1)
64+
nio4r (2.0.0)
65+
nokogiri (1.7.1)
66+
mini_portile2 (~> 2.1.0)
67+
rack (2.0.1)
68+
rack-test (0.6.3)
69+
rack (>= 1.0)
70+
rails (5.0.2)
71+
actioncable (= 5.0.2)
72+
actionmailer (= 5.0.2)
73+
actionpack (= 5.0.2)
74+
actionview (= 5.0.2)
75+
activejob (= 5.0.2)
76+
activemodel (= 5.0.2)
77+
activerecord (= 5.0.2)
78+
activesupport (= 5.0.2)
79+
bundler (>= 1.3.0, < 2.0)
80+
railties (= 5.0.2)
81+
sprockets-rails (>= 2.0.0)
82+
rails-dom-testing (2.0.2)
83+
activesupport (>= 4.2.0, < 6.0)
84+
nokogiri (~> 1.6)
85+
rails-html-sanitizer (1.0.3)
86+
loofah (~> 2.0)
87+
railties (5.0.2)
88+
actionpack (= 5.0.2)
89+
activesupport (= 5.0.2)
90+
method_source
91+
rake (>= 0.8.7)
92+
thor (>= 0.18.1, < 2.0)
93+
rake (12.0.0)
94+
sprockets (3.7.1)
95+
concurrent-ruby (~> 1.0)
96+
rack (> 1, < 3)
97+
sprockets-rails (3.2.0)
98+
actionpack (>= 4.0)
99+
activesupport (>= 4.0)
100+
sprockets (>= 3.0.0)
101+
thor (0.19.4)
102+
thread_safe (0.3.6)
103+
tzinfo (1.2.3)
104+
thread_safe (~> 0.1)
105+
websocket-driver (0.6.5)
106+
websocket-extensions (>= 0.1.0)
107+
websocket-extensions (0.1.2)
9108

10109
PLATFORMS
11110
ruby

README.md

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,44 @@
11
# SwaggerUiEngine
22

3-
Include [swagger-ui](https://github.com/swagger-api/swagger-ui) as rails engine and document your API with simple JSON or YAML files.
3+
Include [swagger-ui](https://github.com/swagger-api/swagger-ui) as Rails engine and document your API with simple YAML files.
44

5-
## Swagger UI Version
5+
## Versions
66

7-
Swagger UI Version |
8-
------------------ |
9-
2.2.8 |
7+
Swagger UI version | Rails version
8+
------------------ | -------------
9+
2.2.10 | >= 5.0.0
1010

11-
## Swagger specifications
11+
## Problem
1212

13-
https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md
13+
Working on a Rails API, I've wanted to document my endpoints in the clearest and easiest way possible. My goal was to have the documentation separated from the actual code base and to have a web UI version of Swagger for testing and reading it. Using Rails 5 default API, I didn't need to include Grape, so I took a look into some other existing solutions. Most of them were no longer supported (e.g. [swagger_engine](https://github.com/batdevis/swagger_engine) and [swagger-ui_rails](https://github.com/d4be4st/swagger-ui_rails)) or required adding some extra code for the actual documentation (e.g. [swagger-docs](https://github.com/richhollis/swagger-docs)). Also, none of them supported Swagger web UI configuration, so I decided to write and maintain a gem on my own that would allow others to include Swagger web UI as Rails engine and support writing simple documentation in YAML files.
1414

15-
## Install
15+
## Installation
1616

1717
Add to Gemfile
1818

19-
```gem 'swagger_ui_engine'```
19+
```
20+
gem 'swagger_ui_engine'
21+
```
22+
23+
And then run:
24+
25+
```
26+
$ bundle
27+
```
28+
29+
## Usage
30+
31+
### Mount
2032

2133
Add to your config/routes.rb
2234

23-
```mount SwaggerUiEngine::Engine, at: "/api_docs"```
35+
```
36+
mount SwaggerUiEngine::Engine, at: "/api_docs"
37+
```
2438

2539
You can place this route under `admin_constraint` or other restricted path.
2640

27-
## Configure
28-
29-
### Swagger URL
41+
### Initialize
3042

3143
Set the path of your json/yaml files in a initializer:
3244

@@ -38,21 +50,21 @@ SwaggerUiEngine.configure do |config|
3850
end
3951
```
4052

41-
It will look for you main doc file under `/public/api_docs` path.
53+
and place your main documentation file under `/public/api_docs` path.
4254

43-
### Config options
55+
### Configure
4456
Config Name | Swagger parameter name | Description
4557
--- | --- | ---
46-
config.swagger_url | url | The url pointing to `swagger.json` (Swagger 2.0) or the resource listing (earlier versions) as per [OpenAPI Spec](https://github.com/OAI/OpenAPI-Specification/).
58+
config.swagger_url | url | The url pointing to `swagger.yaml` (Swagger 2.0) as per [OpenAPI Spec](https://github.com/OAI/OpenAPI-Specification/).
4759
config.doc_expansion | docExpansion | Controls how the API listing is displayed. It can be set to 'none' (default), 'list' (shows operations for each resource), or 'full' (fully expanded: shows operations and their details).
48-
config.model_rendering | defaultModelRendering | Controls how models are shown when the API is first rendered. (The user can always switch the rendering for a given model by clicking the 'Model' and 'Model Schema' links.) It can be set to 'model' or 'schema', and the default is 'schema'.
60+
config.model_rendering | defaultModelRendering | Controls how models are shown when the API is first rendered. It can be set to 'model' or 'schema', and the default is 'schema'.
4961
config.request_headers | showRequestHeaders | Whether or not to show the headers that were sent when making a request via the 'Try it out!' option. Defaults to `false`.
5062
config.json_editor | jsonEditor | Enables a graphical view for editing complex bodies. Defaults to `false`.
5163

5264
### Edit your json/yaml files
5365

54-
Use [Swagger editor](https://github.com/swagger-api/swagger-editor).
66+
You can use [Swagger editor](https://github.com/swagger-api/swagger-editor) to write and validate your Swagger docs.
5567

5668
## License
5769

58-
This project rocks and uses MIT-LICENSE.
70+
This project is available under MIT-LICENSE. :sunny:

Rakefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,23 @@ end
66

77
require 'rdoc/task'
88

9+
load 'rails/tasks/statistics.rake'
10+
require 'bundler/gem_tasks'
11+
require 'rake/testtask'
12+
13+
Rake::TestTask.new(:test) do |t|
14+
t.libs << 'lib'
15+
t.libs << 'test'
16+
t.pattern = 'test/**/*_test.rb'
17+
t.verbose = false
18+
end
19+
920
RDoc::Task.new(:rdoc) do |rdoc|
1021
rdoc.rdoc_dir = 'rdoc'
1122
rdoc.title = 'SwaggerUiEngine'
1223
rdoc.options << '--line-numbers'
1324
rdoc.rdoc_files.include('README.rdoc')
1425
rdoc.rdoc_files.include('lib/**/*.rb')
1526
end
27+
28+
task default: :test
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)