apipie-rails 0.9.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rubocop.yml +2 -2
  3. data/.rubocop.yml +23 -14
  4. data/.rubocop_todo.yml +103 -487
  5. data/CHANGELOG.md +20 -3
  6. data/README.rst +12 -12
  7. data/app/controllers/apipie/apipies_controller.rb +6 -6
  8. data/app/helpers/apipie_helper.rb +1 -1
  9. data/lib/apipie/apipie_module.rb +5 -5
  10. data/lib/apipie/application.rb +81 -55
  11. data/lib/apipie/configuration.rb +19 -26
  12. data/lib/apipie/dsl_definition.rb +8 -9
  13. data/lib/apipie/error_description.rb +1 -1
  14. data/lib/apipie/errors.rb +2 -16
  15. data/lib/apipie/extractor/collector.rb +3 -3
  16. data/lib/apipie/extractor/recorder.rb +1 -1
  17. data/lib/apipie/extractor.rb +2 -2
  18. data/lib/apipie/generator/config.rb +12 -0
  19. data/lib/apipie/generator/swagger/computed_interface_id.rb +23 -0
  20. data/lib/apipie/generator/swagger/config.rb +78 -0
  21. data/lib/apipie/generator/swagger/context.rb +12 -1
  22. data/lib/apipie/generator/swagger/method_description/api_decorator.rb +20 -0
  23. data/lib/apipie/generator/swagger/method_description/api_schema_service.rb +86 -0
  24. data/lib/apipie/generator/swagger/method_description/decorator.rb +22 -0
  25. data/lib/apipie/generator/swagger/method_description/parameters_service.rb +139 -0
  26. data/lib/apipie/generator/swagger/method_description/response_schema_service.rb +46 -0
  27. data/lib/apipie/generator/swagger/method_description/response_service.rb +58 -0
  28. data/lib/apipie/generator/swagger/method_description.rb +2 -0
  29. data/lib/apipie/generator/swagger/operation_id.rb +2 -2
  30. data/lib/apipie/generator/swagger/param_description/builder.rb +4 -4
  31. data/lib/apipie/generator/swagger/param_description/composite.rb +9 -1
  32. data/lib/apipie/generator/swagger/param_description/in.rb +1 -1
  33. data/lib/apipie/generator/swagger/param_description/path_params_composite.rb +61 -0
  34. data/lib/apipie/generator/swagger/param_description/referenced_composite.rb +36 -0
  35. data/lib/apipie/generator/swagger/param_description/type.rb +9 -2
  36. data/lib/apipie/generator/swagger/path_decorator.rb +36 -0
  37. data/lib/apipie/generator/swagger/referenced_definitions.rb +17 -0
  38. data/lib/apipie/generator/swagger/resource_description_collection.rb +30 -0
  39. data/lib/apipie/generator/swagger/resource_description_composite.rb +56 -0
  40. data/lib/apipie/generator/swagger/schema.rb +63 -0
  41. data/lib/apipie/generator/swagger/type_extractor.rb +0 -19
  42. data/lib/apipie/generator/swagger/warning.rb +3 -6
  43. data/lib/apipie/generator/swagger/warning_writer.rb +7 -1
  44. data/lib/apipie/helpers.rb +3 -3
  45. data/lib/apipie/method_description.rb +5 -3
  46. data/lib/apipie/param_description.rb +4 -2
  47. data/lib/apipie/resource_description.rb +11 -8
  48. data/lib/apipie/response_description.rb +1 -1
  49. data/lib/apipie/response_description_adapter.rb +3 -3
  50. data/lib/apipie/routing.rb +1 -1
  51. data/lib/apipie/rspec/response_validation_helper.rb +1 -1
  52. data/lib/apipie/swagger_generator.rb +27 -551
  53. data/lib/apipie/validator.rb +9 -5
  54. data/lib/apipie/version.rb +1 -1
  55. data/lib/apipie-rails.rb +17 -0
  56. data/lib/tasks/apipie.rake +25 -20
  57. data/spec/controllers/api/v2/nested/resources_controller_spec.rb +2 -2
  58. data/spec/controllers/pets_controller_spec.rb +10 -16
  59. data/spec/controllers/users_controller_spec.rb +2 -2
  60. data/spec/dummy/app/controllers/pets_controller.rb +4 -4
  61. data/spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb +2 -2
  62. data/spec/dummy/app/controllers/twitter_example_controller.rb +2 -2
  63. data/spec/dummy/app/controllers/users_controller.rb +5 -5
  64. data/spec/dummy/config.ru +1 -1
  65. data/spec/lib/apipie/apipies_controller_spec.rb +4 -0
  66. data/spec/lib/apipie/application_spec.rb +25 -15
  67. data/spec/lib/apipie/configuration_spec.rb +15 -0
  68. data/spec/lib/apipie/generator/swagger/config_spec.rb +19 -0
  69. data/spec/lib/apipie/generator/swagger/context_spec.rb +23 -2
  70. data/spec/lib/apipie/generator/swagger/method_description/api_schema_service_spec.rb +106 -0
  71. data/spec/lib/apipie/generator/swagger/method_description/response_schema_service_spec.rb +105 -0
  72. data/spec/lib/apipie/generator/swagger/param_description/builder_spec.rb +1 -1
  73. data/spec/lib/apipie/generator/swagger/param_description/composite_spec.rb +2 -2
  74. data/spec/lib/apipie/generator/swagger/param_description/type_spec.rb +7 -7
  75. data/spec/lib/apipie/generator/swagger/path_decorator_spec.rb +57 -0
  76. data/spec/lib/apipie/generator/swagger/referenced_definitions_spec.rb +35 -0
  77. data/spec/lib/apipie/generator/swagger/resource_description_composite_spec.rb +37 -0
  78. data/spec/lib/apipie/generator/swagger/resource_descriptions_collection_spec.rb +57 -0
  79. data/spec/lib/apipie/generator/swagger/schema_spec.rb +89 -0
  80. data/spec/lib/apipie/generator/swagger/type_extractor_spec.rb +0 -43
  81. data/spec/lib/apipie/generator/swagger/warning_spec.rb +1 -1
  82. data/spec/lib/apipie/generator/swagger/warning_writer_spec.rb +19 -7
  83. data/spec/lib/apipie/method_description_spec.rb +101 -66
  84. data/spec/lib/apipie/no_documented_method_spec.rb +17 -0
  85. data/spec/lib/apipie/param_description_spec.rb +209 -49
  86. data/spec/lib/apipie/param_group_spec.rb +1 -0
  87. data/spec/lib/apipie/resource_description_spec.rb +71 -28
  88. data/spec/lib/apipie/response_does_not_match_swagger_schema_spec.rb +35 -0
  89. data/spec/lib/apipie/swagger_generator_spec.rb +94 -0
  90. data/spec/lib/apipie/validator_spec.rb +47 -11
  91. data/spec/lib/rake_spec.rb +1 -1
  92. data/spec/lib/swagger/rake_swagger_spec.rb +6 -6
  93. data/spec/lib/swagger/swagger_dsl_spec.rb +17 -11
  94. data/spec/lib/validators/array_validator_spec.rb +1 -1
  95. data/spec/spec_helper.rb +2 -2
  96. metadata +31 -3
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ describe Apipie::ResponseDoesNotMatchSwaggerSchema do
4
+ let(:error) do
5
+ described_class.new(
6
+ controller_name,
7
+ method_name,
8
+ response_code,
9
+ error_messages,
10
+ schema,
11
+ returned_object
12
+ )
13
+ end
14
+
15
+ let(:controller_name) { 'UserController' }
16
+ let(:method_name) { 'index' }
17
+ let(:response_code) { 200 }
18
+ let(:error_messages) { [] }
19
+ let(:schema) { {} }
20
+ let(:returned_object) { {} }
21
+
22
+ describe '#to_s' do
23
+ subject { error.to_s }
24
+
25
+ let(:error_message) do
26
+ <<~HEREDOC.chomp
27
+ Response does not match swagger schema (#{controller_name}##{method_name} #{response_code}): #{error_messages}
28
+ Schema: #{JSON(schema)}
29
+ Returned object: #{returned_object}
30
+ HEREDOC
31
+ end
32
+
33
+ it { is_expected.to eq(error_message) }
34
+ end
35
+ end
@@ -0,0 +1,94 @@
1
+ require 'spec_helper'
2
+ require 'dummy/app/controllers/pets_using_self_describing_classes_controller'
3
+
4
+ describe Apipie::SwaggerGenerator do
5
+ describe '.json_schema_for_method_response' do
6
+ subject { json_schema_for_method_response }
7
+
8
+ let(:response_description_dsl) do
9
+ proc do
10
+ property :a_number, Integer
11
+ property :an_optional_number, Integer, required: false
12
+ end
13
+ end
14
+
15
+ let(:response_description_options) do
16
+ [{}, PetsController, response_description_dsl, nil]
17
+ end
18
+
19
+ let(:dsl_data) do
20
+ ActionController::Base
21
+ .send(:_apipie_dsl_data_init)
22
+ .merge(
23
+ {
24
+ returns: [[200, response_description_options]],
25
+ api_args: [
26
+ ['get', '/path', 'Some api description', { deprecated: true }]
27
+ ]
28
+ }
29
+ )
30
+ end
31
+
32
+ let(:method_description) do
33
+ Apipie::MethodDescription.new(
34
+ :show,
35
+ Apipie::ResourceDescription.new(UsersController, 'users'),
36
+ dsl_data
37
+ )
38
+ end
39
+
40
+ let(:json_schema_for_method_response) do
41
+ described_class.json_schema_for_method_response(
42
+ method_description,
43
+ return_code,
44
+ false
45
+ )
46
+ end
47
+
48
+ context 'when there is no return code for responses' do
49
+ let(:return_code) { 3000 }
50
+
51
+ it { is_expected.to be_nil }
52
+ end
53
+
54
+ context 'when return code exists' do
55
+ let(:return_code) { 200 }
56
+
57
+ describe 'properties' do
58
+ subject(:properties) { json_schema_for_method_response[:properties] }
59
+
60
+ it 'returns correct properties' do
61
+ expect(properties).to eq(
62
+ {
63
+ a_number: {
64
+ type: 'number'
65
+ },
66
+ an_optional_number: {
67
+ type: 'number'
68
+ }
69
+ }
70
+ )
71
+ end
72
+ end
73
+ end
74
+ end
75
+
76
+ describe '.json_schema_for_self_describing_class' do
77
+ subject(:schema) do
78
+ described_class.json_schema_for_self_describing_class(
79
+ self_describing_class,
80
+ allow_null
81
+ )
82
+ end
83
+
84
+ let(:self_describing_class) { PetWithMeasurements }
85
+ let(:allow_null) { false }
86
+
87
+ before { Apipie.configuration.generator.swagger.responses_use_refs = false }
88
+
89
+ it 'returns the self describing class schema' do
90
+ expect(schema.keys).to include(:type, :properties, :required)
91
+ expect(schema[:properties].keys).to include(:pet_name, :animal_type, :pet_measurements)
92
+ end
93
+ end
94
+ end
@@ -51,19 +51,55 @@ describe Apipie::Validator do
51
51
  end
52
52
 
53
53
  describe 'BooleanValidator' do
54
- it "should validate by object class" do
55
- validator = Apipie::Validator::BooleanValidator.new(params_desc)
56
- expect(validator.validate("1")).to be_truthy
57
- expect(validator.validate(1)).to be_truthy
58
- expect(validator.validate(true)).to be_truthy
59
- expect(validator.validate(0)).to be_truthy
60
- expect(validator.validate(false)).to be_truthy
61
- expect(validator.validate({ 1 => 1 })).to be_falsey
54
+ let(:validator) do
55
+ Apipie::Validator::BooleanValidator
62
56
  end
63
57
 
64
- it "should have a valid description" do
65
- validator = Apipie::Validator::BooleanValidator.new(params_desc)
66
- expect(validator.description).to eq('Must be one of: <code>true</code>, <code>false</code>, <code>1</code>, <code>0</code>.')
58
+ let(:validator_instance) { validator.new(params_desc) }
59
+
60
+ describe '.build' do
61
+ subject { validator.build(params_desc, argument, nil, nil) }
62
+
63
+ context 'when argument is [true, false]' do
64
+ let(:argument) { [true, false] }
65
+
66
+ it { is_expected.to be_an_instance_of(Apipie::Validator::BooleanValidator) }
67
+ end
68
+
69
+ context 'when argument is :bool' do
70
+ let(:argument) { :bool }
71
+
72
+ it { is_expected.to be_an_instance_of(Apipie::Validator::BooleanValidator) }
73
+ end
74
+
75
+ context 'when argument :boolean' do
76
+ let(:argument) { :boolean }
77
+
78
+ it { is_expected.to be_an_instance_of(Apipie::Validator::BooleanValidator) }
79
+ end
80
+
81
+ context 'when argument :booooooooolean' do
82
+ let(:argument) { :booooooooolean }
83
+
84
+ it { is_expected.to be_nil }
85
+ end
86
+ end
87
+
88
+ describe '#validate' do
89
+ it "should validate by object class" do
90
+ expect(validator_instance.validate("1")).to be_truthy
91
+ expect(validator_instance.validate(1)).to be_truthy
92
+ expect(validator_instance.validate(true)).to be_truthy
93
+ expect(validator_instance.validate(0)).to be_truthy
94
+ expect(validator_instance.validate(false)).to be_truthy
95
+ expect(validator_instance.validate({ 1 => 1 })).to be_falsey
96
+ end
97
+ end
98
+
99
+ describe '#description' do
100
+ subject { validator_instance.description }
101
+
102
+ it { is_expected.to eq('Must be one of: <code>true</code>, <code>false</code>, <code>1</code>, <code>0</code>.') }
67
103
  end
68
104
  end
69
105
 
@@ -18,7 +18,7 @@ describe 'rake tasks' do
18
18
  end
19
19
 
20
20
  let(:doc_output) do
21
- File.join(::Rails.root, doc_path, 'apidoc')
21
+ File.join(Rails.root, doc_path, 'apidoc')
22
22
  end
23
23
 
24
24
  after do
@@ -12,7 +12,7 @@ describe 'rake tasks' do
12
12
 
13
13
  before do
14
14
  Apipie.configuration.doc_path = doc_path
15
- Apipie.configuration.swagger_suppress_warnings = true
15
+ Apipie.configuration.generator.swagger.suppress_warnings = true
16
16
  allow(Apipie).to receive(:reload_documentation)
17
17
  subject.invoke(*task_args)
18
18
  end
@@ -37,11 +37,11 @@ describe 'rake tasks' do
37
37
  end
38
38
 
39
39
  let(:doc_output) do
40
- File.join(::Rails.root, doc_path, 'apidoc')
40
+ File.join(Rails.root, doc_path, 'apidoc')
41
41
  end
42
42
 
43
43
  let(:ref_output) do
44
- File.join(::Rails.root, doc_path, 'apidoc_ref')
44
+ File.join(Rails.root, doc_path, 'apidoc_ref')
45
45
  end
46
46
 
47
47
 
@@ -102,7 +102,7 @@ describe 'rake tasks' do
102
102
 
103
103
  expect_param_def("get", "/users/by_department", "department", "in", "query")
104
104
  expect_param_def("get", "/users/by_department", "department", "enum",
105
- ["finance", "operations", "sales", "marketing", "HR"])
105
+ %w[finance operations sales marketing HR])
106
106
 
107
107
  expect_tags_def("get", "/twitter_example/{id}/followers", %w[twitter_example following index search])
108
108
  end
@@ -128,11 +128,11 @@ describe 'rake tasks' do
128
128
  expect_param_def("put", "/users/{id}", "oauth", "in", "formData")
129
129
  expect_param_def("get", "/users/by_department", "department", "in", "query")
130
130
  expect_param_def("get", "/users/by_department", "department", "enum",
131
- ["finance", "operations", "sales", "marketing", "HR"])
131
+ %w[finance operations sales marketing HR])
132
132
 
133
133
  expect_param_def("get", "/users/in_departments", "departments", "in", "query")
134
134
  expect_array_param_def("get", "/users/in_departments", "departments",
135
- ["finance", "operations", "sales", "marketing", "HR"])
135
+ %w[finance operations sales marketing HR])
136
136
 
137
137
  expect_tags_def("get", "/twitter_example/{id}/followers", %w[twitter_example following index search])
138
138
 
@@ -6,7 +6,7 @@ describe "Swagger Responses" do
6
6
  let(:desc) { Apipie.get_resource_description(controller_class, Apipie.configuration.default_version) }
7
7
 
8
8
  let(:swagger) {
9
- Apipie.configuration.swagger_suppress_warnings = true
9
+ Apipie.configuration.generator.swagger.suppress_warnings = true
10
10
  Apipie.to_swagger_json(Apipie.configuration.default_version, controller_class.to_s.underscore.sub("_controller", ""))
11
11
  }
12
12
 
@@ -24,17 +24,17 @@ describe "Swagger Responses" do
24
24
  schema
25
25
  end
26
26
 
27
- def swagger_response_for(path, code=200, method='get')
27
+ def swagger_response_for(path, code = 200, method = 'get')
28
28
  response = swagger[:paths][path][method][:responses][code]
29
29
  response[:schema] = resolve_refs(response[:schema])
30
30
  response
31
31
  end
32
32
 
33
- def swagger_params_for(path, method='get')
33
+ def swagger_params_for(path, method = 'get')
34
34
  swagger[:paths][path][method][:parameters]
35
35
  end
36
36
 
37
- def swagger_param_by_name(param_name, path, method='get')
37
+ def swagger_param_by_name(param_name, path, method = 'get')
38
38
  params = swagger_params_for(path, method)
39
39
  matching = params.select{|p| p[:name] == param_name }
40
40
  raise "multiple params named [#{param_name}] in swagger definition for [#{method} #{path}]" if matching.length > 1
@@ -72,7 +72,7 @@ describe "Swagger Responses" do
72
72
  deep_match?(actual, expected)
73
73
  end
74
74
 
75
- def deep_match?(actual, expected, breadcrumb=[])
75
+ def deep_match?(actual, expected, breadcrumb = [])
76
76
  pending_params = actual.params_ordered.dup
77
77
  expected.each do |expected_param|
78
78
  expected_param_name = expected_param.is_a?(Hash) ? expected_param.keys.first : expected_param
@@ -141,7 +141,7 @@ describe "Swagger Responses" do
141
141
 
142
142
  a_schema = resolve_refs(schema[:items])
143
143
  expect(a_schema).to have_field(:pet_name, 'string', {:description => 'Name of pet', :required => false})
144
- expect(a_schema).to have_field(:animal_type, 'string', {:description => 'Type of pet', :enum => ['dog','cat','iguana','kangaroo']})
144
+ expect(a_schema).to have_field(:animal_type, 'string', {:description => 'Type of pet', :enum => %w[dog cat iguana kangaroo]})
145
145
  end
146
146
 
147
147
 
@@ -210,7 +210,7 @@ describe "Swagger Responses" do
210
210
 
211
211
  schema = response[:schema]
212
212
  expect(schema).to have_field(:pet_name, 'string', {:description => 'Name of pet', :required => false})
213
- expect(schema).to have_field(:animal_type, 'string', {:description => 'Type of pet', :enum => ['dog','cat','iguana','kangaroo']})
213
+ expect(schema).to have_field(:animal_type, 'string', {:description => 'Type of pet', :enum => %w[dog cat iguana kangaroo]})
214
214
  end
215
215
 
216
216
  it 'should have the 404 response description overridden' do
@@ -247,7 +247,7 @@ describe "Swagger Responses" do
247
247
 
248
248
  schema = response[:schema]
249
249
  expect(schema).to have_field(:pet_name, 'string', {:description => 'Name of pet', :required => false})
250
- expect(schema).to have_field(:animal_type, 'string', {:description => 'Type of pet', :enum => ['dog','cat','iguana','kangaroo']})
250
+ expect(schema).to have_field(:animal_type, 'string', {:description => 'Type of pet', :enum => %w[dog cat iguana kangaroo]})
251
251
  end
252
252
  end
253
253
 
@@ -282,7 +282,7 @@ describe "Swagger Responses" do
282
282
  schema = response[:schema]
283
283
  expect(schema).to have_field(:pet_id, 'number', {:description => 'id of pet'})
284
284
  expect(schema).to have_field(:pet_name, 'string', {:description => 'Name of pet', :required => false})
285
- expect(schema).to have_field(:animal_type, 'string', {:description => 'Type of pet', :enum => ['dog','cat','iguana','kangaroo']})
285
+ expect(schema).to have_field(:animal_type, 'string', {:description => 'Type of pet', :enum => %w[dog cat iguana kangaroo]})
286
286
  expect(schema).not_to have_field(:partial_match_allowed, 'boolean', {:required => false})
287
287
  end
288
288
 
@@ -338,6 +338,7 @@ describe "Swagger Responses" do
338
338
 
339
339
  expect(returns_obj).to match_field_structure([:pet_name, :animal_type])
340
340
  end
341
+
341
342
  it 'should have the 201 response described in the swagger' do
342
343
  response = swagger_response_for('/pets/{id}/extra_info', 201)
343
344
  expect(response[:description]).to eq("Found a pet")
@@ -359,6 +360,7 @@ describe "Swagger Responses" do
359
360
  {:pet_measurements => [:weight, :height, :num_legs]}
360
361
  ])
361
362
  end
363
+
362
364
  it 'should have the 202 response described in the swagger' do
363
365
  response = swagger_response_for('/pets/{id}/extra_info', 202)
364
366
  expect(response[:description]).to eq('Accepted')
@@ -388,6 +390,7 @@ describe "Swagger Responses" do
388
390
  {:additional_histories => [:did_visit_vet, :avg_meals_per_day]}
389
391
  ])
390
392
  end
393
+
391
394
  it 'should have the 203 response described in the swagger' do
392
395
  response = swagger_response_for('/pets/{id}/extra_info', 203)
393
396
  expect(response[:description]).to eq('Non-Authoritative Information')
@@ -424,12 +427,13 @@ describe "Swagger Responses" do
424
427
 
425
428
  expect(returns_obj).to match_field_structure([:int_array, :enum_array])
426
429
  end
430
+
427
431
  it 'should have the 204 response described in the swagger' do
428
432
  response = swagger_response_for('/pets/{id}/extra_info', 204)
429
433
 
430
434
  schema = response[:schema]
431
435
  expect(schema).to have_field(:int_array, 'array', {items: {type: 'number'}})
432
- expect(schema).to have_field(:enum_array, 'array', {items: {type: 'string', enum: ['v1','v2','v3']}})
436
+ expect(schema).to have_field(:enum_array, 'array', {items: {type: 'string', enum: %w[v1 v2 v3]}})
433
437
  end
434
438
 
435
439
 
@@ -444,6 +448,7 @@ describe "Swagger Responses" do
444
448
  :num_fleas
445
449
  ])
446
450
  end
451
+
447
452
  it 'should have the 422 response described in the swagger' do
448
453
  response = swagger_response_for('/pets/{id}/extra_info', 422)
449
454
  expect(response[:description]).to eq('Fleas were discovered on the pet')
@@ -546,7 +551,7 @@ describe "Swagger Responses" do
546
551
 
547
552
  a_schema = schema[:items]
548
553
  expect(a_schema).to have_field(:pet_name, 'string', {:description => 'Name of pet', :required => false})
549
- expect(a_schema).to have_field(:animal_type, 'string', {:description => 'Type of pet', :enum => ['dog','cat','iguana','kangaroo']})
554
+ expect(a_schema).to have_field(:animal_type, 'string', {:description => 'Type of pet', :enum => %w[dog cat iguana kangaroo]})
550
555
  end
551
556
  end
552
557
 
@@ -568,6 +573,7 @@ describe "Swagger Responses" do
568
573
  {:pet_measurements => [:weight, :height, :num_legs]}
569
574
  ])
570
575
  end
576
+
571
577
  it 'should have the 200 response described in the swagger' do
572
578
  response = swagger_response_for('/pets_with_measurements_described_as_class/{id}', 200)
573
579
  expect(response[:description]).to eq('measurements of the pet')
@@ -30,7 +30,7 @@ module Apipie::Validator
30
30
  let(:type) { String }
31
31
 
32
32
  it "accepts array of specified type" do
33
- expect(validator.validate(['string1', 'string2'])).to eq(true)
33
+ expect(validator.validate(%w[string1 string2])).to eq(true)
34
34
  end
35
35
 
36
36
  it "accepts empty array" do
data/spec/spec_helper.rb CHANGED
@@ -24,7 +24,7 @@ require 'test_engine'
24
24
  #
25
25
  # will verify that the selected response schema includes a required string field called 'pet_name'
26
26
  #
27
- RSpec::Matchers.define :have_field do |name, type, opts={}|
27
+ RSpec::Matchers.define :have_field do |name, type, opts = {}|
28
28
  def fail(msg)
29
29
  @fail_message = msg
30
30
  false
@@ -62,7 +62,7 @@ RSpec.configure do |config|
62
62
  config.mock_with :rspec
63
63
 
64
64
  # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
65
- config.fixture_path = "#{::Rails.root}/spec/fixtures"
65
+ config.fixture_path = "#{Rails.root}/spec/fixtures"
66
66
 
67
67
  # If you're not using ActiveRecord, or you'd prefer not to run each of your
68
68
  # examples within a transaction, remove the following line or assign false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apipie-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Pokorny
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-03-08 00:00:00.000000000 Z
12
+ date: 2023-04-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -278,8 +278,18 @@ files:
278
278
  - lib/apipie/extractor/collector.rb
279
279
  - lib/apipie/extractor/recorder.rb
280
280
  - lib/apipie/extractor/writer.rb
281
+ - lib/apipie/generator/config.rb
281
282
  - lib/apipie/generator/generator.rb
283
+ - lib/apipie/generator/swagger/computed_interface_id.rb
284
+ - lib/apipie/generator/swagger/config.rb
282
285
  - lib/apipie/generator/swagger/context.rb
286
+ - lib/apipie/generator/swagger/method_description.rb
287
+ - lib/apipie/generator/swagger/method_description/api_decorator.rb
288
+ - lib/apipie/generator/swagger/method_description/api_schema_service.rb
289
+ - lib/apipie/generator/swagger/method_description/decorator.rb
290
+ - lib/apipie/generator/swagger/method_description/parameters_service.rb
291
+ - lib/apipie/generator/swagger/method_description/response_schema_service.rb
292
+ - lib/apipie/generator/swagger/method_description/response_service.rb
283
293
  - lib/apipie/generator/swagger/operation_id.rb
284
294
  - lib/apipie/generator/swagger/param_description.rb
285
295
  - lib/apipie/generator/swagger/param_description/builder.rb
@@ -287,7 +297,14 @@ files:
287
297
  - lib/apipie/generator/swagger/param_description/description.rb
288
298
  - lib/apipie/generator/swagger/param_description/in.rb
289
299
  - lib/apipie/generator/swagger/param_description/name.rb
300
+ - lib/apipie/generator/swagger/param_description/path_params_composite.rb
301
+ - lib/apipie/generator/swagger/param_description/referenced_composite.rb
290
302
  - lib/apipie/generator/swagger/param_description/type.rb
303
+ - lib/apipie/generator/swagger/path_decorator.rb
304
+ - lib/apipie/generator/swagger/referenced_definitions.rb
305
+ - lib/apipie/generator/swagger/resource_description_collection.rb
306
+ - lib/apipie/generator/swagger/resource_description_composite.rb
307
+ - lib/apipie/generator/swagger/schema.rb
291
308
  - lib/apipie/generator/swagger/swagger.rb
292
309
  - lib/apipie/generator/swagger/type.rb
293
310
  - lib/apipie/generator/swagger/type_extractor.rb
@@ -396,7 +413,10 @@ files:
396
413
  - spec/lib/apipie/extractor/writer_spec.rb
397
414
  - spec/lib/apipie/extractor_spec.rb
398
415
  - spec/lib/apipie/file_handler_spec.rb
416
+ - spec/lib/apipie/generator/swagger/config_spec.rb
399
417
  - spec/lib/apipie/generator/swagger/context_spec.rb
418
+ - spec/lib/apipie/generator/swagger/method_description/api_schema_service_spec.rb
419
+ - spec/lib/apipie/generator/swagger/method_description/response_schema_service_spec.rb
400
420
  - spec/lib/apipie/generator/swagger/operation_id_spec.rb
401
421
  - spec/lib/apipie/generator/swagger/param_description/builder_spec.rb
402
422
  - spec/lib/apipie/generator/swagger/param_description/composite_spec.rb
@@ -405,15 +425,23 @@ files:
405
425
  - spec/lib/apipie/generator/swagger/param_description/name_spec.rb
406
426
  - spec/lib/apipie/generator/swagger/param_description/type_spec.rb
407
427
  - spec/lib/apipie/generator/swagger/param_description_spec.rb
428
+ - spec/lib/apipie/generator/swagger/path_decorator_spec.rb
429
+ - spec/lib/apipie/generator/swagger/referenced_definitions_spec.rb
430
+ - spec/lib/apipie/generator/swagger/resource_description_composite_spec.rb
431
+ - spec/lib/apipie/generator/swagger/resource_descriptions_collection_spec.rb
432
+ - spec/lib/apipie/generator/swagger/schema_spec.rb
408
433
  - spec/lib/apipie/generator/swagger/type_extractor_spec.rb
409
434
  - spec/lib/apipie/generator/swagger/warning_spec.rb
410
435
  - spec/lib/apipie/generator/swagger/warning_writer_spec.rb
411
436
  - spec/lib/apipie/method_description/apis_service_spec.rb
412
437
  - spec/lib/apipie/method_description_spec.rb
438
+ - spec/lib/apipie/no_documented_method_spec.rb
413
439
  - spec/lib/apipie/param_description/deprecation_spec.rb
414
440
  - spec/lib/apipie/param_description_spec.rb
415
441
  - spec/lib/apipie/param_group_spec.rb
416
442
  - spec/lib/apipie/resource_description_spec.rb
443
+ - spec/lib/apipie/response_does_not_match_swagger_schema_spec.rb
444
+ - spec/lib/apipie/swagger_generator_spec.rb
417
445
  - spec/lib/apipie/validator_spec.rb
418
446
  - spec/lib/rake_spec.rb
419
447
  - spec/lib/swagger/openapi_2_0_schema.json
@@ -442,7 +470,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
442
470
  - !ruby/object:Gem::Version
443
471
  version: '0'
444
472
  requirements: []
445
- rubygems_version: 3.3.26
473
+ rubygems_version: 3.1.6
446
474
  signing_key:
447
475
  specification_version: 4
448
476
  summary: Rails REST API documentation tool