apipie-rails 1.3.0 → 1.4.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/.github/workflows/build.yml +4 -3
- data/.github/workflows/rubocop-challenger.yml +1 -3
- data/.github/workflows/rubocop.yml +1 -1
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +22 -99
- data/CHANGELOG.md +24 -0
- data/Gemfile +2 -3
- data/README.md +2088 -0
- data/apipie-rails.gemspec +8 -1
- data/app/views/apipie/apipies/_method_detail.erb +2 -0
- data/app/views/apipie/apipies/_params.html.erb +1 -0
- data/app/views/apipie/apipies/_params_plain.html.erb +1 -0
- data/config/locales/en.yml +1 -0
- data/config/locales/ko.yml +1 -0
- data/lib/apipie/application.rb +1 -1
- data/lib/apipie/dsl_definition.rb +3 -3
- data/lib/apipie/error_description.rb +7 -5
- data/lib/apipie/extractor/recorder.rb +3 -3
- data/lib/apipie/extractor/writer.rb +7 -7
- data/lib/apipie/generator/swagger/method_description/response_service.rb +14 -1
- data/lib/apipie/generator/swagger/param_description/in.rb +1 -1
- data/lib/apipie/generator/swagger/type_extractor.rb +1 -1
- data/lib/apipie/generator/swagger/warning.rb +2 -2
- data/lib/apipie/helpers.rb +1 -1
- data/lib/apipie/param_description.rb +1 -1
- data/lib/apipie/response_description.rb +44 -14
- data/lib/apipie/response_description_adapter.rb +1 -1
- data/lib/apipie/routes_formatter.rb +2 -2
- data/lib/apipie/version.rb +1 -1
- data/lib/tasks/apipie.rake +4 -4
- data/rel-eng/gem_release.ipynb +5 -5
- data/spec/controllers/api/v1/architectures_controller_spec.rb +3 -3
- data/spec/controllers/api/v2/nested/resources_controller_spec.rb +1 -1
- data/spec/controllers/concerns_controller_spec.rb +2 -2
- data/spec/controllers/extended_controller_spec.rb +2 -2
- data/spec/controllers/included_param_group_controller_spec.rb +1 -1
- data/spec/controllers/users_controller_spec.rb +65 -64
- data/spec/dummy/app/controllers/api/v2/empty_middle_controller.rb +1 -1
- data/spec/dummy/app/controllers/extending_concern.rb +7 -7
- data/spec/dummy/app/controllers/pets_controller.rb +5 -5
- data/spec/dummy/app/controllers/pets_using_auto_views_controller.rb +2 -2
- data/spec/dummy/app/controllers/pets_using_self_describing_classes_controller.rb +16 -16
- data/spec/dummy/app/controllers/sample_controller.rb +31 -31
- data/spec/dummy/app/controllers/twitter_example_controller.rb +3 -3
- data/spec/lib/apipie/apipies_controller_spec.rb +1 -1
- data/spec/lib/apipie/application_spec.rb +2 -2
- data/spec/lib/apipie/extractor/writer_spec.rb +8 -8
- data/spec/lib/apipie/file_handler_spec.rb +1 -1
- data/spec/lib/apipie/generator/swagger/method_description/response_service_spec.rb +62 -0
- data/spec/lib/apipie/generator/swagger/param_description/builder_spec.rb +2 -2
- data/spec/lib/apipie/method_description_spec.rb +2 -2
- data/spec/lib/apipie/param_description_spec.rb +48 -48
- data/spec/lib/apipie/param_group_spec.rb +4 -4
- data/spec/lib/apipie/resource_description_spec.rb +2 -2
- data/spec/lib/apipie/response_description/response_object_spec.rb +22 -0
- data/spec/lib/apipie/response_description_spec.rb +56 -0
- data/spec/lib/apipie/validator_spec.rb +12 -12
- data/spec/lib/swagger/swagger_dsl_spec.rb +39 -39
- data/spec/test_engine/memes_controller_spec.rb +1 -1
- metadata +147 -7
- data/README.rst +0 -1968
data/apipie-rails.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.version = Apipie::VERSION
|
9
9
|
s.authors = ["Pavel Pokorny","Ivan Necas"]
|
10
10
|
s.email = ["pajkycz@gmail.com", "inecas@redhat.com"]
|
11
|
-
s.homepage = "
|
11
|
+
s.homepage = "https://github.com/Apipie/apipie-rails"
|
12
12
|
s.summary = %q{Rails REST API documentation tool}
|
13
13
|
s.description = %q{Rails REST API documentation tool}
|
14
14
|
s.required_ruby_version = '>= 2.6.0'
|
@@ -17,6 +17,12 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
18
|
s.require_paths = ["lib"]
|
19
19
|
|
20
|
+
s.metadata = {
|
21
|
+
"bug_tracker_uri" => "https://github.com/Apipie/apipie-rails/issues",
|
22
|
+
"changelog_uri" => "https://github.com/Apipie/apipie-rails/blob/master/CHANGELOG.md",
|
23
|
+
"source_code_uri" => "https://github.com/Apipie/apipie-rails"
|
24
|
+
}
|
25
|
+
|
20
26
|
s.add_dependency "actionpack", ">= 5.0"
|
21
27
|
s.add_dependency "activesupport", ">= 5.0"
|
22
28
|
|
@@ -32,6 +38,7 @@ Gem::Specification.new do |s|
|
|
32
38
|
s.add_development_dependency 'rubocop-rails'
|
33
39
|
s.add_development_dependency 'rubocop-rspec'
|
34
40
|
s.add_development_dependency 'rubocop-performance'
|
41
|
+
s.add_development_dependency 'rubocop-rspec_rails' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7")
|
35
42
|
s.add_development_dependency "simplecov"
|
36
43
|
s.add_development_dependency "sqlite3"
|
37
44
|
end
|
@@ -9,6 +9,7 @@
|
|
9
9
|
<small>
|
10
10
|
<%= param[:required] ? t('apipie.required') : t('apipie.optional') %>
|
11
11
|
<%= param[:allow_nil] ? ', '+t('apipie.nil_allowed') : '' %>
|
12
|
+
<%= param[:allow_blank] ? ', '+t('apipie.blank_allowed') : '' %>
|
12
13
|
<% if param[:validator] %>
|
13
14
|
[ <%= Apipie.markup_to_html(param[:validator]).html_safe %> ]
|
14
15
|
<% end %>
|
data/config/locales/en.yml
CHANGED
data/config/locales/ko.yml
CHANGED
data/lib/apipie/application.rb
CHANGED
@@ -89,7 +89,7 @@ module Apipie
|
|
89
89
|
|
90
90
|
# we create separate method description for each version in
|
91
91
|
# case the method belongs to more versions. We return just one
|
92
|
-
#
|
92
|
+
# because the version doesn't matter for the purpose it's used
|
93
93
|
# (to wrap the original version with validators)
|
94
94
|
ret_method_description ||= method_description
|
95
95
|
resource_description.add_method_description(method_description)
|
@@ -178,7 +178,7 @@ module Apipie
|
|
178
178
|
alias full_description desc
|
179
179
|
|
180
180
|
# describe next method with document in given path
|
181
|
-
# in
|
181
|
+
# in convention, these doc located under "#{Rails.root}/doc"
|
182
182
|
# Example:
|
183
183
|
# document "hello_world.md"
|
184
184
|
# def hello_world
|
@@ -452,7 +452,7 @@ module Apipie
|
|
452
452
|
include Apipie::DSL::Action
|
453
453
|
include Apipie::DSL::Param
|
454
454
|
|
455
|
-
# defines the substitutions to be made in the API paths
|
455
|
+
# defines the substitutions to be made in the API paths defined
|
456
456
|
# in concerns included. For example:
|
457
457
|
#
|
458
458
|
# There is this method defined in concern:
|
@@ -472,7 +472,7 @@ module Apipie
|
|
472
472
|
#
|
473
473
|
# It has to be specified before the concern is included.
|
474
474
|
#
|
475
|
-
# If not specified, the default predefined
|
475
|
+
# If not specified, the default predefined substitutions are
|
476
476
|
#
|
477
477
|
# {:conroller_path => controller.controller_path,
|
478
478
|
# :resource_id => `resource_id_from_apipie` }
|
@@ -5,9 +5,7 @@ module Apipie
|
|
5
5
|
|
6
6
|
def self.from_dsl_data(args)
|
7
7
|
code_or_options, desc, options = args
|
8
|
-
Apipie::ErrorDescription.new(code_or_options,
|
9
|
-
desc,
|
10
|
-
options)
|
8
|
+
Apipie::ErrorDescription.new(code_or_options, desc, options)
|
11
9
|
end
|
12
10
|
|
13
11
|
def initialize(code_or_options, desc = nil, options = {})
|
@@ -17,9 +15,13 @@ module Apipie
|
|
17
15
|
@metadata = code_or_options[:meta]
|
18
16
|
@description = code_or_options[:desc] || code_or_options[:description]
|
19
17
|
else
|
20
|
-
@code =
|
18
|
+
@code =
|
21
19
|
if code_or_options.is_a? Symbol
|
22
|
-
|
20
|
+
begin
|
21
|
+
Rack::Utils.status_code(code_or_options)
|
22
|
+
rescue ArgumentError
|
23
|
+
nil
|
24
|
+
end
|
23
25
|
else
|
24
26
|
code_or_options
|
25
27
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Apipie
|
2
2
|
module Extractor
|
3
3
|
class Recorder
|
4
|
-
MULTIPART_BOUNDARY = 'APIPIE_RECORDER_EXAMPLE_BOUNDARY'
|
4
|
+
MULTIPART_BOUNDARY = 'APIPIE_RECORDER_EXAMPLE_BOUNDARY'.freeze
|
5
5
|
|
6
6
|
def initialize
|
7
7
|
@ignored_params = [:controller, :action]
|
@@ -14,12 +14,12 @@ module Apipie
|
|
14
14
|
@params = Rack::Utils.parse_nested_query(@query)
|
15
15
|
@params.merge!(env["action_dispatch.request.request_parameters"] || {})
|
16
16
|
rack_input = env["rack.input"]
|
17
|
-
if data = parse_data(rack_input
|
17
|
+
if data = parse_data(rack_input&.read)
|
18
18
|
@request_data = data
|
19
19
|
elsif form_hash = env["rack.request.form_hash"]
|
20
20
|
@request_data = reformat_multipart_data(form_hash)
|
21
21
|
end
|
22
|
-
rack_input
|
22
|
+
rack_input&.rewind
|
23
23
|
end
|
24
24
|
|
25
25
|
def analyse_controller(controller)
|
@@ -324,7 +324,7 @@ module Apipie
|
|
324
324
|
desc ||= case @action.to_s
|
325
325
|
when "show", "create", "update", "destroy"
|
326
326
|
name = name.singularize
|
327
|
-
"#{@action.capitalize} #{
|
327
|
+
"#{@action.capitalize} #{/^[aeiou]/.match?(name) ? 'an' : 'a'} #{name}"
|
328
328
|
when "index"
|
329
329
|
"List #{name}"
|
330
330
|
end
|
@@ -341,7 +341,7 @@ module Apipie
|
|
341
341
|
params.sort_by {|n,_| n }.each do |(name, desc)|
|
342
342
|
desc[:type] = (desc[:type] && desc[:type].first) || Object
|
343
343
|
code << "#{indent}param"
|
344
|
-
if
|
344
|
+
if /\W/.match?(name)
|
345
345
|
code << " :'#{name}'"
|
346
346
|
else
|
347
347
|
code << " :#{name}"
|
@@ -397,7 +397,7 @@ module Apipie
|
|
397
397
|
lines_to_add = []
|
398
398
|
block_level = 0
|
399
399
|
ensure_line_breaks(controller_content.lines).first(action_line).reverse_each do |line|
|
400
|
-
if
|
400
|
+
if /\s*\bend\b\s*/.match?(line)
|
401
401
|
block_level += 1
|
402
402
|
end
|
403
403
|
if block_level > 0
|
@@ -405,10 +405,10 @@ module Apipie
|
|
405
405
|
else
|
406
406
|
added_lines << line
|
407
407
|
end
|
408
|
-
if
|
408
|
+
if /\s*\b(module|class|def)\b /.match?(line)
|
409
409
|
break
|
410
410
|
end
|
411
|
-
next unless
|
411
|
+
next unless /do\s*(\|.*?\|)?\s*$/.match?(line)
|
412
412
|
block_level -= 1
|
413
413
|
if block_level == 0
|
414
414
|
added_lines.concat(lines_to_add)
|
@@ -419,14 +419,14 @@ module Apipie
|
|
419
419
|
end
|
420
420
|
|
421
421
|
# this method would be totally useless unless some clever guy
|
422
|
-
#
|
422
|
+
# decided that it would be great idea to change a behavior of
|
423
423
|
# "".lines method to not include end of lines.
|
424
424
|
#
|
425
425
|
# For more details:
|
426
426
|
# https://github.com/puppetlabs/puppet/blob/0dc44695/lib/puppet/util/monkey_patches.rb
|
427
427
|
def ensure_line_breaks(lines)
|
428
428
|
if lines.to_a.size > 1 && lines.first !~ /\n\Z/
|
429
|
-
lines.map { |l|
|
429
|
+
lines.map { |l| !/\n\Z/.match?(l) ? (l << "\n") : l }.to_enum
|
430
430
|
else
|
431
431
|
lines
|
432
432
|
end
|
@@ -39,7 +39,8 @@ class Apipie::Generator::Swagger::MethodDescription::ResponseService
|
|
39
39
|
allow_null: false,
|
40
40
|
http_method: @http_method,
|
41
41
|
controller_method: @method_description
|
42
|
-
).to_swagger
|
42
|
+
).to_swagger,
|
43
|
+
headers: response_headers(response.headers)
|
43
44
|
}.compact
|
44
45
|
end
|
45
46
|
end
|
@@ -55,4 +56,16 @@ class Apipie::Generator::Swagger::MethodDescription::ResponseService
|
|
55
56
|
|
56
57
|
{ 200 => { description: 'ok' } }
|
57
58
|
end
|
59
|
+
|
60
|
+
# @param [Array<Hash>] headers
|
61
|
+
#
|
62
|
+
# https://swagger.io/specification/v2/#header-object
|
63
|
+
def response_headers(headers)
|
64
|
+
headers.each_with_object({}) do |header, result|
|
65
|
+
result[header[:name].to_s] = {
|
66
|
+
description: header[:description],
|
67
|
+
type: header[:validator]
|
68
|
+
}
|
69
|
+
end
|
70
|
+
end
|
58
71
|
end
|
@@ -18,7 +18,7 @@ class Apipie::Generator::Swagger::TypeExtractor
|
|
18
18
|
date: Apipie::Generator::Swagger::Type.new('string', 'date'),
|
19
19
|
dateTime: Apipie::Generator::Swagger::Type.new('string', 'date-time'),
|
20
20
|
password: Apipie::Generator::Swagger::Type.new('string', 'password')
|
21
|
-
}
|
21
|
+
}.freeze
|
22
22
|
|
23
23
|
# @param [Apipie::Validator::BaseValidator, ResponseDescriptionAdapter::PropDesc::Validator, nil] validator
|
24
24
|
def initialize(validator)
|
@@ -17,7 +17,7 @@ class Apipie::Generator::Swagger::Warning
|
|
17
17
|
optional_without_default_value: OPTIONAL_WITHOUT_DEFAULT_VALUE_CODE,
|
18
18
|
param_ignored_in_form_data: PARAM_IGNORED_IN_FORM_DATA_CODE,
|
19
19
|
path_param_not_described_code: PATH_PARAM_NOT_DESCRIBED_CODE
|
20
|
-
}
|
20
|
+
}.freeze
|
21
21
|
|
22
22
|
MESSAGES = {
|
23
23
|
MISSING_METHOD_SUMMARY_CODE => "Missing short description for method",
|
@@ -28,7 +28,7 @@ class Apipie::Generator::Swagger::Warning
|
|
28
28
|
OPTIONAL_WITHOUT_DEFAULT_VALUE_CODE => "The parameter :%{parameter} is optional but default value is not specified (use :default_value => ...)",
|
29
29
|
PARAM_IGNORED_IN_FORM_DATA_CODE => "Ignoring param :%{parameter} -- cannot include Hash without fields in a formData specification",
|
30
30
|
PATH_PARAM_NOT_DESCRIBED_CODE => "The parameter :%{name} appears in the path %{path} but is not described"
|
31
|
-
}
|
31
|
+
}.freeze
|
32
32
|
|
33
33
|
attr_reader :code
|
34
34
|
|
data/lib/apipie/helpers.rb
CHANGED
@@ -245,7 +245,7 @@ module Apipie
|
|
245
245
|
|
246
246
|
# makes modification that are based on the action that the param
|
247
247
|
# is defined for. Typical for required and allow_nil variations in
|
248
|
-
#
|
248
|
+
# create/update actions.
|
249
249
|
def action_awareness
|
250
250
|
if action_aware?
|
251
251
|
if !@options.key?(:allow_nil)
|
@@ -6,6 +6,7 @@ module Apipie
|
|
6
6
|
include Apipie::DSL::Param
|
7
7
|
|
8
8
|
attr_accessor :additional_properties, :typename
|
9
|
+
attr_reader :headers
|
9
10
|
|
10
11
|
def initialize(method_description, scope, block, typename)
|
11
12
|
@method_description = method_description
|
@@ -13,6 +14,7 @@ module Apipie
|
|
13
14
|
@param_group = {scope: scope}
|
14
15
|
@additional_properties = false
|
15
16
|
@typename = typename
|
17
|
+
@headers = []
|
16
18
|
|
17
19
|
self.instance_exec(&block) if block
|
18
20
|
|
@@ -43,6 +45,18 @@ module Apipie
|
|
43
45
|
end
|
44
46
|
end
|
45
47
|
|
48
|
+
# @param [String] header_name
|
49
|
+
# @param [String, symbol, Class] validator
|
50
|
+
# @param [String] description
|
51
|
+
# @param [Hash] options
|
52
|
+
def header(header_name, validator, description, options = {})
|
53
|
+
@headers << {
|
54
|
+
name: header_name,
|
55
|
+
validator: validator.to_s.downcase,
|
56
|
+
description: description,
|
57
|
+
options: options
|
58
|
+
}
|
59
|
+
end
|
46
60
|
end
|
47
61
|
end
|
48
62
|
|
@@ -64,15 +78,6 @@ module Apipie
|
|
64
78
|
adapter)
|
65
79
|
end
|
66
80
|
|
67
|
-
def is_array?
|
68
|
-
@is_array_of != false
|
69
|
-
end
|
70
|
-
|
71
|
-
def typename
|
72
|
-
@response_object.typename
|
73
|
-
end
|
74
|
-
|
75
|
-
|
76
81
|
def initialize(method_description, code, options, scope, block, adapter)
|
77
82
|
|
78
83
|
@type_ref = options[:param_group]
|
@@ -83,11 +88,16 @@ module Apipie
|
|
83
88
|
|
84
89
|
@method_description = method_description
|
85
90
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
+
@code =
|
92
|
+
if code.is_a? Symbol
|
93
|
+
begin
|
94
|
+
Rack::Utils.status_code(code)
|
95
|
+
rescue ArgumentError
|
96
|
+
nil
|
97
|
+
end
|
98
|
+
else
|
99
|
+
code
|
100
|
+
end
|
91
101
|
|
92
102
|
@description = options[:desc]
|
93
103
|
if @description.nil?
|
@@ -105,6 +115,14 @@ module Apipie
|
|
105
115
|
@response_object.additional_properties ||= options[:additional_properties]
|
106
116
|
end
|
107
117
|
|
118
|
+
def is_array?
|
119
|
+
@is_array_of != false
|
120
|
+
end
|
121
|
+
|
122
|
+
def typename
|
123
|
+
@response_object.typename
|
124
|
+
end
|
125
|
+
|
108
126
|
def param_description
|
109
127
|
nil
|
110
128
|
end
|
@@ -118,6 +136,17 @@ module Apipie
|
|
118
136
|
end
|
119
137
|
alias allow_additional_properties additional_properties
|
120
138
|
|
139
|
+
# @return [Array<Hash>]
|
140
|
+
def headers
|
141
|
+
# TODO: Support headers for Apipie::ResponseDescriptionAdapter
|
142
|
+
if @response_object.is_a?(Apipie::ResponseDescriptionAdapter)
|
143
|
+
return []
|
144
|
+
end
|
145
|
+
|
146
|
+
@response_object.headers
|
147
|
+
end
|
148
|
+
|
149
|
+
# @return [Hash{Symbol->TrueClass | FalseClass}]
|
121
150
|
def to_json(lang = nil)
|
122
151
|
{
|
123
152
|
:code => code,
|
@@ -125,6 +154,7 @@ module Apipie
|
|
125
154
|
:is_array => is_array?,
|
126
155
|
:returns_object => params_ordered.map{ |param| param.to_json(lang).tap{|h| h.delete(:validations) }}.flatten,
|
127
156
|
:additional_properties => additional_properties,
|
157
|
+
:headers => headers
|
128
158
|
}
|
129
159
|
end
|
130
160
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Apipie
|
2
2
|
class RoutesFormatter
|
3
|
-
API_METHODS = %w{GET POST PUT PATCH OPTIONS DELETE}
|
3
|
+
API_METHODS = %w{GET POST PUT PATCH OPTIONS DELETE}.freeze
|
4
4
|
|
5
5
|
# The entry method called by Apipie to extract the array
|
6
6
|
# representing the api dsl from the routes definition.
|
@@ -24,7 +24,7 @@ module Apipie
|
|
24
24
|
if verb.count != 1
|
25
25
|
verb = API_METHODS.select{|defined_verb| defined_verb == rails_route.constraints[:method]}
|
26
26
|
if verb.blank?
|
27
|
-
raise "
|
27
|
+
raise "Unknown verb #{rails_route.path.spec.to_s}"
|
28
28
|
end
|
29
29
|
end
|
30
30
|
verb.first
|
data/lib/apipie/version.rb
CHANGED
data/lib/tasks/apipie.rake
CHANGED
@@ -70,17 +70,17 @@ namespace :apipie do
|
|
70
70
|
with_loaded_documentation do
|
71
71
|
out = ENV["OUT_REF"] || File.join(Rails.root, Apipie.configuration.doc_path, 'apidoc_ref')
|
72
72
|
paths = generate_swagger_using_args(args, out)
|
73
|
-
paths.each
|
73
|
+
paths.each do |path|
|
74
74
|
existing_files_in_dir = Pathname(out).children(true)
|
75
75
|
|
76
76
|
make_reference = false
|
77
77
|
|
78
78
|
# reference filenames have the format <basename>.<counter>.swagger_ref
|
79
|
-
reference_files = existing_files_in_dir.select
|
79
|
+
reference_files = existing_files_in_dir.select do |f|
|
80
80
|
f.extname == '.swagger_ref' &&
|
81
81
|
f.basename.sub_ext("").extname.delete('.').to_i > 0 &&
|
82
82
|
f.basename.sub_ext("").sub_ext("") == path.basename.sub_ext("")
|
83
|
-
|
83
|
+
end
|
84
84
|
if reference_files.empty?
|
85
85
|
print "Reference file does not exist for [#{path}]\n"
|
86
86
|
counter = 1
|
@@ -111,7 +111,7 @@ namespace :apipie do
|
|
111
111
|
if reference_files.length > num_refs_to_keep
|
112
112
|
(reference_files - reference_files[-num_refs_to_keep..-1]).each(&:delete)
|
113
113
|
end
|
114
|
-
|
114
|
+
end
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
data/rel-eng/gem_release.ipynb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
"- push access to https://github.com/Apipie/apipie-rails\n",
|
11
11
|
"- push access to rubygems.org for apipie-rails\n",
|
12
12
|
"- sudo yum install python-slugify asciidoc\n",
|
13
|
-
"- ensure neither the `git push` or `gem push` don't require
|
13
|
+
"- ensure neither the `git push` or `gem push` don't require interactive auth. If you can't use api key or ssh key to auth skip these steps and run them form the shell manually\n",
|
14
14
|
"- ensure all checks have passed on the branch you're about to release\n",
|
15
15
|
"\n",
|
16
16
|
"### Release process\n",
|
@@ -117,7 +117,7 @@
|
|
117
117
|
"cell_type": "markdown",
|
118
118
|
"metadata": {},
|
119
119
|
"source": [
|
120
|
-
"### Run tests
|
120
|
+
"### Run tests locally if your setup allows, otherwise ensure the HEAD is green"
|
121
121
|
]
|
122
122
|
},
|
123
123
|
{
|
@@ -217,14 +217,14 @@
|
|
217
217
|
"cell_type": "markdown",
|
218
218
|
"metadata": {},
|
219
219
|
"source": [
|
220
|
-
"#### Manual step: Update deps in the gemspec if
|
220
|
+
"#### Manual step: Update deps in the gemspec if necessary"
|
221
221
|
]
|
222
222
|
},
|
223
223
|
{
|
224
224
|
"cell_type": "markdown",
|
225
225
|
"metadata": {},
|
226
226
|
"source": [
|
227
|
-
"### Check what is going to be
|
227
|
+
"### Check what is going to be committed"
|
228
228
|
]
|
229
229
|
},
|
230
230
|
{
|
@@ -347,7 +347,7 @@
|
|
347
347
|
"source": [
|
348
348
|
"### Some manual steps follow to improve the UX\n",
|
349
349
|
"\n",
|
350
|
-
"#### New
|
350
|
+
"#### New release on GitHub\n",
|
351
351
|
"\n",
|
352
352
|
"Copy the following changelog lines to the description in form on link below\n",
|
353
353
|
"The release title is the new version."
|
@@ -4,7 +4,7 @@ describe Api::V1::ArchitecturesController do
|
|
4
4
|
describe "resource description" do
|
5
5
|
subject { Apipie.get_resource_description(Api::V1::ArchitecturesController, "1.0") }
|
6
6
|
|
7
|
-
it "
|
7
|
+
it "is version 1.0" do
|
8
8
|
expect(subject._version).to eq('1.0')
|
9
9
|
|
10
10
|
expect(Apipie.resource_descriptions['1.0'].size).to eq(2)
|
@@ -14,11 +14,11 @@ describe Api::V1::ArchitecturesController do
|
|
14
14
|
context "there is another version" do
|
15
15
|
let(:v2) { archv2 = Apipie.get_resource_description(Api::V2::ArchitecturesController, "2.0") }
|
16
16
|
|
17
|
-
it "
|
17
|
+
it "has unique doc url" do
|
18
18
|
expect(subject.doc_url).not_to eq(v2.doc_url)
|
19
19
|
end
|
20
20
|
|
21
|
-
it "
|
21
|
+
it "has unique methods" do
|
22
22
|
expect(subject._methods.keys).to include(:index)
|
23
23
|
expect(v2._methods.keys).to include(:index)
|
24
24
|
expect(subject._methods[:index]).not_to eq(v2._methods[:index])
|
@@ -20,7 +20,7 @@ describe Api::V2::Nested::ResourcesController do
|
|
20
20
|
describe '.get_resource_id' do
|
21
21
|
subject { Apipie.get_resource_id(Api::V2::Nested::ResourcesController) }
|
22
22
|
|
23
|
-
it "
|
23
|
+
it "has resource_id set" do
|
24
24
|
expect(subject).to eq("resource")
|
25
25
|
end
|
26
26
|
end
|
@@ -7,12 +7,12 @@ describe ConcernsController do
|
|
7
7
|
expect(Apipie["concern_resources#show"]).to be
|
8
8
|
end
|
9
9
|
|
10
|
-
it "
|
10
|
+
it "replies to valid request" do
|
11
11
|
get :show, :params => { :id => '5' }, :session => { :user_id => "secret_hash" }
|
12
12
|
assert_response :success
|
13
13
|
end
|
14
14
|
|
15
|
-
it "
|
15
|
+
it "passes if required parameter is missing" do
|
16
16
|
expect { get :show, :params => { :id => '5' } }.not_to raise_error
|
17
17
|
end
|
18
18
|
|
@@ -2,13 +2,13 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe ExtendedController do
|
4
4
|
|
5
|
-
it '
|
5
|
+
it 'includes params from both original controller and extending concern' do
|
6
6
|
expect(Apipie["extended#create"].params.keys).to eq [:oauth, :user, :admin]
|
7
7
|
user_param = Apipie["extended#create"].params[:user]
|
8
8
|
expect(user_param.validator.params_ordered.map(&:name)).to eq [:name, :password, :from_concern]
|
9
9
|
end
|
10
10
|
|
11
|
-
it '
|
11
|
+
it 'includes updated metadata' do
|
12
12
|
expect(Apipie['extended#create'].metadata).to eq metadata: 'data'
|
13
13
|
end
|
14
14
|
end
|
@@ -5,7 +5,7 @@ describe IncludedParamGroupController do
|
|
5
5
|
|
6
6
|
let(:dsl_data) { ActionController::Base.send(:_apipie_dsl_data_init) }
|
7
7
|
|
8
|
-
it "
|
8
|
+
it "does not error when there is a param_group that is deeply nested in response description" do
|
9
9
|
subject = Apipie.get_resource_description(IncludedParamGroupController, Apipie.configuration.default_version)
|
10
10
|
expect(subject._methods.keys).to include(:show)
|
11
11
|
end
|