Sha256: a2edcd69275c129eef1af5ea61903a5d15d1500e25151f76235855af17c85a7c
Contents?: true
Size: 732 Bytes
Versions: 33
Compression:
Stored size: 732 Bytes
Contents
require 'json-schema' module Fitting class Response class FullyValidates < Array def self.craft(schemas, body, strict) if schemas new(schemas.inject([]) do |res, schema| res.push(fully_validate(schema, body, strict)) end) else @valid = false new end end def valid? @valid ||= any? { |fully_validate| fully_validate == [] } end def to_s @to_s ||= join("\n\n") end class << self def fully_validate(schema, body, strict) JSON::Validator.fully_validate(schema, body, strict: strict) rescue JSON::Schema::UriError [] end end end end end
Version data entries
33 entries across 33 versions & 1 rubygems