servactory 2.12.0.rc1 → 2.12.0.rc3

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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/config/locales/en.yml +18 -12
  3. data/config/locales/ru.yml +18 -12
  4. data/lib/servactory/configuration/option_helpers/option_helpers_collection.rb +5 -1
  5. data/lib/servactory/configuration/setup.rb +9 -3
  6. data/lib/servactory/context/workspace/inputs.rb +0 -35
  7. data/lib/servactory/info/builder.rb +103 -0
  8. data/lib/servactory/info/dsl.rb +8 -51
  9. data/lib/servactory/info/result.rb +4 -4
  10. data/lib/servactory/inputs/dsl.rb +0 -1
  11. data/lib/servactory/inputs/input.rb +8 -9
  12. data/lib/servactory/internals/dsl.rb +0 -1
  13. data/lib/servactory/internals/internal.rb +5 -8
  14. data/lib/servactory/maintenance/attributes/option.rb +7 -13
  15. data/lib/servactory/maintenance/attributes/option_helper.rb +8 -2
  16. data/lib/servactory/maintenance/attributes/options/registrar.rb +2 -57
  17. data/lib/servactory/maintenance/attributes/translator/must.rb +1 -1
  18. data/lib/servactory/maintenance/attributes/translator/type.rb +3 -38
  19. data/lib/servactory/maintenance/attributes/validations/must.rb +8 -6
  20. data/lib/servactory/maintenance/validations/types.rb +3 -26
  21. data/lib/servactory/outputs/dsl.rb +0 -1
  22. data/lib/servactory/outputs/output.rb +5 -8
  23. data/lib/servactory/test_kit/rspec/matchers/have_service_attribute_matchers/consists_of_matcher.rb +8 -13
  24. data/lib/servactory/test_kit/rspec/matchers/have_service_attribute_matchers/inclusion_matcher.rb +7 -4
  25. data/lib/servactory/test_kit/rspec/matchers/have_service_attribute_matchers/message_matcher.rb +91 -0
  26. data/lib/servactory/test_kit/rspec/matchers/have_service_attribute_matchers/must_matcher.rb +6 -0
  27. data/lib/servactory/test_kit/rspec/matchers/have_service_attribute_matchers/schema_matcher.rb +83 -0
  28. data/lib/servactory/test_kit/rspec/matchers/have_service_input_matcher.rb +29 -7
  29. data/lib/servactory/test_kit/rspec/matchers/have_service_input_matchers/valid_with_matcher.rb +12 -5
  30. data/lib/servactory/test_kit/rspec/matchers/have_service_internal_matcher.rb +31 -7
  31. data/lib/servactory/tool_kit/dynamic_options/inclusion.rb +63 -0
  32. data/lib/servactory/tool_kit/dynamic_options/must.rb +34 -6
  33. data/lib/servactory/tool_kit/dynamic_options/schema.rb +193 -0
  34. data/lib/servactory/version.rb +1 -1
  35. metadata +7 -5
  36. data/lib/servactory/maintenance/attributes/translator/inclusion.rb +0 -26
  37. data/lib/servactory/maintenance/attributes/validations/inclusion.rb +0 -63
  38. data/lib/servactory/maintenance/validations/object_schema.rb +0 -116
@@ -84,17 +84,26 @@ module Servactory
84
84
  self
85
85
  end
86
86
 
87
- def consists_of(*types) # rubocop:disable Metrics/MethodLength
88
- message = block_given? ? yield : nil
89
-
87
+ def consists_of(*types)
90
88
  add_submatcher(
91
89
  HaveServiceAttributeMatchers::ConsistsOfMatcher,
92
90
  described_class,
93
91
  :input,
94
92
  input_name,
95
93
  @option_types,
96
- Array(types),
97
- message
94
+ Array(types)
95
+ )
96
+ self
97
+ end
98
+
99
+ def schema(data = {})
100
+ add_submatcher(
101
+ HaveServiceAttributeMatchers::SchemaMatcher,
102
+ described_class,
103
+ :input,
104
+ input_name,
105
+ @option_types,
106
+ data
98
107
  )
99
108
  self
100
109
  end
@@ -132,6 +141,18 @@ module Servactory
132
141
  self
133
142
  end
134
143
 
144
+ def message(message)
145
+ add_submatcher(
146
+ HaveServiceAttributeMatchers::MessageMatcher,
147
+ described_class,
148
+ :input,
149
+ input_name,
150
+ @last_submatcher,
151
+ message
152
+ )
153
+ self
154
+ end
155
+
135
156
  # NOTE: Used for delayed chain implementation
136
157
  # def not_implemented_chain(*description)
137
158
  # Kernel.warn <<-MESSAGE.squish
@@ -162,11 +183,12 @@ module Servactory
162
183
 
163
184
  protected
164
185
 
165
- attr_reader :submatchers, :missing, :subject
186
+ attr_reader :last_submatcher, :submatchers, :missing, :subject
166
187
 
167
188
  def add_submatcher(matcher_class, *args)
168
189
  remove_submatcher(matcher_class)
169
- submatchers << matcher_class.new(*args)
190
+ @last_submatcher = matcher_class.new(*args)
191
+ submatchers << @last_submatcher
170
192
  end
171
193
 
172
194
  def remove_submatcher(matcher_class)
@@ -5,6 +5,7 @@ module Servactory
5
5
  module Rspec
6
6
  module Matchers
7
7
  module HaveServiceInputMatchers
8
+ # DEPRECATED: This chain is planned to be decommissioned.
8
9
  class ValidWithMatcher # rubocop:disable Metrics/ClassLength
9
10
  attr_reader :missing_option
10
11
 
@@ -46,12 +47,13 @@ module Servactory
46
47
  :attribute_data,
47
48
  :i18n_root_key
48
49
 
49
- def submatcher_passes?(_subject) # rubocop:disable Metrics/CyclomaticComplexity
50
+ def submatcher_passes?(_subject) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
50
51
  success_passes? &&
51
52
  failure_type_passes? &&
52
53
  failure_required_passes? &&
53
54
  failure_optional_passes? &&
54
55
  failure_consists_of_passes? &&
56
+ failure_schema_passes? &&
55
57
  failure_format_passes? &&
56
58
  failure_inclusion_passes? &&
57
59
  failure_must_passes?
@@ -116,13 +118,18 @@ module Servactory
116
118
  true
117
119
  end
118
120
 
121
+ def failure_schema_passes?
122
+ # NOTE: Checking for negative cases is not implemented for `schema`
123
+ true
124
+ end
125
+
119
126
  def failure_format_passes?
120
127
  # NOTE: Checking for negative cases is not implemented for `format`
121
128
  true
122
129
  end
123
130
 
124
131
  def failure_inclusion_passes? # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
125
- input_inclusion_in = attribute_data.fetch(:inclusion).fetch(:in)
132
+ input_inclusion_in = attribute_data.fetch(:inclusion, {}).fetch(:in, nil)
126
133
 
127
134
  return true if input_inclusion_in.blank?
128
135
 
@@ -135,11 +142,11 @@ module Servactory
135
142
 
136
143
  if input_required_message.nil?
137
144
  input_required_message = I18n.t(
138
- "#{i18n_root_key}.#{attribute_type_plural}.validations.inclusion.default_error",
145
+ "#{i18n_root_key}.#{attribute_type_plural}.validations.must.dynamic_options.inclusion.default",
139
146
  service_class_name: described_class.name,
140
147
  "#{attribute_type}_name": attribute_name,
141
- "#{attribute_type}_inclusion": input_inclusion_in,
142
- value: wrong_value
148
+ "#{attribute_type}_inclusion": input_inclusion_in.inspect,
149
+ value: wrong_value.inspect
143
150
  )
144
151
  elsif input_required_message.is_a?(Proc)
145
152
  service_class = Struct.new(:class_name, keyword_init: true)
@@ -2,8 +2,10 @@
2
2
 
3
3
  require_relative "have_service_attribute_matchers/types_matcher"
4
4
  require_relative "have_service_attribute_matchers/consists_of_matcher"
5
+ require_relative "have_service_attribute_matchers/schema_matcher"
5
6
  require_relative "have_service_attribute_matchers/inclusion_matcher"
6
7
  require_relative "have_service_attribute_matchers/must_matcher"
8
+ require_relative "have_service_attribute_matchers/message_matcher"
7
9
 
8
10
  module Servactory
9
11
  module TestKit
@@ -50,17 +52,26 @@ module Servactory
50
52
  self
51
53
  end
52
54
 
53
- def consists_of(*types) # rubocop:disable Metrics/MethodLength
54
- message = block_given? ? yield : nil
55
-
55
+ def consists_of(*types)
56
56
  add_submatcher(
57
57
  HaveServiceAttributeMatchers::ConsistsOfMatcher,
58
58
  described_class,
59
59
  :internal,
60
60
  internal_name,
61
61
  @option_types,
62
- Array(types),
63
- message
62
+ Array(types)
63
+ )
64
+ self
65
+ end
66
+
67
+ def schema(data = {})
68
+ add_submatcher(
69
+ HaveServiceAttributeMatchers::SchemaMatcher,
70
+ described_class,
71
+ :internal,
72
+ internal_name,
73
+ @option_types,
74
+ data
64
75
  )
65
76
  self
66
77
  end
@@ -87,6 +98,18 @@ module Servactory
87
98
  self
88
99
  end
89
100
 
101
+ def message(message)
102
+ add_submatcher(
103
+ HaveServiceAttributeMatchers::MessageMatcher,
104
+ described_class,
105
+ :internal,
106
+ internal_name,
107
+ @last_submatcher,
108
+ message
109
+ )
110
+ self
111
+ end
112
+
90
113
  def description
91
114
  "#{internal_name} with #{submatchers.map(&:description).join(', ')}"
92
115
  end
@@ -107,11 +130,12 @@ module Servactory
107
130
 
108
131
  protected
109
132
 
110
- attr_reader :submatchers, :missing, :subject
133
+ attr_reader :last_submatcher, :submatchers, :missing, :subject
111
134
 
112
135
  def add_submatcher(matcher_class, *args)
113
136
  remove_submatcher(matcher_class)
114
- submatchers << matcher_class.new(*args)
137
+ @last_submatcher = matcher_class.new(*args)
138
+ submatchers << @last_submatcher
115
139
  end
116
140
 
117
141
  def remove_submatcher(matcher_class)
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Servactory
4
+ module ToolKit
5
+ module DynamicOptions
6
+ class Inclusion < Must
7
+ def self.use(option_name = :inclusion)
8
+ instance = new(option_name, :in)
9
+ instance.must(:be_inclusion)
10
+ end
11
+
12
+ def condition_for_input_with(input:, value:, option:)
13
+ if input.required? || (
14
+ input.optional? && !input.default.nil?
15
+ ) || (
16
+ input.optional? && !value.nil?
17
+ ) # do
18
+ return option.value.include?(value)
19
+ end
20
+
21
+ true
22
+ end
23
+
24
+ def condition_for_internal_with(value:, option:, **)
25
+ option.value.include?(value)
26
+ end
27
+
28
+ def condition_for_output_with(value:, option:, **)
29
+ option.value.include?(value)
30
+ end
31
+
32
+ ########################################################################
33
+
34
+ def message_for_input_with(service:, input:, value:, option_value:, **)
35
+ service.translate(
36
+ "inputs.validations.must.dynamic_options.inclusion.default",
37
+ input_name: input.name,
38
+ value: value.inspect,
39
+ input_inclusion: option_value.inspect
40
+ )
41
+ end
42
+
43
+ def message_for_internal_with(service:, internal:, value:, option_value:, **)
44
+ service.translate(
45
+ "internals.validations.must.dynamic_options.inclusion.default",
46
+ internal_name: internal.name,
47
+ value: value.inspect,
48
+ internal_inclusion: option_value.inspect
49
+ )
50
+ end
51
+
52
+ def message_for_output_with(service:, output:, value:, option_value:, **)
53
+ service.translate(
54
+ "outputs.validations.must.dynamic_options.inclusion.default",
55
+ output_name: output.name,
56
+ value: value.inspect,
57
+ output_inclusion: option_value.inspect
58
+ )
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -3,7 +3,7 @@
3
3
  module Servactory
4
4
  module ToolKit
5
5
  module DynamicOptions
6
- class Must
6
+ class Must # rubocop:disable Metrics/ClassLength
7
7
  class WorkOption
8
8
  attr_reader :name,
9
9
  :value,
@@ -34,7 +34,11 @@ module Servactory
34
34
  def must(name)
35
35
  Servactory::Maintenance::Attributes::OptionHelper.new(
36
36
  name: @option_name,
37
- equivalent: equivalent_with(name)
37
+ equivalent: equivalent_with(name),
38
+ meta: {
39
+ type: :dynamic_option,
40
+ body_key: @body_key
41
+ }
38
42
  )
39
43
  end
40
44
 
@@ -76,24 +80,48 @@ module Servactory
76
80
  is_option_message_present = option.message.present?
77
81
  is_option_message_proc = option.message.is_a?(Proc) if is_option_message_present
78
82
 
79
- lambda do |input: nil, internal: nil, output: nil, **attributes|
83
+ lambda do |input: nil, internal: nil, output: nil, **attributes| # rubocop:disable Metrics/BlockLength
80
84
  default_attributes = { **attributes, option_name: option.name, option_value: option.value }
81
85
 
82
86
  if Servactory::Utils.really_input?(input)
83
87
  if is_option_message_present
84
- is_option_message_proc ? option.message.call(**default_attributes, input:) : option.message
88
+ if is_option_message_proc
89
+ option.message.call(
90
+ input:,
91
+ **default_attributes.delete(:meta) || {},
92
+ **default_attributes
93
+ )
94
+ else
95
+ option.message
96
+ end
85
97
  else
86
98
  message_for_input_with(**default_attributes, input:)
87
99
  end
88
100
  elsif Servactory::Utils.really_internal?(internal)
89
101
  if is_option_message_present
90
- is_option_message_proc ? option.message.call(**default_attributes, internal:) : option.message
102
+ if is_option_message_proc
103
+ option.message.call(
104
+ internal:,
105
+ **default_attributes.delete(:meta) || {},
106
+ **default_attributes
107
+ )
108
+ else
109
+ option.message
110
+ end
91
111
  else
92
112
  message_for_internal_with(**default_attributes, internal:)
93
113
  end
94
114
  elsif Servactory::Utils.really_output?(output)
95
115
  if is_option_message_present
96
- is_option_message_proc ? option.message.call(**default_attributes, output:) : option.message
116
+ if is_option_message_proc
117
+ option.message.call(
118
+ output:,
119
+ **default_attributes.delete(:meta) || {},
120
+ **default_attributes
121
+ )
122
+ else
123
+ option.message
124
+ end
97
125
  else
98
126
  message_for_output_with(**default_attributes, output:)
99
127
  end
@@ -0,0 +1,193 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Servactory
4
+ module ToolKit
5
+ module DynamicOptions
6
+ class Schema < Must # rubocop:disable Metrics/ClassLength
7
+ RESERVED_ATTRIBUTES = %i[type required default].freeze
8
+ private_constant :RESERVED_ATTRIBUTES
9
+
10
+ def self.use(option_name = :schema, default_hash_mode_class_names:)
11
+ instance = new(option_name, :is, false)
12
+ instance.assign(default_hash_mode_class_names)
13
+ instance.must(:schema)
14
+ end
15
+
16
+ def assign(default_hash_mode_class_names)
17
+ @default_hash_mode_class_names = default_hash_mode_class_names
18
+ end
19
+
20
+ def condition_for_input_with(input:, value:, option:)
21
+ common_condition_with(attribute: input, value:, option:)
22
+ end
23
+
24
+ def condition_for_internal_with(internal:, value:, option:)
25
+ common_condition_with(attribute: internal, value:, option:)
26
+ end
27
+
28
+ def condition_for_output_with(output:, value:, option:)
29
+ common_condition_with(attribute: output, value:, option:)
30
+ end
31
+
32
+ def common_condition_with(attribute:, value:, option:)
33
+ return true if option.value == false
34
+ return [false, :wrong_type] if @default_hash_mode_class_names.intersection(attribute.types).empty?
35
+
36
+ schema = option.value.fetch(:is, option.value)
37
+
38
+ is_success, reason, meta = validate_for!(object: value, schema:)
39
+
40
+ prepare_object_with!(object: value, schema:) if is_success
41
+
42
+ [is_success, reason, meta]
43
+ end
44
+
45
+ def validate_for!(object:, schema:, root_schema_key: nil) # rubocop:disable Metrics/MethodLength
46
+ unless object.respond_to?(:fetch)
47
+ return [
48
+ false,
49
+ :wrong_element_value,
50
+ {
51
+ key_name: root_schema_key,
52
+ expected_type: Hash.name,
53
+ given_type: object.class.name
54
+ }
55
+ ]
56
+ end
57
+
58
+ errors = schema.map do |schema_key, schema_value|
59
+ attribute_type = schema_value.fetch(:type, String)
60
+
61
+ if attribute_type == Hash
62
+ validate_for!(
63
+ object: object.fetch(schema_key, {}),
64
+ schema: schema_value.except(*RESERVED_ATTRIBUTES),
65
+ root_schema_key: schema_key
66
+ )
67
+ else
68
+ is_success, given_type = validate_with(
69
+ object:,
70
+ schema_key:,
71
+ schema_value:,
72
+ attribute_type:,
73
+ attribute_required: schema_value.fetch(:required, true)
74
+ )
75
+
76
+ next if is_success
77
+
78
+ [false, :wrong_element_type, { key_name: schema_key, expected_type: attribute_type, given_type: }]
79
+ end
80
+ end
81
+
82
+ errors.compact.first || true
83
+ end
84
+
85
+ def validate_with(object:, schema_key:, schema_value:, attribute_type:, attribute_required:) # rubocop:disable Metrics/MethodLength
86
+ unless should_be_checked_for?(
87
+ object:,
88
+ schema_key:,
89
+ schema_value:,
90
+ required: attribute_required
91
+ ) # do
92
+ return true
93
+ end
94
+
95
+ value = object.fetch(schema_key, nil)
96
+ prepared_value = prepare_value_from(schema_value:, value:, required: attribute_required)
97
+
98
+ [
99
+ Array(attribute_type).uniq.any? { |type| prepared_value.is_a?(type) },
100
+ prepared_value.class.name
101
+ ]
102
+ end
103
+
104
+ def should_be_checked_for?(object:, schema_key:, schema_value:, required:)
105
+ required || (
106
+ !required && !fetch_default_from(schema_value).nil?
107
+ ) || (
108
+ !required && !object.fetch(schema_key, nil).nil?
109
+ )
110
+ end
111
+
112
+ def prepare_value_from(schema_value:, value:, required:)
113
+ if !required && !fetch_default_from(schema_value).nil? && value.blank?
114
+ fetch_default_from(schema_value)
115
+ else
116
+ value
117
+ end
118
+ end
119
+
120
+ def fetch_default_from(value)
121
+ value.fetch(:default, nil)
122
+ end
123
+
124
+ ########################################################################
125
+
126
+ def prepare_object_with!(object:, schema:) # rubocop:disable Metrics/MethodLength
127
+ schema.map do |schema_key, schema_value|
128
+ attribute_type = schema_value.fetch(:type, String)
129
+
130
+ if attribute_type == Hash
131
+ prepare_object_with!(
132
+ object: object.fetch(schema_key, {}),
133
+ schema: schema_value.except(*RESERVED_ATTRIBUTES)
134
+ )
135
+ else
136
+ next object unless object[schema_key].nil?
137
+
138
+ next object if (default = schema_value.fetch(:default, nil)).nil?
139
+
140
+ object[schema_key] = default
141
+ end
142
+ end
143
+ end
144
+
145
+ ########################################################################
146
+ ########################################################################
147
+ ########################################################################
148
+
149
+ def message_for_input_with(service:, input:, reason:, meta:, **)
150
+ i18n_key = "inputs.validations.must.dynamic_options.schema"
151
+ i18n_key += reason.present? ? ".#{reason}" : ".default"
152
+
153
+ service.translate(
154
+ i18n_key,
155
+ service_class_name: service.class_name,
156
+ input_name: input.name,
157
+ key_name: meta.fetch(:key_name),
158
+ expected_type: meta.fetch(:expected_type),
159
+ given_type: meta.fetch(:given_type)
160
+ )
161
+ end
162
+
163
+ def message_for_internal_with(service:, internal:, reason:, meta:, **)
164
+ i18n_key = "internals.validations.must.dynamic_options.schema"
165
+ i18n_key += reason.present? ? ".#{reason}" : ".default"
166
+
167
+ service.translate(
168
+ i18n_key,
169
+ service_class_name: service.class_name,
170
+ internal_name: internal.name,
171
+ key_name: meta.fetch(:key_name),
172
+ expected_type: meta.fetch(:expected_type),
173
+ given_type: meta.fetch(:given_type)
174
+ )
175
+ end
176
+
177
+ def message_for_output_with(service:, output:, reason:, meta:, **)
178
+ i18n_key = "outputs.validations.must.dynamic_options.schema"
179
+ i18n_key += reason.present? ? ".#{reason}" : ".default"
180
+
181
+ service.translate(
182
+ i18n_key,
183
+ service_class_name: service.class_name,
184
+ output_name: output.name,
185
+ key_name: meta.fetch(:key_name),
186
+ expected_type: meta.fetch(:expected_type),
187
+ given_type: meta.fetch(:given_type)
188
+ )
189
+ end
190
+ end
191
+ end
192
+ end
193
+ end
@@ -5,7 +5,7 @@ module Servactory
5
5
  MAJOR = 2
6
6
  MINOR = 12
7
7
  PATCH = 0
8
- PRE = "rc1"
8
+ PRE = "rc3"
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
11
11
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: servactory
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.12.0.rc1
4
+ version: 2.12.0.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Sokolov
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-02-08 00:00:00.000000000 Z
10
+ date: 2025-03-01 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activesupport
@@ -266,6 +266,7 @@ files:
266
266
  - lib/servactory/exceptions/internal.rb
267
267
  - lib/servactory/exceptions/output.rb
268
268
  - lib/servactory/exceptions/success.rb
269
+ - lib/servactory/info/builder.rb
269
270
  - lib/servactory/info/dsl.rb
270
271
  - lib/servactory/info/result.rb
271
272
  - lib/servactory/inputs/collection.rb
@@ -291,15 +292,12 @@ files:
291
292
  - lib/servactory/maintenance/attributes/options_collection.rb
292
293
  - lib/servactory/maintenance/attributes/tools/check_errors.rb
293
294
  - lib/servactory/maintenance/attributes/tools/validation.rb
294
- - lib/servactory/maintenance/attributes/translator/inclusion.rb
295
295
  - lib/servactory/maintenance/attributes/translator/must.rb
296
296
  - lib/servactory/maintenance/attributes/translator/type.rb
297
297
  - lib/servactory/maintenance/attributes/validations/base.rb
298
298
  - lib/servactory/maintenance/attributes/validations/errors.rb
299
- - lib/servactory/maintenance/attributes/validations/inclusion.rb
300
299
  - lib/servactory/maintenance/attributes/validations/must.rb
301
300
  - lib/servactory/maintenance/attributes/validations/type.rb
302
- - lib/servactory/maintenance/validations/object_schema.rb
303
301
  - lib/servactory/maintenance/validations/types.rb
304
302
  - lib/servactory/outputs/collection.rb
305
303
  - lib/servactory/outputs/dsl.rb
@@ -311,7 +309,9 @@ files:
311
309
  - lib/servactory/test_kit/rspec/matchers.rb
312
310
  - lib/servactory/test_kit/rspec/matchers/have_service_attribute_matchers/consists_of_matcher.rb
313
311
  - lib/servactory/test_kit/rspec/matchers/have_service_attribute_matchers/inclusion_matcher.rb
312
+ - lib/servactory/test_kit/rspec/matchers/have_service_attribute_matchers/message_matcher.rb
314
313
  - lib/servactory/test_kit/rspec/matchers/have_service_attribute_matchers/must_matcher.rb
314
+ - lib/servactory/test_kit/rspec/matchers/have_service_attribute_matchers/schema_matcher.rb
315
315
  - lib/servactory/test_kit/rspec/matchers/have_service_attribute_matchers/types_matcher.rb
316
316
  - lib/servactory/test_kit/rspec/matchers/have_service_input_matcher.rb
317
317
  - lib/servactory/test_kit/rspec/matchers/have_service_input_matchers/default_matcher.rb
@@ -322,10 +322,12 @@ files:
322
322
  - lib/servactory/test_kit/utils/faker.rb
323
323
  - lib/servactory/tool_kit/dynamic_options/consists_of.rb
324
324
  - lib/servactory/tool_kit/dynamic_options/format.rb
325
+ - lib/servactory/tool_kit/dynamic_options/inclusion.rb
325
326
  - lib/servactory/tool_kit/dynamic_options/max.rb
326
327
  - lib/servactory/tool_kit/dynamic_options/min.rb
327
328
  - lib/servactory/tool_kit/dynamic_options/multiple_of.rb
328
329
  - lib/servactory/tool_kit/dynamic_options/must.rb
330
+ - lib/servactory/tool_kit/dynamic_options/schema.rb
329
331
  - lib/servactory/utils.rb
330
332
  - lib/servactory/version.rb
331
333
  homepage: https://github.com/servactory/servactory
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Servactory
4
- module Maintenance
5
- module Attributes
6
- module Translator
7
- module Inclusion
8
- module_function
9
-
10
- def default_message
11
- lambda do |service:, value:, input: nil, internal: nil, output: nil|
12
- attribute = Servactory::Utils.define_attribute_with(input:, internal:, output:)
13
-
14
- service.translate(
15
- "#{attribute.i18n_name}.validations.inclusion.default_error",
16
- "#{attribute.system_name}_name": attribute.name,
17
- "#{attribute.system_name}_inclusion": attribute.inclusion[:in],
18
- value:
19
- )
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end