Class: OptionalObjectMembersValidation
Constant Summary
Constants included
from Inspectable
Inspectable::INSPECTING_KEY
Instance Attribute Summary collapse
Instance Method Summary
collapse
memoized_new_from_pattern
#initialize
#inspect
Instance Attribute Details
#members ⇒ Object
Returns the value of attribute members.
798
799
800
|
# File 'lib/json_patterns.rb', line 798
def members
@members
end
|
Instance Method Details
#first_value_match?(name, value) ⇒ Boolean
810
811
812
|
# File 'lib/json_patterns.rb', line 810
def first_value_match?(name, value)
@members.first_value_match?(name, value)
end
|
#first_value_validations(name) ⇒ Object
814
815
816
|
# File 'lib/json_patterns.rb', line 814
def first_value_validations(name)
@members.first_value_validations(name)
end
|
#matching_first_names(data) ⇒ Object
806
807
808
|
# File 'lib/json_patterns.rb', line 806
def matching_first_names(data)
@members.matching_first_names(data)
end
|
#possible_first_names ⇒ Object
TODO: If this is in a sequence, failure should trigger a check to the next member in the sequence
802
803
804
|
# File 'lib/json_patterns.rb', line 802
def possible_first_names
@members.possible_first_names
end
|
#to_s ⇒ Object
829
830
831
|
# File 'lib/json_patterns.rb', line 829
def to_s
"(#{@members})?"
end
|
#validate_members(path, data) ⇒ Object
818
819
820
821
822
823
824
825
826
827
|
# File 'lib/json_patterns.rb', line 818
def validate_members(path, data)
if matching_first_names(data).size > 0
return @members.validate_members(path, data)
else
return ObjectMembersValidationResult.new(
failures: [],
remainder: data,
)
end
end
|