rest-api-generator 0.1.2 → 0.1.4

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: cf4062a70bed1e9006d96375d4110b3918f3bf5d074304c4619abfa4fe33eb03
4
- data.tar.gz: ba52d11b288dd8004e68327a8db4aabac8bef8be93eea85382f3bf349406ea39
3
+ metadata.gz: 4873b5f52ba8ca76abbc7449e0c0398ee1d38fbfb47ebec80dabb293b3ca0cea
4
+ data.tar.gz: bd96d06619b7a14eb9e6b953d60bc6a2f84bb7d48b0cca5181c0a588bb066cba
5
5
  SHA512:
6
- metadata.gz: a1ef3d60ca714e5edf5db7cdcf6b0287ef22c2123c907070cb3b6608ca159ceba200642a8b45894cb88e0fab73d5abaeb728e19a05c9e2760cd0e17ccb155732
7
- data.tar.gz: 9849fa88d3b3a9f5a070c7f4a4ca29fc3deb8447adb80260004aa68076cd0a27db9cbeb5d214aed2505df4a1c1a48e26378dc41b6626159eb635d1a7d2c0218e
6
+ metadata.gz: 7cd7f1d823c9b0abba38301024eefb393eb460b10a0ff92e41b7f377b401f09f37771afd039701539fd697a4612e0b0a46ef99b6eccf81d118a23e5fff63bfbb
7
+ data.tar.gz: dbb337a4c098fdc2b04e71456b5664be8ca670fdd277436cf05111897a7f72ac0559bd47bacf840c6248406aae0e931506e00ad6f3715d9f22da4a9a30984b90
data/Gemfile CHANGED
@@ -10,3 +10,5 @@ gem "rake", "~> 13.0"
10
10
  gem "rspec", "~> 3.0"
11
11
 
12
12
  gem "switchcop"
13
+
14
+ gem "sqlite3"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rest-api-generator (0.1.2)
4
+ rest-api-generator (0.1.4)
5
5
  rails (>= 5.0)
6
6
 
7
7
  GEM
@@ -72,6 +72,8 @@ GEM
72
72
  i18n (>= 1.6, < 2)
73
73
  minitest (>= 5.1)
74
74
  tzinfo (~> 2.0)
75
+ addressable (2.8.1)
76
+ public_suffix (>= 2.0.2, < 6.0)
75
77
  ammeter (1.1.5)
76
78
  activesupport (>= 3.0)
77
79
  railties (>= 3.0)
@@ -94,6 +96,8 @@ GEM
94
96
  i18n (1.12.0)
95
97
  concurrent-ruby (~> 1.0)
96
98
  json (2.6.3)
99
+ json-schema (3.0.0)
100
+ addressable (>= 2.8)
97
101
  loofah (2.19.1)
98
102
  crass (~> 1.0.2)
99
103
  nokogiri (>= 1.5.9)
@@ -121,6 +125,7 @@ GEM
121
125
  parallel (1.22.1)
122
126
  parser (3.1.3.0)
123
127
  ast (~> 2.4.1)
128
+ public_suffix (5.0.1)
124
129
  racc (1.6.2)
125
130
  rack (2.2.4)
126
131
  rack-test (2.0.2)
@@ -176,6 +181,20 @@ GEM
176
181
  rspec-mocks (~> 3.11)
177
182
  rspec-support (~> 3.11)
178
183
  rspec-support (3.12.0)
184
+ rswag (2.8.0)
185
+ rswag-api (= 2.8.0)
186
+ rswag-specs (= 2.8.0)
187
+ rswag-ui (= 2.8.0)
188
+ rswag-api (2.8.0)
189
+ railties (>= 3.1, < 7.1)
190
+ rswag-specs (2.8.0)
191
+ activesupport (>= 3.1, < 7.1)
192
+ json-schema (>= 2.2, < 4.0)
193
+ railties (>= 3.1, < 7.1)
194
+ rspec-core (>= 2.14)
195
+ rswag-ui (2.8.0)
196
+ actionpack (>= 3.1, < 7.1)
197
+ railties (>= 3.1, < 7.1)
179
198
  rubocop (1.40.0)
180
199
  json (~> 2.3)
181
200
  parallel (~> 1.10)
@@ -227,6 +246,8 @@ DEPENDENCIES
227
246
  rest-api-generator!
228
247
  rspec (~> 3.0)
229
248
  rspec-rails (~> 6.0.0)
249
+ rswag
250
+ rswag-specs
230
251
  sqlite3
231
252
  switchcop
232
253
 
data/README.md CHANGED
@@ -20,14 +20,13 @@ Following [Switch Dreams's](https://www.switchdreams.com.br/]) coding practices,
20
20
 
21
21
  - [Automatic rest api crud generation](#example)
22
22
  - [Nested Resource](#nested-resource)
23
- - [Modular error handler](#modular-error-handler)
23
+ - :goal_net: [Modular error handler](#modular-error-handler)
24
+ - :memo: [Automated documentation](#specsdocs)
24
25
  - [Resource ordering](#ordering)
25
26
  - [Resource filter](#filtering)
26
27
 
27
28
  ## Next Features
28
29
 
29
- - Generate nested resource end-points 🚧
30
- - Automated documentation 🚧 https://github.com/SwitchDreams/rest-api-generator/issues/12
31
30
  - Serialization https://github.com/SwitchDreams/rest-api-generator/issues/14
32
31
  https://github.com/SwitchDreams/rest-api-generator/issues/11
33
32
  - Pagination https://github.com/SwitchDreams/rest-api-generator/issues/15
@@ -116,6 +115,7 @@ For a better experience you can override some methods from the
116
115
  | father | Generate nested resource | nil | --father Users |
117
116
  | scope | Scope the resource for other route or namespace organization | nil | --scope Api::V1 |
118
117
  | eject | Eject the controller to high customization | false | true |
118
+ | spec | Choose the spec format. Current options: "rspec" or "rswag" | rspec | --spec rswag |
119
119
 
120
120
  #### Scope
121
121
 
@@ -225,6 +225,24 @@ class CarsController < ApplicationController
225
225
  end
226
226
  ```
227
227
 
228
+ #### Specs/Docs
229
+
230
+ The default generated spec for this gem is using plain rspec, but you can choose rswag, for scaffold you specs and docs
231
+ at the same time:
232
+
233
+ For this you need to setup https://github.com/rswag/rswag and you the following flag when generating resources.
234
+
235
+ ```shell
236
+ rails g rest_api_generator:resource Car name:string color:string --spec rswag
237
+ ```
238
+
239
+ This spec options work as generators too, so you can call them individually:
240
+
241
+ ```shell
242
+ # rest_api_generator:spec:rswag or rest_api_generator:spec:rspec
243
+ rails g rest_api_generator:spec:rswag Car name:string color:string
244
+ ```
245
+
228
246
  ### Resource Features
229
247
 
230
248
  #### Modular Error Handler
@@ -4,8 +4,12 @@ module RestApiGenerator
4
4
  module Helpers
5
5
  attr_accessor :options, :attributes
6
6
 
7
+ API_CONTROLLER_DIR_PATH = "app/controllers"
8
+ API_TEST_DIR_PATH = "spec/requests"
9
+
7
10
  private
8
11
 
12
+ # Columns handlers
9
13
  def model_columns_for_attributes
10
14
  class_name.singularize.constantize.columns.reject do |column|
11
15
  column.name.to_s =~ /^(id|user_id|created_at|updated_at)$/
@@ -18,6 +22,42 @@ module RestApiGenerator
18
22
  end
19
23
  end
20
24
 
25
+ # Namespace scope
26
+
27
+ def scope_namespacing(&block)
28
+ content = capture(&block)
29
+ content = wrap_with_scope(content) if options["scope"].present? || options["father"].present?
30
+ concat(content)
31
+ end
32
+
33
+ def module_namespace
34
+ if options["scope"].present? && options["father"].present?
35
+ options["scope"] + "::" + options["father"]
36
+ else
37
+ options["scope"] + options["father"]
38
+ end
39
+ end
40
+
41
+ def wrap_with_scope(content)
42
+ content = indent(content).chomp
43
+ "module #{module_namespace}\n#{content}\nend\n"
44
+ end
45
+
46
+ # Paths handlers
47
+ def controller_path
48
+ "#{API_CONTROLLER_DIR_PATH}#{scope_path}/#{file_name.pluralize}_controller.rb"
49
+ end
50
+
51
+ def scope_path
52
+ return "" if options["scope"].blank? && options["father"].blank?
53
+
54
+ if options["scope"].present? && options["father"].present?
55
+ "/" + option_to_path(options["scope"]) + "/" + option_to_path(options["father"])
56
+ else
57
+ "/" + option_to_path(options["scope"]) + option_to_path(options["father"])
58
+ end
59
+ end
60
+
21
61
  def option_to_path(option)
22
62
  option.downcase.split("::").join("/")
23
63
  end
@@ -31,20 +71,24 @@ module RestApiGenerator
31
71
  def nested_routes
32
72
  return "" if options["father"].blank?
33
73
 
34
- "#{options["father"].downcase.pluralize}/\#{#{options["father"].singularize.downcase}.id}/#{plural_name}"
74
+ "#{options["father"].downcase.pluralize}/\#{#{options["father"].singularize.downcase}.id}"
35
75
  end
36
76
 
37
77
  def initial_route
38
- scope_route_path + "/" + nested_routes
78
+ route = ""
79
+ route += scope_route_path if options["scope"].present?
80
+ route += options["father"].present? && route.present? ? "/#{nested_routes}" : nested_routes
81
+ route += "/#{plural_name}"
82
+ route[0] == "/" ? route : "/#{route}"
39
83
  end
40
84
 
41
85
  def spec_routes
42
86
  {
43
87
  index: initial_route,
44
- show: initial_route + "\#{#{singular_name}.id}",
88
+ show: initial_route + "/\#{#{singular_name}.id}",
45
89
  create: initial_route,
46
- update: initial_route + "\#{#{singular_name}.id}",
47
- delete: initial_route + "\#{#{singular_name}.id}",
90
+ update: initial_route + "/\#{#{singular_name}.id}",
91
+ delete: initial_route + "/\#{#{singular_name}.id}",
48
92
  }
49
93
  end
50
94
  end
@@ -13,20 +13,14 @@ module RestApiGenerator
13
13
  class_option :eject, type: :boolean, default: false
14
14
  class_option :scope, type: :string, default: ""
15
15
  class_option :father, type: :string, default: ""
16
-
17
- API_CONTROLLER_DIR_PATH = "app/controllers"
18
- API_TEST_DIR_PATH = "spec/requests"
16
+ hook_for :spec, in: "rest_api_generator:spec", default: "rspec"
19
17
 
20
18
  def create_service_file
21
19
  create_model_files
22
20
 
23
- # Create controller and specs
24
- controller_path = "#{API_CONTROLLER_DIR_PATH}#{scope_path}/#{file_name.pluralize}_controller.rb"
25
- controller_test_path = "#{API_TEST_DIR_PATH}#{scope_path}/#{file_name.pluralize}_controller_spec.rb"
26
-
27
21
  template controller_template, controller_path
28
- template spec_controller_template, controller_test_path
29
22
 
23
+ # Routes
30
24
  if options["scope"].blank? && options["father"].blank?
31
25
  route "resources :#{file_name.pluralize}"
32
26
  else
@@ -36,35 +30,6 @@ module RestApiGenerator
36
30
 
37
31
  private
38
32
 
39
- def scope_path
40
- return "" if options["scope"].blank? && options["father"].blank?
41
-
42
- if options["scope"].present? && options["father"].present?
43
- "/" + option_to_path(options["scope"]) + "/" + option_to_path(options["father"])
44
- else
45
- "/" + option_to_path(options["scope"]) + option_to_path(options["father"])
46
- end
47
- end
48
-
49
- def scope_namespacing(&block)
50
- content = capture(&block)
51
- content = wrap_with_scope(content) if options["scope"].present? || options["father"].present?
52
- concat(content)
53
- end
54
-
55
- def module_namespace
56
- if options["scope"].present? && options["father"].present?
57
- options["scope"] + "::" + options["father"]
58
- else
59
- options["scope"] + options["father"]
60
- end
61
- end
62
-
63
- def wrap_with_scope(content)
64
- content = indent(content).chomp
65
- "module #{module_namespace}\n#{content}\nend\n"
66
- end
67
-
68
33
  def controller_template
69
34
  if options["eject"]
70
35
  if options["father"].present?
@@ -79,14 +44,6 @@ module RestApiGenerator
79
44
  end
80
45
  end
81
46
 
82
- def spec_controller_template
83
- if options["father"].present?
84
- "child_api_spec.rb"
85
- else
86
- "rest_api_spec.rb"
87
- end
88
- end
89
-
90
47
  def create_model_files
91
48
  g = Rails::Generators::ModelGenerator.new([file_name, build_model_attributes])
92
49
  g.destination_root = destination_root
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/generators"
4
+ require "generators/rest_api_generator/helpers"
5
+
6
+ module RestApiGenerator
7
+ module Spec
8
+ class RspecGenerator < Rails::Generators::NamedBase
9
+ include Helpers
10
+ source_root File.expand_path("templates", __dir__)
11
+
12
+ argument :attributes, type: :array, default: [], banner: "field[:type][:index] field[:type][:index]"
13
+ class_option :eject, type: :boolean, default: false
14
+ class_option :scope, type: :string, default: ""
15
+ class_option :father, type: :string, default: ""
16
+
17
+ def create_service_file
18
+ template spec_controller_template, controller_test_path
19
+ end
20
+
21
+ private
22
+
23
+ def controller_test_path
24
+ "#{API_TEST_DIR_PATH}#{scope_path}/#{file_name.pluralize}_controller_spec.rb"
25
+ end
26
+
27
+ def spec_controller_template
28
+ if options["father"].present?
29
+ "rspec/nested_resource_controller_spec.rb"
30
+ else
31
+ "rspec/resource_controller_spec.rb"
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/generators"
4
+ require "generators/rest_api_generator/helpers"
5
+
6
+ module RestApiGenerator
7
+ module Spec
8
+ class RswagGenerator < Rails::Generators::NamedBase
9
+ include Helpers
10
+ source_root File.expand_path("templates", __dir__)
11
+
12
+ argument :attributes, type: :array, default: [], banner: "field[:type][:index] field[:type][:index]"
13
+ class_option :eject, type: :boolean, default: false
14
+ class_option :scope, type: :string, default: ""
15
+ class_option :father, type: :string, default: ""
16
+
17
+ def create_service_file
18
+ template spec_controller_template, controller_test_path
19
+ end
20
+
21
+ private
22
+
23
+ # Changes nested routes for rswag format
24
+ # Example: /cars/{car.id}/drivers/{id}
25
+ def nested_routes
26
+ return "" if options["father"].blank?
27
+
28
+ "#{options["father"].downcase.pluralize}/{#{options["father"].singularize.downcase}_id}"
29
+ end
30
+
31
+ def spec_routes
32
+ {
33
+ index: initial_route,
34
+ show: initial_route + "/{id}",
35
+ create: initial_route,
36
+ update: initial_route + "/{id}",
37
+ delete: initial_route + "/{id}",
38
+ }
39
+ end
40
+
41
+ def controller_test_path
42
+ "#{API_TEST_DIR_PATH}#{scope_path}/#{file_name.pluralize}_spec.rb"
43
+ end
44
+
45
+ def spec_controller_template
46
+ if options["father"].present?
47
+ "rswag/nested_resource_controller_spec.rb"
48
+ else
49
+ "rswag/resource_controller_spec.rb"
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -38,7 +38,7 @@ RSpec.describe "<%= class_name %>", type: :request do
38
38
 
39
39
  describe "DELETE /<%= plural_name %>/:id" do
40
40
  it "deletes an <%= plural_name %>" do
41
- item = create(:<%= singular_name %>)
41
+ <%= singular_name %> = create(:<%= singular_name %>)
42
42
  expect do
43
43
  delete "<%= spec_routes[:delete] %>"
44
44
  end.to change(<%= class_name %>, :count).by(-1)
@@ -0,0 +1,116 @@
1
+ require "rails_helper"
2
+
3
+ RSpec.describe "<%= spec_routes[:index] %>", type: :request do
4
+ let(:resource) { create(:<%= singular_table_name %>, <%= options['father'].downcase.singularize %>: parent_resource) }
5
+ let(:parent_resource ) { create(:<%= options['father'].downcase.singularize %>) }
6
+
7
+ path "<%= spec_routes[:index] %>" do
8
+ parameter name: "<%= options['father'].downcase.singularize %>_id", in: :path, type: :string, description: "<%= options['father'].downcase.singularize %> id"
9
+ let(:<%= options['father'].downcase.singularize %>_id) { parent_resource.id }
10
+
11
+ get("list <%= plural_name %>") do
12
+ consumes "application/json"
13
+
14
+ response(200, "successful") do
15
+ after do |example|
16
+ example.metadata[:response][:content] = {
17
+ "application/json" => {
18
+ example: JSON.parse(response.body, symbolize_names: true)
19
+ }
20
+ }
21
+ end
22
+
23
+ run_test!
24
+ end
25
+ end
26
+
27
+ post("create <%= singular_table_name %>") do
28
+ consumes "application/json"
29
+
30
+ # You'll want to customize the parameter types...
31
+ parameter name: :<%= singular_table_name %>, in: :body, schema: {
32
+ type: :object,
33
+ properties: {
34
+ <% attributes.each do |attribute| -%>
35
+ <%= attribute.name %>: { type: :string },
36
+ <% end -%>
37
+ }
38
+ }
39
+ response(201, "successful") do
40
+ let(:<%= singular_table_name %>) { attributes_for(:<%= singular_table_name %>) }
41
+
42
+ after do |example|
43
+ example.metadata[:response][:content] = {
44
+ "application/json" => {
45
+ example: JSON.parse(response.body, symbolize_names: true)
46
+ }
47
+ }
48
+ end
49
+
50
+ run_test!
51
+ end
52
+ end
53
+ end
54
+
55
+ path "<%= spec_routes[:show] %>" do
56
+ parameter name: "id", in: :path, type: :string, description: "id"
57
+ parameter name: "<%= options['father'].downcase.singularize %>_id", in: :path, type: :string, description: "<%= options['father'].downcase.singularize %> id"
58
+
59
+ let(:id) { resource.id }
60
+ let(:<%= options['father'].downcase.singularize %>_id) { parent_resource.id }
61
+
62
+ get("show <%= singular_table_name %>") do
63
+ consumes "application/json"
64
+
65
+ response(200, "successful") do
66
+
67
+ after do |example|
68
+ example.metadata[:response][:content] = {
69
+ "application/json" => {
70
+ example: JSON.parse(response.body, symbolize_names: true)
71
+ }
72
+ }
73
+ end
74
+ run_test!
75
+ end
76
+ end
77
+
78
+
79
+ patch("update <%= singular_table_name %>") do
80
+ consumes "application/json"
81
+
82
+ # You'll want to customize the parameter types...
83
+ parameter name: :<%= singular_table_name %>, in: :body, schema: {
84
+ type: :object,
85
+ properties: {
86
+ <% attributes.each do |attribute| -%>
87
+ <%= attribute.name %>: { type: :string },
88
+ <% end -%>
89
+ }
90
+ }
91
+
92
+ response(200, "successful") do
93
+ let(:<%= singular_table_name %>) { attributes_for(:<%= singular_table_name %>) }
94
+
95
+ after do |example|
96
+ example.metadata[:response][:content] = {
97
+ "application/json" => {
98
+ example: JSON.parse(response.body, symbolize_names: true)
99
+ }
100
+ }
101
+ end
102
+
103
+ run_test!
104
+ end
105
+ end
106
+
107
+ delete("delete plan") do
108
+ consumes "application/json"
109
+
110
+ response(204, "successful") do
111
+
112
+ run_test!
113
+ end
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,111 @@
1
+ require "rails_helper"
2
+
3
+ RSpec.describe "<%= spec_routes[:index] %>", type: :request do
4
+ let(:resource) { create(:<%= singular_table_name %>) }
5
+
6
+ path "<%= spec_routes[:index] %>" do
7
+ get("list <%= plural_name %>") do
8
+ consumes "application/json"
9
+
10
+ response(200, "successful") do
11
+ after do |example|
12
+ example.metadata[:response][:content] = {
13
+ "application/json" => {
14
+ example: JSON.parse(response.body, symbolize_names: true)
15
+ }
16
+ }
17
+ end
18
+
19
+ run_test!
20
+ end
21
+ end
22
+
23
+ post("create <%= singular_table_name %>") do
24
+ consumes "application/json"
25
+
26
+ # You'll want to customize the parameter types...
27
+ parameter name: :<%= singular_table_name %>, in: :body, schema: {
28
+ type: :object,
29
+ properties: {
30
+ <% attributes.each do |attribute| -%>
31
+ <%= attribute.name %>: { type: :string },
32
+ <% end -%>
33
+ }
34
+ }
35
+ response(201, "successful") do
36
+ let(:<%= singular_table_name %>) { attributes_for(:<%= singular_table_name %>) }
37
+
38
+ after do |example|
39
+ example.metadata[:response][:content] = {
40
+ "application/json" => {
41
+ example: JSON.parse(response.body, symbolize_names: true)
42
+ }
43
+ }
44
+ end
45
+
46
+ run_test!
47
+ end
48
+ end
49
+ end
50
+
51
+ path "<%= spec_routes[:show] %>" do
52
+ parameter name: "id", in: :path, type: :string, description: "id"
53
+
54
+ get("show <%= singular_table_name %>") do
55
+ consumes "application/json"
56
+
57
+ response(200, "successful") do
58
+ let(:id) { resource.id }
59
+
60
+ after do |example|
61
+ example.metadata[:response][:content] = {
62
+ "application/json" => {
63
+ example: JSON.parse(response.body, symbolize_names: true)
64
+ }
65
+ }
66
+ end
67
+ run_test!
68
+ end
69
+ end
70
+
71
+
72
+ patch("update <%= singular_table_name %>") do
73
+ consumes "application/json"
74
+
75
+ # You'll want to customize the parameter types...
76
+ parameter name: :<%= singular_table_name %>, in: :body, schema: {
77
+ type: :object,
78
+ properties: {
79
+ <% attributes.each do |attribute| -%>
80
+ <%= attribute.name %>: { type: :string },
81
+ <% end -%>
82
+ }
83
+ }
84
+
85
+ response(200, "successful") do
86
+ let(:id) { resource.id }
87
+ let(:<%= singular_table_name %>) { attributes_for(:<%= singular_table_name %>) }
88
+
89
+ after do |example|
90
+ example.metadata[:response][:content] = {
91
+ "application/json" => {
92
+ example: JSON.parse(response.body, symbolize_names: true)
93
+ }
94
+ }
95
+ end
96
+
97
+ run_test!
98
+ end
99
+ end
100
+
101
+ delete("delete plan") do
102
+ consumes "application/json"
103
+
104
+ response(204, "successful") do
105
+ let(:id) { resource.id }
106
+
107
+ run_test!
108
+ end
109
+ end
110
+ end
111
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RestApiGenerator
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.4"
5
5
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
- $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ $LOAD_PATH.push File.expand_path("../lib", __FILE__)
3
4
 
4
5
  require_relative "lib/rest_api_generator/version"
5
6
 
@@ -22,7 +23,7 @@ Gem::Specification.new do |spec|
22
23
  spec.metadata["changelog_uri"] = "https://github.com/SwitchDreams/rest-api-generator"
23
24
 
24
25
  spec.files = Dir["{bin,sig,lib,public}/**/*", "MIT-LICENSE", "Rakefile", "README.md", "rest-api-generator.gemspec",
25
- "Gemfile", "Gemfile.lock"]
26
+ "Gemfile", "Gemfile.lock"]
26
27
  spec.bindir = "exe"
27
28
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
28
29
  spec.require_paths = ["lib"]
@@ -33,9 +34,9 @@ Gem::Specification.new do |spec|
33
34
 
34
35
  spec.add_dependency "rails", ">= 5.0"
35
36
 
36
- spec.add_development_dependency 'ammeter', '~> 1.1.5'
37
- spec.add_development_dependency 'rspec-rails', '~> 6.0.0'
38
- spec.add_development_dependency 'sqlite3'
39
- spec.add_development_dependency 'database_cleaner'
40
-
37
+ spec.add_development_dependency "ammeter", "~> 1.1.5"
38
+ spec.add_development_dependency "database_cleaner"
39
+ spec.add_development_dependency "rspec-rails", "~> 6.0.0"
40
+ spec.add_development_dependency "rswag"
41
+ spec.add_development_dependency "rswag-specs"
41
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest-api-generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - PedroAugustoRamalhoDuarte
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-29 00:00:00.000000000 Z
11
+ date: 2023-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.1.5
41
+ - !ruby/object:Gem::Dependency
42
+ name: database_cleaner
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rspec-rails
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -53,7 +67,7 @@ dependencies:
53
67
  - !ruby/object:Gem::Version
54
68
  version: 6.0.0
55
69
  - !ruby/object:Gem::Dependency
56
- name: sqlite3
70
+ name: rswag
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - ">="
@@ -67,7 +81,7 @@ dependencies:
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
- name: database_cleaner
84
+ name: rswag-specs
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - ">="
@@ -97,12 +111,16 @@ files:
97
111
  - lib/generators/rest_api_generator/USAGE
98
112
  - lib/generators/rest_api_generator/helpers.rb
99
113
  - lib/generators/rest_api_generator/resource_generator.rb
114
+ - lib/generators/rest_api_generator/spec/rspec_generator.rb
115
+ - lib/generators/rest_api_generator/spec/rswag_generator.rb
116
+ - lib/generators/rest_api_generator/spec/templates/rspec/nested_resource_controller_spec.rb.tt
117
+ - lib/generators/rest_api_generator/spec/templates/rspec/resource_controller_spec.rb.tt
118
+ - lib/generators/rest_api_generator/spec/templates/rswag/nested_resource_controller_spec.rb.tt
119
+ - lib/generators/rest_api_generator/spec/templates/rswag/resource_controller_spec.rb.tt
100
120
  - lib/generators/rest_api_generator/templates/child_api_controller.rb.tt
101
- - lib/generators/rest_api_generator/templates/child_api_spec.rb.tt
102
121
  - lib/generators/rest_api_generator/templates/implicit_child_resource_controller.rb.tt
103
122
  - lib/generators/rest_api_generator/templates/implicit_resource_controller.rb.tt
104
123
  - lib/generators/rest_api_generator/templates/rest_api_controller.rb.tt
105
- - lib/generators/rest_api_generator/templates/rest_api_spec.rb.tt
106
124
  - lib/rest-api-generator.rb
107
125
  - lib/rest_api_generator.rb
108
126
  - lib/rest_api_generator/application_controller.rb