42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/fitting/doc/json_schema.rb', line 42
def cover!(log)
if @super_schema
@step_cover_size += 1
@logs.push(log.body)
@next_steps.each { |combination| combination.cover!(log) }
elsif JSON::Validator.fully_validate(@step_key, log.body) == []
@step_cover_size += 1
@logs.push(log.body)
@next_steps.each { |combination| combination.cover!(log) }
else
raise Fitting::Doc::JsonSchema::NotFound.new "json-schema: #{::JSON.pretty_generate(@step_key)}\n\n"\
"body: #{::JSON.pretty_generate(log.body)}\n\n"\
"error #{JSON::Validator.fully_validate(@step_key, log.body).first}"
end
rescue JSON::Schema::SchemaError => e
raise Fitting::Doc::JsonSchema::NotFound.new "json-schema: #{::JSON.pretty_generate(@step_key)}\n\n"\
"body: #{::JSON.pretty_generate(log.body)}\n\n"\
"error #{e.message}"
rescue Fitting::Doc::CombinationOneOf::NotFound => e
raise Fitting::Doc::JsonSchema::NotFound.new "#{e.message}\n\nsource json-schema: #{::JSON.pretty_generate(@step_key)}\n\n"
end
|