apipie-dsl 2.2.10 → 2.3.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
- data/lib/apipie_dsl/application.rb +1 -1
- data/lib/apipie_dsl/dsl.rb +0 -2
- data/lib/apipie_dsl/parameter_description.rb +26 -28
- data/lib/apipie_dsl/routing.rb +2 -0
- data/lib/apipie_dsl/tasks/apipie_dsl/cache.rake +23 -12
- data/lib/apipie_dsl/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8be129129902b76525b6f6f49af8ceb5966f658cb12734725a15d7a85e44612
|
4
|
+
data.tar.gz: 538ddde32dfe9058739a350a0f641ed64fbc40d8ae529a0ce48e08ce8aa6bbb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c645ba1b449e181d24b1e4710a493056f0332b6408ee6adf51fb2e496d42c37dee53895f03f89425e2a9d10dd5151a163e9c5d1e04a1b8adea6d75dd17860ef
|
7
|
+
data.tar.gz: 3b1ae75bc8dc25968e5fc0524a66339212598abe751b9254b21715ab705b42dd9e9b29c6e06c54accb2ec1901a149eb58d1dff60bb8b0b507ba4ae7bad14eb2b
|
@@ -6,7 +6,7 @@ module ApipieDSL
|
|
6
6
|
require 'apipie_dsl/static_dispatcher'
|
7
7
|
|
8
8
|
class Engine < Rails::Engine
|
9
|
-
initializer 'static assets', :
|
9
|
+
initializer 'static assets', before: :build_middleware_stack do |app|
|
10
10
|
app.middleware.use ::ApipieDSL::StaticDispatcher, "#{root}/app/public"
|
11
11
|
end
|
12
12
|
end
|
data/lib/apipie_dsl/dsl.rb
CHANGED
@@ -388,7 +388,6 @@ module ApipieDSL
|
|
388
388
|
@extension_data ||= { methods: [] }
|
389
389
|
end
|
390
390
|
|
391
|
-
# rubocop:disable Metrics/AbcSize
|
392
391
|
def self.define_validators(class_scope, method_desc)
|
393
392
|
return if method_desc.nil? || ![true, :implicitly, :explicitly].include?(ApipieDSL.configuration.validate)
|
394
393
|
return unless [true, :implicitly].include?(ApipieDSL.configuration.validate)
|
@@ -430,7 +429,6 @@ module ApipieDSL
|
|
430
429
|
end
|
431
430
|
ParameterDescription.merge(method_desc.plain_params, params)
|
432
431
|
end
|
433
|
-
# rubocop:enable Metrics/AbcSize
|
434
432
|
end
|
435
433
|
end
|
436
434
|
|
@@ -33,43 +33,41 @@ module ApipieDSL
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
# rubocop:disable Metrics/ParameterLists
|
37
36
|
def initialize(method_description, name, validator, desc_or_options = nil, options = {}, &block)
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
37
|
+
if desc_or_options.is_a?(Hash)
|
38
|
+
options = options.merge(desc_or_options)
|
39
|
+
elsif desc_or_options.is_a?(String)
|
40
|
+
options[:desc] = desc_or_options
|
41
|
+
elsif !desc_or_options.nil?
|
42
|
+
raise ArgumentError, 'Parameter description: expected description or options as 3rd parameter'
|
43
|
+
end
|
45
44
|
|
46
|
-
|
45
|
+
@options = options.transform_keys(&:to_sym)
|
47
46
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
47
|
+
@method_description = method_description
|
48
|
+
@name = name
|
49
|
+
@desc = @options[:desc]
|
50
|
+
@type = @options[:type] || :required
|
51
|
+
@schema = @options[:schema]
|
52
|
+
@default_value = @options[:default]
|
53
|
+
@parent = @options[:parent]
|
54
|
+
@metadata = @options[:meta]
|
55
|
+
@show = @options.key?(:show) ? @options[:show] : true
|
57
56
|
|
58
|
-
|
57
|
+
return unless validator
|
59
58
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
59
|
+
@validator = if validator.is_a?(String)
|
60
|
+
ApipieDSL::Validator::Lazy.new(self, validator, @options, block)
|
61
|
+
else
|
62
|
+
ApipieDSL::Validator::BaseValidator.find(self, validator, @options, block)
|
63
|
+
end
|
64
|
+
raise StandardError, "Validator for #{validator} not found." unless @validator
|
66
65
|
end
|
67
|
-
# rubocop:enable Metrics/ParameterLists
|
68
66
|
|
69
67
|
def validator
|
70
|
-
|
68
|
+
return @validator unless @validator.is_a?(ApipieDSL::Validator::Lazy)
|
71
69
|
|
72
|
-
|
70
|
+
@validator = @validator.build
|
73
71
|
end
|
74
72
|
|
75
73
|
def validate(value)
|
data/lib/apipie_dsl/routing.rb
CHANGED
@@ -8,6 +8,9 @@ namespace :apipie_dsl do
|
|
8
8
|
task :cache, [:include_json] => :environment do |_task, args|
|
9
9
|
args.with_defaults(include_json: false)
|
10
10
|
include_json = %w[1 true].include?(args[:include_json])
|
11
|
+
cache_part = ENV['cache_part']
|
12
|
+
generate_index = (cache_part == 'classes' ? false : true)
|
13
|
+
generate_classes = (cache_part == 'index' ? false : true)
|
11
14
|
time_start = Time.now
|
12
15
|
puts "#{time_start} | Started"
|
13
16
|
ApipieDSL::TasksUtils.with_loaded_documentation do
|
@@ -24,12 +27,16 @@ namespace :apipie_dsl do
|
|
24
27
|
ApipieDSL.url_prefix = "../../#{subdir}"
|
25
28
|
doc = ApipieDSL.docs(version, nil, nil, lang, section)
|
26
29
|
doc[:docs][:link_extension] = "#{ApipieDSL::TasksUtils.lang_ext(lang)}.html"
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
if generate_index
|
31
|
+
ApipieDSL::TasksUtils.generate_index_page(file_base_version, doc, include_json, true, lang, section)
|
32
|
+
end
|
33
|
+
if generate_classes
|
34
|
+
ApipieDSL.url_prefix = "../../../#{subdir}"
|
35
|
+
section_out = "#{file_base_version}/#{section}"
|
36
|
+
ApipieDSL::TasksUtils.generate_class_pages(version, section_out, doc, include_json, lang, section)
|
37
|
+
ApipieDSL.url_prefix = "../../../../#{subdir}"
|
38
|
+
ApipieDSL::TasksUtils.generate_method_pages(version, section_out, doc, include_json, lang, section)
|
39
|
+
end
|
33
40
|
end
|
34
41
|
ApipieDSL.url_prefix = "../../#{subdir}"
|
35
42
|
doc = ApipieDSL.docs(version, nil, nil, lang)
|
@@ -61,12 +68,16 @@ namespace :apipie_dsl do
|
|
61
68
|
ApipieDSL.url_prefix = "../../#{subdir}"
|
62
69
|
doc = ApipieDSL.docs(version, nil, nil, lang, section)
|
63
70
|
doc[:docs][:link_extension] = "#{ApipieDSL::TasksUtils.lang_ext(lang)}.html"
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
71
|
+
if generate_index
|
72
|
+
ApipieDSL::TasksUtils.generate_index_page(file_base_version, doc, include_json, true, lang, section)
|
73
|
+
end
|
74
|
+
if generate_classes
|
75
|
+
ApipieDSL.url_prefix = "../../../#{subdir}"
|
76
|
+
section_out = "#{file_base_version}/#{section}"
|
77
|
+
ApipieDSL::TasksUtils.generate_class_pages(version, section_out, doc, include_json, lang, section)
|
78
|
+
ApipieDSL.url_prefix = "../../../../#{subdir}"
|
79
|
+
ApipieDSL::TasksUtils.generate_method_pages(version, section_out, doc, include_json, lang, section)
|
80
|
+
end
|
70
81
|
end
|
71
82
|
ApipieDSL.url_prefix = "../../#{subdir}"
|
72
83
|
doc = ApipieDSL.docs(version, nil, nil, lang)
|
data/lib/apipie_dsl/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apipie-dsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleh Fedorenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|