swagger-docs 0.0.3 → 0.1.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.gitignore +1 -0
- data/Appraisals +7 -0
- data/CHANGELOG.md +22 -0
- data/README.md +100 -9
- data/Rakefile +9 -0
- data/lib/swagger/docs/config.rb +3 -2
- data/lib/swagger/docs/dsl.rb +1 -1
- data/lib/swagger/docs/generator.rb +32 -13
- data/lib/swagger/docs/version.rb +1 -1
- data/spec/fixtures/controllers/sample_controller.rb +5 -4
- data/spec/lib/swagger/docs/generator_spec.rb +50 -25
- data/spec/spec_helper.rb +7 -4
- data/swagger-docs.gemspec +1 -0
- metadata +18 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a75950a4aa93348fac017729155424b1874af4fd
|
4
|
+
data.tar.gz: 4e5999ac0013e7d6e97576266a389ffad061ae3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ecb1013e18dba07d1ce736e0f0013fe8e55c1fd60e5e05a17a14e3a8ec745ff4f24fd0aa2fbb20ab1495390121657be931d3bceb8a77f0e0e98d237923f04e3
|
7
|
+
data.tar.gz: 41b87d5d7faa0d941cb2ef509099679ceb9ab5ee8c6d4814fc77239e3a69ec7314386cfee936084e76995d5e3fb26b231b4e51a992de33c08dac5cc4f8620adb
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.gitignore
CHANGED
data/Appraisals
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
## 0.1.0
|
2
|
+
|
3
|
+
- Add CHANGELOG.md
|
4
|
+
- Add `api_extension_type` option (support for other route .formats)
|
5
|
+
- Rails Appraisals
|
6
|
+
- Add configuration options table to README documentation
|
7
|
+
- Guidance on inheritance and asset pre-compilation
|
8
|
+
- Custom response message error text can now be set
|
9
|
+
- Ability to override base controller with `base_api_controller` method
|
10
|
+
- Default configuration for Generator
|
11
|
+
|
12
|
+
##0.0.3
|
13
|
+
|
14
|
+
- Documentation
|
15
|
+
|
16
|
+
## 0.0.2
|
17
|
+
|
18
|
+
- Add `base_path` option
|
19
|
+
|
20
|
+
## 0.0.1
|
21
|
+
|
22
|
+
- Initial release
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@ Generates swagger-ui json files for rails apps with APIs. You add the swagger DS
|
|
4
4
|
|
5
5
|
Here is an extract of the DSL from a user controller API class:
|
6
6
|
|
7
|
-
```
|
7
|
+
```ruby
|
8
8
|
swagger_controller :users, "User Management"
|
9
9
|
|
10
10
|
swagger_api :index do
|
@@ -36,19 +36,72 @@ Or install it yourself as:
|
|
36
36
|
|
37
37
|
Create an initializer in config/initializers (e.g. swagger_docs.rb) and define your APIs:
|
38
38
|
|
39
|
-
```
|
39
|
+
```ruby
|
40
40
|
Swagger::Docs::Config.register_apis({
|
41
41
|
"1.0" => {
|
42
|
-
|
43
|
-
:
|
44
|
-
|
42
|
+
# the extension used for the API
|
43
|
+
:api_extension_type => :json,
|
44
|
+
# the output location where your .json files are written to
|
45
|
+
:api_file_path => "public/api/v1/",
|
46
|
+
# the URL base path to your API
|
47
|
+
:base_path => "http://api.somedomain.com",
|
48
|
+
# if you want to delete all .json files at each generation
|
49
|
+
:clean_directory => false
|
45
50
|
}
|
46
|
-
)
|
51
|
+
})
|
47
52
|
```
|
48
53
|
|
54
|
+
#### Configuration options
|
55
|
+
|
56
|
+
The following table shows all the current configuration options and their defaults. The default will be used if you don't supply your own value.
|
57
|
+
|
58
|
+
<table>
|
59
|
+
<thead>
|
60
|
+
<tr>
|
61
|
+
<th>Option</th>
|
62
|
+
<th>Description</th>
|
63
|
+
<th>Default</th>
|
64
|
+
</tr>
|
65
|
+
</thead>
|
66
|
+
<tbody>
|
67
|
+
|
68
|
+
<tr>
|
69
|
+
<td><b>api_extension_type</b></td>
|
70
|
+
<td>The extension, if necessary, used for your API - e.g. :json or :xml </td>
|
71
|
+
<td>nil</td>
|
72
|
+
</tr>
|
73
|
+
|
74
|
+
<tr>
|
75
|
+
<td><b>api_file_path</b></td>
|
76
|
+
<td>The output file path where generated swagger-docs files are written to. </td>
|
77
|
+
<td>public/</td>
|
78
|
+
</tr>
|
79
|
+
|
80
|
+
<tr>
|
81
|
+
<td><b>base_path</b></td>
|
82
|
+
<td>The URI base path for your API - e.g. api.somedomain.com</td>
|
83
|
+
<td>/</td>
|
84
|
+
</tr>
|
85
|
+
|
86
|
+
<tr>
|
87
|
+
<td><b>clean_directory</b></td>
|
88
|
+
<td>When generating swagger-docs files this option specifies if the api_file_path should be cleaned first. This means that all files will be deleted in the output directory first before any files are generated.</td>
|
89
|
+
<td>false</td>
|
90
|
+
</tr>
|
91
|
+
|
92
|
+
<tr>
|
93
|
+
<td><b>formatting</b></td>
|
94
|
+
<td>Specifies which formatting method to apply to the JSON that is written. Available options: :none, :pretty</td>
|
95
|
+
<td>:pretty</td>
|
96
|
+
</tr>
|
97
|
+
|
98
|
+
</tbody>
|
99
|
+
</table>
|
100
|
+
|
101
|
+
|
49
102
|
### Documenting a controller
|
50
103
|
|
51
|
-
```
|
104
|
+
```ruby
|
52
105
|
class Api::V1::UsersController < ApplicationController
|
53
106
|
|
54
107
|
swagger_controller :users, "User Management"
|
@@ -113,12 +166,46 @@ A sample Rails application where you can run the above rake command and view the
|
|
113
166
|
|
114
167
|
https://github.com/richhollis/swagger-docs-sample
|
115
168
|
|
169
|
+

|
170
|
+
|
171
|
+
|
172
|
+
### Advanced Customization
|
173
|
+
|
174
|
+
#### Inheriting from a custom Api controller
|
175
|
+
|
176
|
+
By default swagger-docs is applied to controllers inheriting from ApplicationController.
|
177
|
+
If this is not the case for your application, use this snippet in your initializer
|
178
|
+
_before_ calling Swagger::Docs::Config#register_apis(...).
|
179
|
+
|
180
|
+
```ruby
|
181
|
+
class Swagger::Docs::Config
|
182
|
+
def self.base_api_controller; Api::ApiController end
|
183
|
+
end
|
184
|
+
```
|
185
|
+
|
186
|
+
#### Precompile
|
187
|
+
|
188
|
+
It is best-practice *not* to keep documentation in version control. An easy way
|
189
|
+
to integrate swagger-docs into a conventional deployment setup (e.g. capistrano,
|
190
|
+
chef, or opsworks) is to piggyback on the 'assets:precompile' rake task. And don't forget
|
191
|
+
to add your api documentation directory to .gitignore in this case.
|
192
|
+
|
193
|
+
```ruby
|
194
|
+
#Rakefile or lib/task/precompile_overrides.rake
|
195
|
+
namespace :assets do
|
196
|
+
task :precompile do
|
197
|
+
Rake::Task['assets:precompile'].invoke
|
198
|
+
Rake::Task['swagger:docs'].invoke
|
199
|
+
end
|
200
|
+
end
|
201
|
+
```
|
202
|
+
|
116
203
|
### Output files
|
117
204
|
|
118
205
|
api-docs.json output:
|
119
206
|
|
120
207
|
|
121
|
-
```
|
208
|
+
```json
|
122
209
|
{
|
123
210
|
"apiVersion": "1.0",
|
124
211
|
"swaggerVersion": "1.2",
|
@@ -134,7 +221,7 @@ api-docs.json output:
|
|
134
221
|
|
135
222
|
users.json output:
|
136
223
|
|
137
|
-
```
|
224
|
+
```json
|
138
225
|
{
|
139
226
|
"apiVersion": "1.0",
|
140
227
|
"swaggerVersion": "1.2",
|
@@ -337,6 +424,10 @@ users.json output:
|
|
337
424
|
}
|
338
425
|
```
|
339
426
|
|
427
|
+
## Thanks to our contributors
|
428
|
+
|
429
|
+
Thanks to @jdar and all our contributors.
|
430
|
+
|
340
431
|
## Contributing
|
341
432
|
|
342
433
|
1. Fork it
|
data/Rakefile
CHANGED
data/lib/swagger/docs/config.rb
CHANGED
@@ -2,8 +2,9 @@ module Swagger
|
|
2
2
|
module Docs
|
3
3
|
class Config
|
4
4
|
class << self
|
5
|
+
def base_api_controller; ApplicationController end
|
5
6
|
def register_apis(versions)
|
6
|
-
|
7
|
+
base_api_controller.send(:include, ImpotentMethods)
|
7
8
|
@versions = versions
|
8
9
|
end
|
9
10
|
def registered_apis
|
@@ -12,4 +13,4 @@ module Swagger
|
|
12
13
|
end
|
13
14
|
end
|
14
15
|
end
|
15
|
-
end
|
16
|
+
end
|
data/lib/swagger/docs/dsl.rb
CHANGED
@@ -45,7 +45,7 @@ module Swagger
|
|
45
45
|
def response(status, text = nil, model = nil)
|
46
46
|
if status.is_a? Symbol
|
47
47
|
status_code = Rack::Utils.status_code(status)
|
48
|
-
response_messages << {:code => status_code, :message => status.to_s.titleize}
|
48
|
+
response_messages << {:code => status_code, :message => text || status.to_s.titleize}
|
49
49
|
else
|
50
50
|
response_messages << {:code => status, :message => text}
|
51
51
|
end
|
@@ -1,6 +1,15 @@
|
|
1
1
|
module Swagger
|
2
2
|
module Docs
|
3
3
|
class Generator
|
4
|
+
|
5
|
+
DEFAULT_VER = "1.0"
|
6
|
+
DEFAULT_CONFIG = {
|
7
|
+
:api_file_path => "public/",
|
8
|
+
:base_path => "/",
|
9
|
+
:clean_directory => false,
|
10
|
+
:formatting => :pretty
|
11
|
+
}
|
12
|
+
|
4
13
|
class << self
|
5
14
|
|
6
15
|
def camelize_keys_deep!(h)
|
@@ -17,8 +26,9 @@ module Swagger
|
|
17
26
|
end
|
18
27
|
end
|
19
28
|
|
20
|
-
def get_api_path(spec)
|
21
|
-
|
29
|
+
def get_api_path(spec, extension)
|
30
|
+
extension = ".#{extension}" if extension
|
31
|
+
path_api = trim_leading_slash(spec.to_s.gsub("(.:format)", extension.to_s))
|
22
32
|
parts_new = []
|
23
33
|
path_api.split("/").each do |path_part|
|
24
34
|
part = path_part
|
@@ -48,20 +58,20 @@ module Swagger
|
|
48
58
|
end
|
49
59
|
|
50
60
|
def set_real_methods
|
51
|
-
|
61
|
+
Config.base_api_controller.send(:include, Methods) # replace impotent methods with live ones
|
52
62
|
end
|
53
63
|
|
54
|
-
def write_docs(apis)
|
64
|
+
def write_docs(apis = nil)
|
65
|
+
apis ||= Config.registered_apis
|
55
66
|
results = {}
|
56
67
|
set_real_methods
|
57
|
-
unless
|
58
|
-
|
68
|
+
unless apis.empty?
|
69
|
+
apis.each do |api_version,config|
|
70
|
+
config.reverse_merge!(DEFAULT_CONFIG)
|
59
71
|
results[api_version] = write_doc(api_version, config)
|
60
72
|
end
|
61
73
|
else
|
62
|
-
|
63
|
-
puts "No swagger_docs config: Using default config #{config}"
|
64
|
-
results["1.0"] = write_doc("1.0", config)
|
74
|
+
results[DEFAULT_VER] = write_doc(DEFAULT_VER, DEFAULT_CONFIG)
|
65
75
|
end
|
66
76
|
results
|
67
77
|
end
|
@@ -99,23 +109,32 @@ module Swagger
|
|
99
109
|
operations = Hash[operations.map {|k, v| [k.to_s.gsub("@","").to_sym, v] }] # rename :@instance hash keys
|
100
110
|
operations[:method] = verb
|
101
111
|
operations[:nickname] = "#{path.camelize}##{action}"
|
102
|
-
apis << {:path => trim_slashes(get_api_path(trim_leading_slash(route.path.spec.to_s)).gsub("#{controller_base_path}","")), :operations => [operations]}
|
112
|
+
apis << {:path => trim_slashes(get_api_path(trim_leading_slash(route.path.spec.to_s), config[:api_extension_type]).gsub("#{controller_base_path}","")), :operations => [operations]}
|
103
113
|
end
|
104
114
|
demod = "#{debased_path.to_s.camelize}".demodulize.camelize.underscore
|
105
115
|
resource = header.merge({:resource_path => "#{demod}", :apis => apis})
|
106
116
|
camelize_keys_deep!(resource)
|
107
117
|
# write controller resource file
|
108
|
-
|
118
|
+
write_to_file "#{api_file_path}/#{demod}.json", resource, config
|
109
119
|
# append resource to resources array (for writing out at end)
|
110
120
|
resources[:apis] << {path: "#{trim_leading_slash(debased_path)}.{format}", description: klass.swagger_config[:description]}
|
111
121
|
results[:processed] << path
|
112
122
|
end
|
113
123
|
# write master resource file
|
114
124
|
camelize_keys_deep!(resources)
|
115
|
-
|
125
|
+
|
126
|
+
write_to_file "#{api_file_path}/api-docs.json", resources, config
|
116
127
|
results
|
117
128
|
end
|
129
|
+
|
130
|
+
def write_to_file(path, structure, config={})
|
131
|
+
content = case config[:formatting]
|
132
|
+
when :pretty; JSON.pretty_generate structure
|
133
|
+
else; structure.to_json
|
134
|
+
end
|
135
|
+
File.open(path, 'w') { |file| file.write content }
|
136
|
+
end
|
118
137
|
end
|
119
138
|
end
|
120
139
|
end
|
121
|
-
end
|
140
|
+
end
|
data/lib/swagger/docs/version.rb
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
module Api
|
2
2
|
module V1
|
3
|
-
class
|
4
|
-
|
3
|
+
class SuperclassController < ApplicationController
|
4
|
+
end
|
5
|
+
class SampleController < SuperclassController
|
5
6
|
swagger_controller :users, "User Management"
|
6
7
|
|
7
8
|
swagger_api :index do
|
8
9
|
summary "Fetches all User items"
|
9
10
|
param :query, :page, :integer, :optional, "Page number"
|
10
11
|
response :unauthorized
|
11
|
-
response :not_acceptable
|
12
|
+
response :not_acceptable, "The request you made is not acceptable"
|
12
13
|
response :requested_range_not_satisfiable
|
13
14
|
end
|
14
15
|
|
@@ -49,4 +50,4 @@ module Api
|
|
49
50
|
|
50
51
|
end
|
51
52
|
end
|
52
|
-
end
|
53
|
+
end
|
@@ -30,9 +30,11 @@ describe Swagger::Docs::Generator do
|
|
30
30
|
]}
|
31
31
|
|
32
32
|
context "without controller base path" do
|
33
|
-
let(:config) {
|
34
|
-
|
35
|
-
|
33
|
+
let(:config) {
|
34
|
+
{
|
35
|
+
DEFAULT_VER => {:api_file_path => "#{TMP_DIR}api/v1/", :base_path => "http://api.no.where"}
|
36
|
+
}
|
37
|
+
}
|
36
38
|
before(:each) do
|
37
39
|
Rails.stub_chain(:application, :routes, :routes).and_return(routes)
|
38
40
|
Swagger::Docs::Generator.set_real_methods
|
@@ -40,7 +42,7 @@ describe Swagger::Docs::Generator do
|
|
40
42
|
generate(config)
|
41
43
|
end
|
42
44
|
context "resources files" do
|
43
|
-
let(:resources) {
|
45
|
+
let(:resources) { FILE_RESOURCES.read }
|
44
46
|
let(:response) { JSON.parse(resources) }
|
45
47
|
it "writes basePath correctly" do
|
46
48
|
expect(response["basePath"]).to eq "http://api.no.where/"
|
@@ -53,7 +55,7 @@ describe Swagger::Docs::Generator do
|
|
53
55
|
end
|
54
56
|
end
|
55
57
|
context "resource file" do
|
56
|
-
let(:resource) {
|
58
|
+
let(:resource) { FILE_RESOURCE.read }
|
57
59
|
let(:response) { JSON.parse(resource) }
|
58
60
|
let(:first) { response["apis"].first }
|
59
61
|
let(:operations) { first["operations"] }
|
@@ -79,7 +81,7 @@ describe Swagger::Docs::Generator do
|
|
79
81
|
|
80
82
|
context "with controller base path" do
|
81
83
|
let(:config) { Swagger::Docs::Config.register_apis({
|
82
|
-
|
84
|
+
DEFAULT_VER => {:controller_base_path => "api/v1", :api_file_path => "#{TMP_DIR}api/v1/", :base_path => "http://api.no.where"}
|
83
85
|
})}
|
84
86
|
before(:each) do
|
85
87
|
Rails.stub_chain(:application, :routes, :routes).and_return(routes)
|
@@ -89,48 +91,63 @@ describe Swagger::Docs::Generator do
|
|
89
91
|
|
90
92
|
context "test suite initialization" do
|
91
93
|
it "the resources file does not exist" do
|
92
|
-
expect(
|
94
|
+
expect(FILE_RESOURCES).to_not exist
|
93
95
|
end
|
94
96
|
it "the resource file does not exist" do
|
95
|
-
expect(
|
97
|
+
expect(FILE_RESOURCE).to_not exist
|
96
98
|
end
|
97
99
|
end
|
98
100
|
|
99
101
|
describe "#write_docs" do
|
102
|
+
context "no apis registered" do
|
103
|
+
before(:each) do
|
104
|
+
Swagger::Docs::Config.register_apis({})
|
105
|
+
end
|
106
|
+
it "generates using default config" do
|
107
|
+
results = generate({})
|
108
|
+
expect(results[DEFAULT_VER][:processed].count).to eq 1
|
109
|
+
end
|
110
|
+
end
|
100
111
|
before(:each) do
|
101
112
|
generate(config)
|
102
113
|
end
|
103
114
|
it "cleans json files in directory when set" do
|
104
|
-
file_to_delete = "
|
115
|
+
file_to_delete = TMP_DIR+"api/v1/delete_me.json"
|
105
116
|
File.open(file_to_delete, 'w') {|f| f.write("{}") }
|
106
|
-
expect(
|
107
|
-
config[
|
117
|
+
expect(file_to_delete).to exist
|
118
|
+
config[DEFAULT_VER][:clean_directory] = true
|
108
119
|
generate(config)
|
109
|
-
expect(
|
120
|
+
expect(file_to_delete).to_not exist
|
110
121
|
end
|
111
122
|
it "keeps non json files in directory when cleaning" do
|
112
|
-
file_to_keep = "
|
123
|
+
file_to_keep = TMP_DIR+"api/v1/keep_me"
|
113
124
|
File.open(file_to_keep, 'w') {|f| f.write("{}") }
|
114
|
-
config[
|
125
|
+
config[DEFAULT_VER][:clean_directory] = true
|
115
126
|
generate(config)
|
116
|
-
expect(
|
127
|
+
expect(file_to_keep).to exist
|
117
128
|
end
|
118
129
|
it "writes the resources file" do
|
119
|
-
expect(
|
130
|
+
expect(FILE_RESOURCES).to exist
|
120
131
|
end
|
121
132
|
it "writes the resource file" do
|
122
|
-
expect(
|
133
|
+
expect(FILE_RESOURCE).to exist
|
123
134
|
end
|
124
135
|
it "returns results hash" do
|
125
136
|
results = generate(config)
|
126
|
-
expect(results[
|
127
|
-
expect(results[
|
137
|
+
expect(results[DEFAULT_VER][:processed].count).to eq 1
|
138
|
+
expect(results[DEFAULT_VER][:skipped].count).to eq 1
|
139
|
+
end
|
140
|
+
it "writes pretty json files when set" do
|
141
|
+
config[DEFAULT_VER][:formatting] = :pretty
|
142
|
+
generate(config)
|
143
|
+
resources = File.read FILE_RESOURCES
|
144
|
+
expect(resources.scan(/\n/).length).to be > 1
|
128
145
|
end
|
129
146
|
context "resources files" do
|
130
|
-
let(:resources) {
|
147
|
+
let(:resources) { FILE_RESOURCES.read }
|
131
148
|
let(:response) { JSON.parse(resources) }
|
132
149
|
it "writes version correctly" do
|
133
|
-
expect(response["apiVersion"]).to eq
|
150
|
+
expect(response["apiVersion"]).to eq DEFAULT_VER
|
134
151
|
end
|
135
152
|
it "writes swaggerVersion correctly" do
|
136
153
|
expect(response["swaggerVersion"]).to eq "1.2"
|
@@ -149,7 +166,7 @@ describe Swagger::Docs::Generator do
|
|
149
166
|
end
|
150
167
|
end
|
151
168
|
context "resource file" do
|
152
|
-
let(:resource) {
|
169
|
+
let(:resource) { FILE_RESOURCE.read }
|
153
170
|
let(:response) { JSON.parse(resource) }
|
154
171
|
let(:first) { response["apis"].first }
|
155
172
|
let(:operations) { first["operations"] }
|
@@ -157,7 +174,7 @@ describe Swagger::Docs::Generator do
|
|
157
174
|
let(:response_msgs) { operations.first["responseMessages"] }
|
158
175
|
# {"apiVersion":"1.0","swaggerVersion":"1.2","basePath":"/api/v1","resourcePath":"/sample"
|
159
176
|
it "writes version correctly" do
|
160
|
-
expect(response["apiVersion"]).to eq
|
177
|
+
expect(response["apiVersion"]).to eq DEFAULT_VER
|
161
178
|
end
|
162
179
|
it "writes swaggerVersion correctly" do
|
163
180
|
expect(response["swaggerVersion"]).to eq "1.2"
|
@@ -174,9 +191,14 @@ describe Swagger::Docs::Generator do
|
|
174
191
|
context "first api" do
|
175
192
|
#"apis":[{"path":" /sample","operations":[{"summary":"Fetches all User items"
|
176
193
|
#,"method":"get","nickname":"Api::V1::Sample#index"}]
|
177
|
-
it "writes path correctly" do
|
194
|
+
it "writes path correctly when api extension type is not set" do
|
178
195
|
expect(first["path"]).to eq "sample"
|
179
196
|
end
|
197
|
+
it "writes path correctly when api extension type is set" do
|
198
|
+
config[DEFAULT_VER][:api_extension_type] = :json
|
199
|
+
generate(config)
|
200
|
+
expect(first["path"]).to eq "sample.json"
|
201
|
+
end
|
180
202
|
it "writes summary correctly" do
|
181
203
|
expect(operations.first["summary"]).to eq "Fetches all User items"
|
182
204
|
end
|
@@ -218,9 +240,12 @@ describe Swagger::Docs::Generator do
|
|
218
240
|
it "writes message correctly" do
|
219
241
|
expect(response_msgs.first["message"]).to eq "Unauthorized"
|
220
242
|
end
|
243
|
+
it "writes specified message correctly" do
|
244
|
+
expect(response_msgs[1]["message"]).to eq "The request you made is not acceptable"
|
245
|
+
end
|
221
246
|
end
|
222
247
|
end
|
223
248
|
end
|
224
249
|
end
|
225
250
|
end
|
226
|
-
end
|
251
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,11 +2,14 @@ require "rails"
|
|
2
2
|
require "swagger/docs"
|
3
3
|
require "ostruct"
|
4
4
|
require "json"
|
5
|
+
require 'pathname'
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
DEFAULT_VER = Swagger::Docs::Generator::DEFAULT_VER
|
8
|
+
|
9
|
+
TMP_DIR = Pathname.new "/tmp/swagger-docs/"
|
10
|
+
TMP_API_DIR = TMP_DIR+"api/v1"
|
11
|
+
FILE_RESOURCES = TMP_API_DIR+"api-docs.json"
|
12
|
+
FILE_RESOURCE = TMP_API_DIR+"sample.json"
|
10
13
|
|
11
14
|
RSpec.configure do |config|
|
12
15
|
config.expect_with :rspec do |c|
|
data/swagger-docs.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swagger-docs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rich Hollis
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
RYcsqDfanYBx7QcftOnbeQq7/Ep7Zx+W9+Ph3TiJLMLdAr7bLkgN1SjvrjTL5mQR
|
31
31
|
FuQtYvE4LKiUQpG7vLTRB78dQBlSj9fnv2OM9w==
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
33
|
+
date: 2014-02-04 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: bundler
|
@@ -88,6 +88,20 @@ dependencies:
|
|
88
88
|
- - '>='
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: appraisal
|
93
|
+
requirement: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
type: :development
|
99
|
+
prerelease: false
|
100
|
+
version_requirements: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
91
105
|
description: Generates json files for rails apps to use with swagger-ui
|
92
106
|
email:
|
93
107
|
- richhollis@gmail.com
|
@@ -96,6 +110,8 @@ extensions: []
|
|
96
110
|
extra_rdoc_files: []
|
97
111
|
files:
|
98
112
|
- .gitignore
|
113
|
+
- Appraisals
|
114
|
+
- CHANGELOG.md
|
99
115
|
- Gemfile
|
100
116
|
- LICENSE.txt
|
101
117
|
- README.md
|
metadata.gz.sig
CHANGED
Binary file
|