slack_valid_block_kit 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 +7 -0
- data/.gitignore +8 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +171 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/slack_valid_block_kit/builder/compositions.rb +59 -0
- data/lib/slack_valid_block_kit/builder/elements.rb +202 -0
- data/lib/slack_valid_block_kit/builder/layouts.rb +69 -0
- data/lib/slack_valid_block_kit/builder/method_generator.rb +86 -0
- data/lib/slack_valid_block_kit/builder/surfaces.rb +35 -0
- data/lib/slack_valid_block_kit/builder.rb +15 -0
- data/lib/slack_valid_block_kit/config.rb +13 -0
- data/lib/slack_valid_block_kit/validator/base.rb +164 -0
- data/lib/slack_valid_block_kit/validator/composition.rb +82 -0
- data/lib/slack_valid_block_kit/validator/element.rb +128 -0
- data/lib/slack_valid_block_kit/validator/error.rb +15 -0
- data/lib/slack_valid_block_kit/validator/layout.rb +92 -0
- data/lib/slack_valid_block_kit/validator/multi_select_menu.rb +104 -0
- data/lib/slack_valid_block_kit/validator/select_menu.rb +100 -0
- data/lib/slack_valid_block_kit/validator/surface.rb +52 -0
- data/lib/slack_valid_block_kit/validator/uniq.rb +23 -0
- data/lib/slack_valid_block_kit/validator.rb +32 -0
- data/lib/slack_valid_block_kit/version.rb +3 -0
- data/lib/slack_valid_block_kit.rb +73 -0
- data/slack_valid_block_kit.gemspec +29 -0
- metadata +114 -0
@@ -0,0 +1,104 @@
|
|
1
|
+
module SlackValidBlockKit::Validator
|
2
|
+
module MultiSelectMenu
|
3
|
+
MULTI_STATIC_SELECT_PROPERTIES = %i(type placeholder action_id options option_groups initial_options confirm max_selected_items focus_on_load)
|
4
|
+
MULTI_EXTERNAL_SELECT_PROPERTIES = %i(type placeholder action_id min_query_length initial_options confirm max_selected_items focus_on_load)
|
5
|
+
MULTI_USERS_SELECT_PROPERTIES = %i(type placeholder action_id initial_users confirm max_selected_items focus_on_load)
|
6
|
+
MULTI_CONVERSATIONS_SELECT_PROPERTIES = %i(type placeholder action_id initial_conversations default_to_current_conversation confirm max_selected_items filter focus_on_load)
|
7
|
+
MULTI_CHANNELS_SELECT_PROPERTIES = %i(type placeholder action_id initial_channels confirm max_selected_items focus_on_load)
|
8
|
+
|
9
|
+
def validate_multi_static_select(hash, path, options = nil)
|
10
|
+
validate_for_properties(hash, path, MULTI_STATIC_SELECT_PROPERTIES)
|
11
|
+
validate_for(hash[:type], "#{path}.type", String, true, only: ["multi_static_select"])
|
12
|
+
|
13
|
+
validate_for(hash[:options], "#{path}.options", Array, false, max: 100)
|
14
|
+
options = Array(hash[:options])
|
15
|
+
options.each_with_index do |e, i|
|
16
|
+
validate_option(e, "#{path}.options[#{i}]", { text_type: :text_objects })
|
17
|
+
end
|
18
|
+
|
19
|
+
validate_for(hash[:option_groups], "#{path}.option_groups", Array, false, max: 100)
|
20
|
+
option_groups = Array(hash[:option_groups])
|
21
|
+
option_groups.each_with_index do |e, i|
|
22
|
+
validate_option_group(e, "#{path}.option_groups[#{i}]")
|
23
|
+
end
|
24
|
+
|
25
|
+
if hash[:options].nil? && hash[:option_groups].nil?
|
26
|
+
add_error(path, :require_options_or_option_groups)
|
27
|
+
end
|
28
|
+
|
29
|
+
validate_for_initial_option_of_multi_static_select(hash[:initial_options], "#{path}.initial_options", options: options, option_groups: option_groups)
|
30
|
+
|
31
|
+
validate_common_for_multi_select(hash, path, options)
|
32
|
+
end
|
33
|
+
|
34
|
+
def validate_multi_external_select(hash, path, options = nil)
|
35
|
+
validate_for_properties(hash, path, MULTI_EXTERNAL_SELECT_PROPERTIES)
|
36
|
+
validate_for(hash[:type], "#{path}.type", String, true, only: ["multi_external_select"])
|
37
|
+
|
38
|
+
validate_for(hash[:min_query_length], "#{path}.min_query_length", Integer, false)
|
39
|
+
validate_for(hash[:initial_options], "#{path}.initial_options", Array, false)
|
40
|
+
|
41
|
+
validate_common_for_multi_select(hash, path, options)
|
42
|
+
end
|
43
|
+
|
44
|
+
def validate_multi_users_select(hash, path, options = nil)
|
45
|
+
validate_for_properties(hash, path, MULTI_USERS_SELECT_PROPERTIES)
|
46
|
+
validate_for(hash[:type], "#{path}.type", String, true, only: ["multi_users_select"])
|
47
|
+
|
48
|
+
validate_for(hash[:initial_users], "#{path}.initial_users", :array_of_string, false)
|
49
|
+
|
50
|
+
validate_common_for_multi_select(hash, path, options)
|
51
|
+
end
|
52
|
+
|
53
|
+
def validate_multi_conversations_select(hash, path, options = nil)
|
54
|
+
validate_for_properties(hash, path, MULTI_CONVERSATIONS_SELECT_PROPERTIES)
|
55
|
+
validate_for(hash[:type], "#{path}.type", String, true, only: ["multi_conversations_select"])
|
56
|
+
|
57
|
+
validate_for(hash[:initial_conversations], "#{path}.initial_conversations", :array_of_string, false)
|
58
|
+
validate_for(hash[:default_to_current_conversation], "#{path}.default_to_current_conversation", :bool, false)
|
59
|
+
validate_filter(hash["filter"], "#{path}.filter") unless hash["filter"].nil?
|
60
|
+
|
61
|
+
validate_common_for_multi_select(hash, path, options)
|
62
|
+
end
|
63
|
+
|
64
|
+
def validate_multi_channels_select(hash, path, options = nil)
|
65
|
+
validate_for_properties(hash, path, MULTI_CHANNELS_SELECT_PROPERTIES)
|
66
|
+
validate_for(hash[:type], "#{path}.type", String, true, only: ["multi_channels_select"])
|
67
|
+
|
68
|
+
validate_for(hash[:initial_channels], "#{path}.initial_channels", :array_of_string, false)
|
69
|
+
|
70
|
+
validate_common_for_multi_select(hash, path, options)
|
71
|
+
end
|
72
|
+
|
73
|
+
private def validate_common_for_multi_select(hash, path, options = nil)
|
74
|
+
validate_for_plain_text(hash[:placeholder], "#{path}.placeholder", true, 150)
|
75
|
+
|
76
|
+
validate_for_action_id(hash[:action_id], "#{path}.action_id")
|
77
|
+
|
78
|
+
validate_for(hash[:confirm], "#{path}.confirm", Hash, false)
|
79
|
+
validate_confirmation(hash[:confirm], "#{path}.confirm") unless hash[:confirm].nil?
|
80
|
+
validate_for(hash[:max_selected_items], "#{path}.max_selected_items", Integer, false, min: 1)
|
81
|
+
validate_focus_on_load(hash[:focus_on_load], "#{path}.focus_on_load")
|
82
|
+
end
|
83
|
+
|
84
|
+
private def validate_for_initial_option_of_multi_static_select(obj, path, options:, option_groups:)
|
85
|
+
return if obj.nil?
|
86
|
+
|
87
|
+
if !obj.is_a?(Array)
|
88
|
+
add_error(path, :clazz_type, Array)
|
89
|
+
return
|
90
|
+
end
|
91
|
+
|
92
|
+
if obj.respond_to?(:size) && obj.size == 0
|
93
|
+
add_error(path, :no_item)
|
94
|
+
return
|
95
|
+
end
|
96
|
+
|
97
|
+
candidate_groups = option_groups.map { |v| v[:options] } + [options]
|
98
|
+
used_groups = candidate_groups.select { |g| (obj - g).size == 0 }
|
99
|
+
if used_groups.size == 0
|
100
|
+
add_error(path, :must_be_one_of_the_provided_options)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
module SlackValidBlockKit::Validator
|
2
|
+
module SelectMenu
|
3
|
+
STATIC_SELECT_PROPERTIES = %i(type placeholder action_id options option_groups initial_options confirm focus_on_load)
|
4
|
+
EXTERNAL_SELECT_PROPERTIES = %i(type placeholder action_id min_query_length initial_options confirm focus_on_load)
|
5
|
+
USERS_SELECT_PROPERTIES = %i(type placeholder action_id initial_user confirm focus_on_load)
|
6
|
+
CONVERSATIONS_SELECT_PROPERTIES = %i(type placeholder action_id initial_conversation default_to_current_conversation confirm response_url_enabled filter focus_on_load)
|
7
|
+
CHANNELS_SELECT_PROPERTIES = %i(type placeholder action_id initial_channel confirm response_url_enabled focus_on_load)
|
8
|
+
|
9
|
+
def validate_static_select(hash, path, options = nil)
|
10
|
+
validate_for_properties(hash, path, STATIC_SELECT_PROPERTIES)
|
11
|
+
validate_for(hash[:type], "#{path}.type", String, true, only: ["static_select"])
|
12
|
+
|
13
|
+
validate_for(hash[:options], "#{path}.options", Array, false, max: 100)
|
14
|
+
options = Array(hash[:options])
|
15
|
+
options.each_with_index do |e, i|
|
16
|
+
validate_option(e, "#{path}.options[#{i}]", { text_type: :text_objects })
|
17
|
+
end
|
18
|
+
|
19
|
+
validate_for(hash[:option_groups], "#{path}.option_groups", Array, false, max: 100)
|
20
|
+
option_groups = Array(hash[:option_groups])
|
21
|
+
option_groups.each_with_index do |e, i|
|
22
|
+
validate_option_group(e, "#{path}.option_groups[#{i}]")
|
23
|
+
end
|
24
|
+
|
25
|
+
if hash[:options].nil? && hash[:option_groups].nil?
|
26
|
+
add_error(path, :require_options_or_option_groups)
|
27
|
+
end
|
28
|
+
|
29
|
+
validate_for_initial_option_of_multi_static_select(hash[:initial_option], "#{path}.initial_option", options: options, option_groups: option_groups)
|
30
|
+
|
31
|
+
validate_common_for_select(hash, path, options)
|
32
|
+
end
|
33
|
+
|
34
|
+
def validate_external_select(hash, path, options = nil)
|
35
|
+
validate_for_properties(hash, path, EXTERNAL_SELECT_PROPERTIES)
|
36
|
+
validate_for(hash[:type], "#{path}.type", String, true, only: ["external_select"])
|
37
|
+
|
38
|
+
validate_for(hash[:min_query_length], "#{path}.min_query_length", Integer, false)
|
39
|
+
validate_for(hash[:initial_options], "#{path}.initial_options", Array, false)
|
40
|
+
|
41
|
+
validate_common_for_select(hash, path, options)
|
42
|
+
end
|
43
|
+
|
44
|
+
def validate_users_select(hash, path, options = nil)
|
45
|
+
validate_for_properties(hash, path, USERS_SELECT_PROPERTIES)
|
46
|
+
validate_for(hash[:type], "#{path}.type", String, true, only: ["users_select"])
|
47
|
+
|
48
|
+
validate_for(hash[:initial_user], "#{path}.initial_user", String, false)
|
49
|
+
|
50
|
+
validate_common_for_select(hash, path, options)
|
51
|
+
end
|
52
|
+
|
53
|
+
def validate_conversations_select(hash, path, options = nil)
|
54
|
+
validate_for_properties(hash, path, CONVERSATIONS_SELECT_PROPERTIES)
|
55
|
+
validate_for(hash[:type], "#{path}.type", String, true, only: ["conversations_select"])
|
56
|
+
|
57
|
+
validate_for(hash[:initial_conversation], "#{path}.initial_conversation", String, false)
|
58
|
+
validate_for(hash[:default_to_current_conversation], "#{path}.default_to_current_conversation", :bool, false)
|
59
|
+
validate_filter(hash["filter"], "#{path}.filter")
|
60
|
+
validate_for(hash[:response_url_enabled], "#{path}.response_url_enabled", :bool, false)
|
61
|
+
|
62
|
+
validate_common_for_select(hash, path, options)
|
63
|
+
end
|
64
|
+
|
65
|
+
def validate_channels_select(hash, path, options = nil)
|
66
|
+
validate_for_properties(hash, path, CHANNELS_SELECT_PROPERTIES)
|
67
|
+
validate_for(hash[:type], "#{path}.type", String, true, only: ["channels_select"])
|
68
|
+
|
69
|
+
validate_for(hash[:initial_channel], "#{path}.initial_channel", String, false)
|
70
|
+
validate_for(hash[:response_url_enabled], "#{path}.response_url_enabled", :bool, false)
|
71
|
+
|
72
|
+
validate_common_for_select(hash, path, options)
|
73
|
+
end
|
74
|
+
|
75
|
+
private def validate_common_for_select(hash, path, options = nil)
|
76
|
+
validate_for_plain_text(hash[:placeholder], "#{path}.placeholder", true, 150)
|
77
|
+
|
78
|
+
validate_for_action_id(hash[:action_id], "#{path}.action_id")
|
79
|
+
|
80
|
+
validate_for(hash[:confirm], "#{path}.confirm", Hash, false) unless hash[:confirm].nil?
|
81
|
+
validate_confirmation(hash[:confirm], "#{path}.confirm")
|
82
|
+
validate_focus_on_load(hash[:focus_on_load], "#{path}.focus_on_load")
|
83
|
+
end
|
84
|
+
|
85
|
+
private def validate_for_initial_option_of_multi_static_select(obj, path, options:, option_groups:)
|
86
|
+
return if obj.nil?
|
87
|
+
|
88
|
+
if !obj.is_a?(Hash)
|
89
|
+
add_error(path, :clazz_type, Hash)
|
90
|
+
return
|
91
|
+
end
|
92
|
+
|
93
|
+
candidate_groups = option_groups.map { |v| v[:options] } + [options]
|
94
|
+
used_groups = candidate_groups.select { |g| ([obj] - g).size == 0 }
|
95
|
+
if used_groups.size == 0
|
96
|
+
add_error(path, :must_be_one_of_the_provided_options)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module SlackValidBlockKit::Validator
|
2
|
+
module Surface
|
3
|
+
MODAL_PROPERTIES = %i(type title blocks close submit private_metadata callback_id clear_on_close notify_on_close external_id)
|
4
|
+
HOME_PROPERTIES = %i(type blocks private_metadata callback_id external_id)
|
5
|
+
|
6
|
+
def validate_modal(hash, path, options = nil)
|
7
|
+
validate_for_properties(hash, path, MODAL_PROPERTIES)
|
8
|
+
validate_for(hash[:type], "#{path}.type", String, true, only: ["modal"])
|
9
|
+
validate_for_plain_text(hash[:title], "#{path}.title", true, 24)
|
10
|
+
|
11
|
+
validate_for(hash[:blocks], "#{path}.blocks", Array, true, max: 100)
|
12
|
+
Array(hash[:blocks]).each_with_index do |e, i|
|
13
|
+
validate(e, "#{path}.blocks[#{i}]", :layout_blocks_for_modal)
|
14
|
+
end
|
15
|
+
|
16
|
+
validate_for_plain_text(hash[:close], "#{path}.close", false, 24)
|
17
|
+
validate_for_plain_text(hash[:submit], "#{path}.submit", false, 24)
|
18
|
+
|
19
|
+
if hash[:submit].nil? && Array(hash[:blocks]).select { |b| b[:type] == "input" }.size > 0
|
20
|
+
add_error(path, :require_submit_with_input)
|
21
|
+
end
|
22
|
+
|
23
|
+
validate_for(hash[:private_metadata], "#{path}.private_metadata", String, false, max: 3000)
|
24
|
+
validate_for(hash[:callback_id], "#{path}.callback_id", String, false, max: 255)
|
25
|
+
validate_for(hash[:clear_on_close], "#{path}.clear_on_close", :bool, false)
|
26
|
+
validate_for(hash[:notify_on_close], "#{path}.notify_on_close", :bool, false)
|
27
|
+
validate_for(hash[:external_id], "#{path}.external_id", String, false)
|
28
|
+
end
|
29
|
+
|
30
|
+
def validate_home(hash, path, options = nil)
|
31
|
+
validate_for_properties(hash, path, HOME_PROPERTIES)
|
32
|
+
validate_for(hash[:type], "#{path}.type", String, true, only: ["home"])
|
33
|
+
validate_for_plain_text(hash[:title], "#{path}.title", true, 24)
|
34
|
+
|
35
|
+
validate_for(hash[:blocks], "#{path}.blocks", Array, true, max: 100)
|
36
|
+
Array(hash[:blocks]).each_with_index do |e, i|
|
37
|
+
validate(e, "#{path}.blocks[#{i}]", :layout_blocks_for_home)
|
38
|
+
end
|
39
|
+
|
40
|
+
validate_for(hash[:private_metadata], "#{path}.private_metadata", String, false, max: 3000)
|
41
|
+
validate_for(hash[:callback_id], "#{path}.callback_id", String, false, max: 255)
|
42
|
+
validate_for(hash[:external_id], "#{path}.external_id", String, false)
|
43
|
+
end
|
44
|
+
|
45
|
+
def validate_blocks(hash, path, options = nil)
|
46
|
+
validate_for(hash[:blocks], "#{path}.blocks", Array, true)
|
47
|
+
Array(hash[:blocks]).each_with_index do |e, i|
|
48
|
+
validate(e, "#{path}.blocks[#{i}]", :layout_blocks_for_message)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module SlackValidBlockKit::Validator
|
2
|
+
module Uniq
|
3
|
+
def validate_block_id
|
4
|
+
path_by_block_id.each do |block_id, paths|
|
5
|
+
next if paths.size <= 1
|
6
|
+
add_error("block_id", :not_uniq, paths)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def validate_action_id
|
11
|
+
path_by_action_id.each do |action_id, paths|
|
12
|
+
next if paths.size <= 1
|
13
|
+
add_error("action_id", :not_uniq, paths)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def validate_focus_on_load
|
18
|
+
if focus_on_load_by_path.keys.size > 1
|
19
|
+
add_error("focus_on_load", :not_uniq, focus_on_load_by_path.keys)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require "slack_valid_block_kit/validator/base"
|
2
|
+
require "slack_valid_block_kit/validator/composition"
|
3
|
+
require "slack_valid_block_kit/validator/element"
|
4
|
+
require "slack_valid_block_kit/validator/error"
|
5
|
+
require "slack_valid_block_kit/validator/layout"
|
6
|
+
require "slack_valid_block_kit/validator/multi_select_menu"
|
7
|
+
require "slack_valid_block_kit/validator/select_menu"
|
8
|
+
require "slack_valid_block_kit/validator/surface"
|
9
|
+
require "slack_valid_block_kit/validator/uniq"
|
10
|
+
|
11
|
+
module SlackValidBlockKit
|
12
|
+
module Validator
|
13
|
+
class Runner
|
14
|
+
include ::SlackValidBlockKit::Validator::Base
|
15
|
+
include ::SlackValidBlockKit::Validator::Layout
|
16
|
+
include ::SlackValidBlockKit::Validator::Element
|
17
|
+
include ::SlackValidBlockKit::Validator::MultiSelectMenu
|
18
|
+
include ::SlackValidBlockKit::Validator::SelectMenu
|
19
|
+
include ::SlackValidBlockKit::Validator::Composition
|
20
|
+
include ::SlackValidBlockKit::Validator::Surface
|
21
|
+
include ::SlackValidBlockKit::Validator::Uniq
|
22
|
+
|
23
|
+
attr_accessor :errors_by_path, :path_by_block_id, :path_by_action_id, :focus_on_load_by_path
|
24
|
+
def initialize
|
25
|
+
self.errors_by_path = {}
|
26
|
+
self.path_by_block_id = {}
|
27
|
+
self.path_by_action_id = {}
|
28
|
+
self.focus_on_load_by_path = {}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require "slack_valid_block_kit/version"
|
2
|
+
|
3
|
+
require "slack_valid_block_kit/config"
|
4
|
+
|
5
|
+
require "slack_valid_block_kit/validator"
|
6
|
+
require "slack_valid_block_kit/builder"
|
7
|
+
|
8
|
+
module SlackValidBlockKit
|
9
|
+
def self.build(validate: nil)
|
10
|
+
hash = yield(::SlackValidBlockKit::Builder::Runner.new)
|
11
|
+
raise "SlackValidBlockKit.build must return a Hash object." unless hash.is_a?(Hash)
|
12
|
+
|
13
|
+
if validate.nil?
|
14
|
+
if SlackValidBlockKit::Config.skip_validation.nil? || !SlackValidBlockKit::Config.skip_validation
|
15
|
+
validate!(hash)
|
16
|
+
end
|
17
|
+
elsif validate
|
18
|
+
validate!(hash)
|
19
|
+
end
|
20
|
+
hash
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.blocks(validate: nil)
|
24
|
+
blocks = yield(::SlackValidBlockKit::Builder::Runner.new)
|
25
|
+
raise "SlackValidBlockKit.blocks must return an Array object." unless blocks.is_a?(Array)
|
26
|
+
|
27
|
+
if validate.nil?
|
28
|
+
if SlackValidBlockKit::Config.skip_validation.nil? || !SlackValidBlockKit::Config.skip_validation
|
29
|
+
validate_blocks!(blocks)
|
30
|
+
end
|
31
|
+
elsif validate
|
32
|
+
validate_blocks!(blocks)
|
33
|
+
end
|
34
|
+
blocks
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.validate(obj)
|
38
|
+
this = ::SlackValidBlockKit::Validator::Runner.new
|
39
|
+
this.validate(obj, "root", :top)
|
40
|
+
this.validate_block_id
|
41
|
+
this.validate_action_id
|
42
|
+
this.validate_focus_on_load
|
43
|
+
this.errors_by_path
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.validate!(obj)
|
47
|
+
errors_by_path = validate(obj)
|
48
|
+
if errors_by_path.size > 0
|
49
|
+
raise "invalid json.\n#{::SlackValidBlockKit::Validator::Error.messages(errors_by_path).join("\n")}"
|
50
|
+
end
|
51
|
+
true
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.validate_blocks(obj)
|
55
|
+
if obj.is_a?(Array)
|
56
|
+
obj = { blocks: obj }
|
57
|
+
end
|
58
|
+
this = ::SlackValidBlockKit::Validator::Runner.new
|
59
|
+
this.validate_blocks(obj, "root", :top)
|
60
|
+
this.validate_block_id
|
61
|
+
this.validate_action_id
|
62
|
+
this.validate_focus_on_load
|
63
|
+
this.errors_by_path
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.validate_blocks!(blocks)
|
67
|
+
errors_by_path = validate_blocks(blocks)
|
68
|
+
if errors_by_path.size > 0
|
69
|
+
raise "invalid json.\n#{::SlackValidBlockKit::Validator::Error.messages(errors_by_path).join("\n")}"
|
70
|
+
end
|
71
|
+
true
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "slack_valid_block_kit/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "slack_valid_block_kit"
|
8
|
+
spec.version = SlackValidBlockKit::VERSION
|
9
|
+
spec.authors = ["masayuki-ioki"]
|
10
|
+
spec.email = ["kikainekox@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{A tool for building slack block kit with validation.}
|
13
|
+
spec.description = %q{A tool for building slack block kit with validation.}
|
14
|
+
spec.homepage = "https://github.com/kikaineko/slack_valid_block_kit"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
end
|
22
|
+
spec.bindir = "exe"
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: slack_valid_block_kit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- masayuki-ioki
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-05-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.17'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.17'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
55
|
+
description: A tool for building slack block kit with validation.
|
56
|
+
email:
|
57
|
+
- kikainekox@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".travis.yml"
|
64
|
+
- CODE_OF_CONDUCT.md
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- bin/console
|
70
|
+
- bin/setup
|
71
|
+
- lib/slack_valid_block_kit.rb
|
72
|
+
- lib/slack_valid_block_kit/builder.rb
|
73
|
+
- lib/slack_valid_block_kit/builder/compositions.rb
|
74
|
+
- lib/slack_valid_block_kit/builder/elements.rb
|
75
|
+
- lib/slack_valid_block_kit/builder/layouts.rb
|
76
|
+
- lib/slack_valid_block_kit/builder/method_generator.rb
|
77
|
+
- lib/slack_valid_block_kit/builder/surfaces.rb
|
78
|
+
- lib/slack_valid_block_kit/config.rb
|
79
|
+
- lib/slack_valid_block_kit/validator.rb
|
80
|
+
- lib/slack_valid_block_kit/validator/base.rb
|
81
|
+
- lib/slack_valid_block_kit/validator/composition.rb
|
82
|
+
- lib/slack_valid_block_kit/validator/element.rb
|
83
|
+
- lib/slack_valid_block_kit/validator/error.rb
|
84
|
+
- lib/slack_valid_block_kit/validator/layout.rb
|
85
|
+
- lib/slack_valid_block_kit/validator/multi_select_menu.rb
|
86
|
+
- lib/slack_valid_block_kit/validator/select_menu.rb
|
87
|
+
- lib/slack_valid_block_kit/validator/surface.rb
|
88
|
+
- lib/slack_valid_block_kit/validator/uniq.rb
|
89
|
+
- lib/slack_valid_block_kit/version.rb
|
90
|
+
- slack_valid_block_kit.gemspec
|
91
|
+
homepage: https://github.com/kikaineko/slack_valid_block_kit
|
92
|
+
licenses:
|
93
|
+
- MIT
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubygems_version: 3.0.3.1
|
111
|
+
signing_key:
|
112
|
+
specification_version: 4
|
113
|
+
summary: A tool for building slack block kit with validation.
|
114
|
+
test_files: []
|