class Schemacop::V3::IsNotNode

Public Instance Methods

_validate(data, result:) click to toggle source
Calls superclass method
# File lib/schemacop/v3/is_not_node.rb, line 8
def _validate(data, result:)
  super_data = super
  return if super_data.nil?

  if matches(super_data).any?
    result.error "Must not match schema: #{@items.first.as_json.as_json.inspect}."
  end
end
as_json() click to toggle source
# File lib/schemacop/v3/is_not_node.rb, line 17
def as_json
  process_json([], type => @items.first.as_json)
end
cast(data) click to toggle source
# File lib/schemacop/v3/is_not_node.rb, line 27
def cast(data)
  data
end
type() click to toggle source
# File lib/schemacop/v3/is_not_node.rb, line 4
def type
  :not
end
validate_self() click to toggle source
# File lib/schemacop/v3/is_not_node.rb, line 21
def validate_self
  if @items.count != 1
    fail 'Node "is_not" only allows exactly one item.'
  end
end