lib/json-schema/validator.rb
# Run a simple true/false validation of data against a schema
Run a simple true/false validation of data against a schema
Run a simple true / false validation of data against a schema
def validate()
      @base_schema.validate(@data,[],self,@validation_options)
      if @options[:errors_as_objects]
        return @errors.map{|e| e.to_hash}
      else
        return @errors.map{|e| e.to_string}
      end
    ensure
      if @validation_options[:clear_cache] == true
        Validator.clear_cache
      end
      if @validation_options[:insert_defaults]
        JSON::Validator.merge_missing_values(@data, @original_data)
      end
    end
def validate ( ) @base_schema . validate ( @data , [ ] , self , @validation_options ) if @options [ :errors_as_objects ] return @errors . map { | e | e . to_hash } else return @errors . map { | e | e . to_string } end ensure if @validation_options [ :clear_cache ] == true Validator . clear_cache end if @validation_options [ :insert_defaults ] JSON :: Validator . merge_missing_values ( @data , @original_data ) end end
Run a simple true/false validation of data against a schema
Run a simple true / false validation of data against a schema