lib/sdr/sdr_base.rb
def validate_json(jsonString, jsonSchemaString, list=false)
        schemaVer = :draft3
        json_doc = MultiJson.load(jsonString)
        json_schema = MultiJson.load(jsonSchemaString)
        JSON::Validator.validate(json_schema, json_doc, :list => list, :version => schemaVer)
        #JSON::Validator.fully_validate(json_schema, json_doc, :list => list, :version => schemaVer, :validate_schema => true)
      end
# Validate JSON object against a JSON schema.
# @note schema is only validated after json data fails to validate.
# @param [String] jsonString a json string that will be parsed by MultiJson.load
# @param [String] jsonSchemaString a json schema string that will be parsed by MultiJson.load
# @param [boolean] list set it true for json array to validate against jsonSchemaString
Validate JSON object against a JSON schema.
Validate JSON object against a JSON schema .
def validate_json(jsonString, jsonSchemaString, list=false)
        schemaVer = :draft3
        json_doc = MultiJson.load(jsonString)
        json_schema = MultiJson.load(jsonSchemaString)
        JSON::Validator.validate(json_schema, json_doc, :list => list, :version => schemaVer)
      end
def validate_json ( jsonString , jsonSchemaString , list = false ) schemaVer = :draft3 json_doc = MultiJson . load ( jsonString ) json_schema = MultiJson . load ( jsonSchemaString ) JSON :: Validator . validate ( json_schema , json_doc , :list => list , :version => schemaVer ) end
Validate JSON object against a JSON schema.
Validate JSON object against a JSON schema .
#JSON::Validator.fully_validate(json_schema, json_doc, :list => list, :version => schemaVer, :validate_schema => true)
jsonString
jsonSchemaString
list
list set it true for json array to validate against jsonSchemaString
list set it true for json array to validate against jsonSchemaString
note
schema is only validated after json data fails to validate.
schema is only validated after json data fails to validate .