Merge pull request #2 from igorw/master

Major refactoring
This commit is contained in:
Justin Rainbow 2011-12-10 12:26:23 -08:00
commit c8b6342f1e
60 changed files with 575 additions and 3732 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "vendor/symfony/Component/ClassLoader"]
path = vendor/symfony/Component/ClassLoader
url = https://github.com/symfony/ClassLoader.git

View File

@ -5,14 +5,20 @@
```php
<?php
$json = json_decode($input_json);
$schema = json_decode($input_schema);
$result = JsonSchema::validate($json, $schema);
$validator = new JsonSchema\Validator();
$result = $validator->validate(json_decode($json), json_decode($schema));
if ($result->valid) {
die('success!');
echo "The supplied JSON validates against the schema.\n";
} else {
echo "JSON does not validate. Violations:\n";
foreach ($result->errors as $error) {
echo "[{$error['property']}] {$error['message']}\n";
}
}
else {
die('fail...');
}
```
```
## Running the tests
$ git submodule update --init
$ phpunit

View File

@ -1,5 +0,0 @@
<?php
require 'libs/JsonSchema.php';
require 'libs/JsonSchemaUndefined.php';

View File

@ -1,19 +1,22 @@
{
"name": "justinrainbow/json-schema",
"description": "a library to validate a json schema"
"description": "A library to validate a json schema.",
"keywords": ["json", "schema"],
"homepage": "https://github.com/justinrainbow/json-schema",
"type": "library",
"license": "MIT",
"license": "NewBSD",
"version": "1.0.0",
"authors": [
{
"name": "Justin Rainbow"
"name": "Bruno Prieto Reis",
"email": "bruno.p.reis@gmail.com"
},
{
"name": "Justin Rainbow",
"email": "justin.rainbow@gmail.com"
}
],
"autoload": {
"psr-0": { "JsonSchema": "libs/", "JsonSchemaUndefined": "libs/"}
"psr-0": { "JsonSchema": "src/" }
}
}

View File

@ -1,526 +0,0 @@
<?php
/**
* This file is part of the json-schema package.
*
* Copyright (c) 2008, Gradua Networks
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* JsonSchema validation class
*
* Usage:
*
* // this optional check mode may be set so that strings containing doubles or integers are
* // validated ok against a schema defining an integer or a double.
* // JsonSchema::$checkMode = JsonSchema::CHECK_MODE_TYPE_CAST;
*
* $result = JsonSchema::validate(
* $json,
* $schema
* );
*
* @author Bruno Prieto Reis
* @author Justin Rainbow <justin.rainbow@gmail.com>
* @author Robert Schönthal
*/
class JsonSchema {
static $errors = array();
static $formatValidator;
const CHECK_MODE_NORMAL = 1;
const CHECK_MODE_TYPE_CAST = 2;
public static $checkMode = self::CHECK_MODE_NORMAL;
/**
* Validates a php object against a schema. Both the php object and the schema
* are supposed to be a result of a json_decode call.
* The validation works as defined by the schema proposal in
* http://www.json.com/json-schema-proposal/
*
* @param StdClass $instance
* @param StdClass $schema
* @param JsonFormatValidator $formatValidator an optional class that have methods to validate the format definitions.
* If this is null, so format validation will not be applied, but if its true, then the validation will throw
* an error if any format defined on the schema is not supported by the validator.
* @return unknown
*/
static public function validate($instance, $schema = null, $formatValidator = null) {
self::$errors = array();
self::$formatValidator = null;
if($formatValidator) self::$formatValidator = $formatValidator;
$res = self::_validate($instance,$schema,false);
self::$formatValidator = null;
return $res;
}
static function _validate($instance,$schema = null,$_changing) {
// verify passed schema
if ($schema) {
self::checkProp($instance,$schema,'','',$_changing);
}
// verify "inline" schema
$propName = '$schema';
if (!$_changing && isset($instance->$propName)) {
self::checkProp($instance,$instance->$propName,'','',$_changing);
}
// show results
$obj = new stdClass();
$obj->valid = ! ((boolean)count(self::$errors));
$obj->errors = self::$errors;
return $obj;
}
static function incrementPath($path,$i) {
if($path !== '') {
if(is_int($i)) {
$path .= '['.$i.']';
}
elseif($i == '') {
$path .= '';
}
else {
$path .= '.'.$i;
}
}
else {
$path = $i;
}
return $path;
}
static function checkArray($value,$schema,$path,$i,$_changing) {
//verify items
if(isset($schema->items)) {
//tuple typing
if(is_array($schema->items)) {
foreach($value as $k=>$v) {
if(array_key_exists($k,$schema->items)) {
self::checkProp($v,$schema->items[$k],$path,$k,$_changing);
}
else {
// aditional array properties
if(array_key_exists('additionalProperties',$schema)) {
if($schema->additionalProperties === false) {
self::adderror(
$path,
'The item '.$i.'['.$k.'] is not defined in the objTypeDef and the objTypeDef does not allow additional properties'
);
}
else {
self::checkProp($v,$schema->additionalProperties,$path,$k,$_changing);
}
}
}
}//foreach($value as $k=>$v) {
// treat when we have more schema definitions than values
for($k = count($value); $k < count($schema->items); $k++) {
self::checkProp(
new JsonSchemaUndefined(),
$schema->items[$k], $path, $k, $_changing
);
}
}
// just one type definition for the whole array
else {
foreach($value as $k=>$v) {
self::checkProp($v,$schema->items,$path,$k,$_changing);
}
}
}
// verify number of array items
if(isset($schema->minItems) && count($value) < $schema->minItems) {
self::adderror($path,"There must be a minimum of " . $schema->minItems . " in the array");
}
if(isset($schema->maxItems) && count($value) > $schema->maxItems) {
self::adderror($path,"There must be a maximum of " . $schema->maxItems . " in the array");
}
}
static function checkProp($value, $schema, $path, $i = '', $_changing = false) {
if (!is_object($schema)) {
return;
}
$path = self::incrementPath($path,$i);
// verify readonly
if($_changing && $schema.readonly) {
self::adderror($path,'is a readonly field, it can not be changed');
}
// I think a schema cant be an array, only the items property
/*if(is_array($schema)) {
if(!is_array($value)) {
return array(array('property'=>$path,'message'=>'An array tuple is required'));
}
for($a = 0; $a < count($schema); $a++) {
self::$errors = array_merge(
self::$errors,
self::checkProp($value->$a,$schema->$a,$path,$i,$_changing)
);
return self::$errors;
}
}*/
// if it extends another schema, it must pass that schema as well
if(isset($schema->extends)) {
self::checkProp($value,$schema->extends,$path,$i,$_changing);
}
// verify optional values
if (is_object($value) && $value instanceOf JsonSchemaUndefined) {
if ( isset($schema->required) ? !$schema->required : true) {
self::adderror($path,"is missing and it is not optional");
}
}
// normal verifications
else {
self::$errors = array_merge(
self::$errors,
self::checkType( isset($schema->type) ? $schema->type : null , $value, $path)
);
}
if(array_key_exists('disallow',$schema)) {
$errorsBeforeDisallowCheck = self::$errors;
$response = self::checkType($schema->disallow, $value, $path);
if(
( count($errorsBeforeDisallowCheck) == count(self::$errors) ) &&
!count($response)
) {
self::adderror($path," disallowed value was matched");
}
else {
self::$errors = $errorsBeforeDisallowCheck;
}
}
//verify the itens on an array and min and max number of items.
if(is_array($value)) {
if(
self::$checkMode == self::CHECK_MODE_TYPE_CAST &&
$schema->type == 'object'
) {
self::checkObj(
$value,
$schema->properties,
$path,
isset($schema->additionalProperties) ? $schema->additionalProperties : null,
$_changing
);
}
self::checkArray($value,$schema,$path,$i,$_changing);
}
############ verificar!
elseif(isset($schema->properties) && is_object($value)) {
self::checkObj(
$value,
$schema->properties,
$path,
isset($schema->additionalProperties) ? $schema->additionalProperties : null,
$_changing
);
}
// verify a regex pattern
if( isset($schema->pattern) && is_string($value) && !preg_match('/'.$schema->pattern.'/',$value)) {
self::adderror($path,"does not match the regex pattern " . $schema->pattern);
}
// verify maxLength, minLength, maximum and minimum values
if( isset($schema->maxLength) && is_string($value) && (strlen($value) > $schema->maxLength)) {
self::adderror($path,"must be at most " . $schema->maxLength . " characters long");
}
if( isset($schema->minLength) && is_string($value) && strlen($value) < $schema->minLength) {
self::adderror($path,"must be at least " . $schema->minLength . " characters long");
}
if(
isset($schema->minimum) &&
gettype($value) == gettype($schema->minimum) &&
$value < $schema->minimum
) {
self::adderror($path,"must have a minimum value of " . $schema->minimum);
}
if( isset($schema->maximum) && gettype($value) == gettype($schema->maximum) && $value > $schema->maximum) {
self::adderror($path,"must have a maximum value of " . $schema->maximum);
}
// verify enum values
if(isset($schema->enum)) {
$found = false;
foreach($schema->enum as $possibleValue) {
if($possibleValue == $value) {
$found = true;
break;
}
}
if(!$found) {
self::adderror($path,"does not have a value in the enumeration " . implode(', ',$schema->enum));
}
}
if(
isset($schema->maxDecimal) &&
( ($value * pow(10,$schema->maxDecimal)) != (int)($value * pow(10,$schema->maxDecimal)) )
) {
self::adderror($path,"may only have " . $schema->maxDecimal . " digits of decimal places");
}
if( isset($schema->format) && isset(self::$formatValidator) ) {
$error = self::$formatValidator->validate($value,$schema->format);
if($error) {
self::adderror($path,$error);
}
}
}
static function adderror($path,$message) {
self::$errors[] = array(
'property'=>$path,
'message'=>$message
);
}
/**
* Take Care: Value is being passed by ref to continue validation with proper format.
* @return array
*/
static function checkType($type, &$value, $path) {
if($type) {
$wrongType = false;
if(is_string($type) && $type !== 'any') {
if($type == 'null') {
if (!is_null($value)) {
$wrongType = true;
}
}
else {
if($type == 'number') {
if(self::$checkMode == self::CHECK_MODE_TYPE_CAST) {
$wrongType = !self::checkTypeCast($type,$value);
}
elseif(!in_array(gettype($value),array('integer','double'))) {
$wrongType = true;
}
} else{
if(
self::$checkMode == self::CHECK_MODE_TYPE_CAST
&& $type == 'integer'
) {
$wrongType = !self::checkTypeCast($type,$value);
} elseif (
self::$checkMode == self::CHECK_MODE_TYPE_CAST
&& $type == 'object' && is_array($value)
) {
$wrongType = false;
} elseif ($type !== gettype($value)) {
$wrongType = true;
}
}
}
}
if($wrongType) {
return array(
array(
'property'=>$path,
'message'=>gettype($value)." value found, but a ".$type." is required"
)
);
}
// Union Types :: for now, just return the message for the last expected type!!
if(is_array($type)) {
$validatedOneType = false;
$errors = array();
foreach($type as $tp) {
$error = self::checkType($tp,$value,$path);
if(!count($error)) {
$validatedOneType = true;
break;
}
else {
$errors[] = $error;
$errors = $error;
}
}
if(!$validatedOneType) {
return $errors;
}
}
elseif(is_object($type)) {
self::checkProp($value,$type,$path);
}
}
return array();
}
/**
* Take Care: Value is being passed by ref to continue validation with proper format.
*/
static function checkTypeCast($type,&$value) {
switch($type) {
case 'integer':
$castValue = (integer)$value;
break;
case 'number':
$castValue = (double)$value;
break;
default:
trigger_error('this method should only be called for the above supported types.');
break;
}
if( (string)$value == (string)$castValue ) {
$res = true;
$value = $castValue;
}
else {
$res = false;
}
return $res;
}
static function checkObj($instance, $objTypeDef, $path, $additionalProp,$_changing) {
if($objTypeDef instanceOf StdClass) {
if( ! (($instance instanceOf StdClass) || is_array($instance)) ) {
self::$errors[] = array(
'property'=>$path,
'message'=>"an object is required"
);
}
foreach($objTypeDef as $i=>$value) {
$value =
array_key_exists($i,$instance) ?
(is_array($instance) ? $instance[$i] : $instance->$i) :
new JsonSchemaUndefined();
$propDef = $objTypeDef->$i;
self::checkProp($value,$propDef,$path,$i,$_changing);
}
}
// additional properties and requires
foreach($instance as $i=>$value) {
// verify additional properties, when its not allowed
if( !isset($objTypeDef->$i) && ($additionalProp === false) && $i !== '$schema' ) {
self::$errors[] = array(
'property'=>$path,
'message'=>"The property " . $i . " is not defined in the objTypeDef and the objTypeDef does not allow additional properties"
);
}
// verify requires
if($objTypeDef && isset($objTypeDef->$i) && isset($objTypeDef->$i->requires)) {
$requires = $objTypeDef->$i->requires;
if(!array_key_exists($requires,$instance)) {
self::$errors[] = array(
'property'=>$path,
'message'=>"the presence of the property " . $i . " requires that " . $requires . " also be present"
);
}
}
$value = is_array($instance) ? $instance[$i] : $instance->$i;
// To verify additional properties types.
if ($objTypeDef && is_object($objTypeDef) && !isset($objTypeDef->$i)) {
self::checkProp($value,$additionalProp,$path,$i);
}
// Verify inner schema definitions
$schemaPropName = '$schema';
if (!$_changing && $value && isset($value->$schemaPropName)) {
self::$errors = array_merge(
self::$errors,
checkProp($value,$value->$schemaPropname,$path,$i)
);
}
}
return self::$errors;
}
}
class Dbg {
static public $quietMode = false;
static function includeJqueryJs() {
echo "<script type='text/javascript' src='/js/jquery.js'></script>";
}
static function func($print = true, $numStackSteps = 1) {
$ar = debug_backtrace();
$ret = '';
for($a = $numStackSteps; $a >= 1; $a--) {
$line = $ar[$a-1]['line'];
$step = $ar[$a];
$ret .= str_repeat('&nbsp;&nbsp;&nbsp;',$a).self::showStep($step,$print,$line);
}
if($print && !self::$quietMode) echo $ret;
return $ret;
}
static function mark($title,$print = true) {
$ar = debug_backtrace();
$ret = '';
$line = $ar[0]['line'];
$ret = "[MARK]".$title.'(line '.$line.')<br/>';
if($print && !self::$quietMode) echo $ret;
return $ret;
}
static function object($object,$linkTitle = 'object',$varDump = false,$print = true) {
static $divCount = 0;
$divCount++;
$ar = debug_backtrace();
$ret = '';
$line = $ar[0]['line'];
$ret = '[OBJECT]<a href="javascript:void(0);" onclick="$(\'#div-obj-'.$divCount.'\').toggle()">'.$linkTitle.'</a>';
$ret .= '(line '.$line.')<br/>';
$ret .= '<div id=\'div-obj-'.$divCount.'\' style="display:none;">';
if($varDump) {
ob_start();
var_dump($object);
$ret .= ob_get_clean();
}
else {
$ret .= print_r($object,true);
}
$ret .= '</div>';
if($print && !self::$quietMode) echo $ret;
return $ret;
}
static function showStep($step,$print,$line) {
static $divCount = 0;
$ret = '[STEP]'.$step['class'] . $step['type'] . $step['function'];
if(count($step['args'])) {
$ret .= '(';
$comma = '';
$exp = array();
foreach($step['args'] as $num=>$arg) {
$divCount++;
if(in_array(gettype($arg),array('object','array'))) {
if(is_object($arg)) {
$type = get_class($arg);
}
else {
$type = gettype($arg);
}
$argVal = '<a href="javascript:void(0);" onclick="$(\'#div-step-'.$divCount.'\').toggle()">click to see</a>';
$exp[] =
'<div id=\'div-step-'.$divCount.'\' style="display:none;">'
.print_r($arg,true)
.'</div>';
}
else {
$type = gettype($arg);
if($type == 'string') {
$argVal = "'".$arg."'";
}
else {
$argVal = $arg;
}
$argVal = '<font style="color:#060">'.$argVal.'</font>';
}
$ret .= $comma.' <i>' . $type . "</i> " . $argVal;
$comma = ',';
}
$ret .= ') (line '.$line.')<br/>';
foreach($exp as $text) {
$ret .= '<pre>' . $text . '</pre>';
}
}
return $ret;
}
}
?>

View File

@ -1,16 +0,0 @@
<?php
/**
* This file is part of the json-schema package.
*
* Copyright (c) 2008, Gradua Networks
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* JsonSchemaUndefined
*
* @author Bruno Prieto Reis
*/
class JsonSchemaUndefined {}

View File

@ -14,7 +14,7 @@
>
<testsuites>
<testsuite name="JSON Schema Test Suite">
<directory suffix="Test.php">tests</directory>
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>

View File

@ -0,0 +1,16 @@
<?php
/*
* This file is part of JsonSchema.
*
* (c) Bruno Prieto Reis <bruno.p.reis@gmail.com>, Gradua Networks
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace JsonSchema;
class Undefined
{
}

View File

@ -0,0 +1,397 @@
<?php
/*
* This file is part of JsonSchema.
*
* (c) Bruno Prieto Reis <bruno.p.reis@gmail.com>, Gradua Networks
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace JsonSchema;
class Validator
{
public $checkMode = self::CHECK_MODE_NORMAL;
private $errors = array();
const CHECK_MODE_NORMAL = 1;
const CHECK_MODE_TYPE_CAST = 2;
/**
* Validates a php object against a schema. Both the php object and the schema
* are supposed to be a result of a json_decode call.
* The validation works as defined by the schema proposal in
* http://json-schema.org
*
* @param \stdClass $instance
* @param \stdClass $schema
* @return unknown
*/
public function validate($instance, $schema = null)
{
$this->errors = array();
$_changing = false;
// verify passed schema
if ($schema) {
$this->checkProp($instance, $schema, '', '', $_changing);
}
// verify "inline" schema
$propName = '$schema';
if (!$_changing && isset($instance->$propName)) {
$this->checkProp($instance, $instance->$propName, '', '', $_changing);
}
// show results
$obj = new \stdClass();
$obj->valid = ! ((boolean)count($this->errors));
$obj->errors = $this->errors;
return $obj;
}
protected function incrementPath($path, $i)
{
if ($path !== '') {
if (is_int($i)) {
$path .= '['.$i.']';
} else if ($i == '') {
$path .= '';
} else {
$path .= '.'.$i;
}
} else {
$path = $i;
}
return $path;
}
protected function checkArray($value, $schema, $path, $i, $_changing)
{
//verify items
if (isset($schema->items)) {
//tuple typing
if (is_array($schema->items)) {
foreach ($value as $k => $v) {
if (array_key_exists($k, $schema->items)) {
$this->checkProp($v, $schema->items[$k], $path, $k, $_changing);
}
else {
// aditional array properties
if (array_key_exists('additionalProperties', $schema)) {
if ($schema->additionalProperties === false) {
$this->adderror(
$path,
'The item '.$i.'['.$k.'] is not defined in the objTypeDef and the objTypeDef does not allow additional properties'
);
}
else {
$this->checkProp($v, $schema->additionalProperties, $path, $k, $_changing);
}
}
}
}//foreach ($value as $k => $v) {
// treat when we have more schema definitions than values
for ($k = count($value); $k < count($schema->items); $k++) {
$this->checkProp(
new Undefined(),
$schema->items[$k], $path, $k, $_changing
);
}
}
// just one type definition for the whole array
else {
foreach ($value as $k => $v) {
$this->checkProp($v, $schema->items, $path, $k, $_changing);
}
}
}
// verify number of array items
if (isset($schema->minItems) && count($value) < $schema->minItems) {
$this->adderror($path,"There must be a minimum of " . $schema->minItems . " in the array");
}
if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
$this->adderror($path,"There must be a maximum of " . $schema->maxItems . " in the array");
}
}
protected function checkProp($value, $schema, $path, $i = '', $_changing = false)
{
if (!is_object($schema)) {
return;
}
$path = $this->incrementPath($path, $i);
// verify readonly
if ($_changing && $schema->readonly) {
$this->adderror($path,'is a readonly field, it can not be changed');
}
// I think a schema cant be an array, only the items property
/*if (is_array($schema)) {
if (!is_array($value)) {
return array(array('property' => $path,'message' => 'An array tuple is required'));
}
for ($a = 0; $a < count($schema); $a++) {
$this->errors = array_merge(
$this->errors,
$this->checkProp($value->$a, $schema->$a, $path, $i, $_changing)
);
return $this->errors;
}
}*/
// if it extends another schema, it must pass that schema as well
if (isset($schema->extends)) {
$this->checkProp($value, $schema->extends, $path, $i, $_changing);
}
// verify required values
if (is_object($value) && $value instanceOf Undefined) {
if (isset($schema->required) && $schema->required) {
$this->adderror($path,"is missing and it is required");
}
} else {
// normal verifications
$this->errors = array_merge(
$this->errors,
$this->checkType(isset($schema->type) ? $schema->type : null , $value, $path)
);
}
if (array_key_exists('disallow', $schema)) {
$errorsBeforeDisallowCheck = $this->errors;
$response = $this->checkType($schema->disallow, $value, $path);
if (
( count($errorsBeforeDisallowCheck) == count($this->errors) ) &&
!count($response)
) {
$this->adderror($path," disallowed value was matched");
}
else {
$this->errors = $errorsBeforeDisallowCheck;
}
}
//verify the itens on an array and min and max number of items.
if (is_array($value)) {
if (
$this->checkMode == $this::CHECK_MODE_TYPE_CAST &&
$schema->type == 'object'
) {
$this->checkObj(
$value,
$schema->properties,
$path,
isset($schema->additionalProperties) ? $schema->additionalProperties : null,
$_changing
);
}
$this->checkArray($value, $schema, $path, $i, $_changing);
} else if (isset($schema->properties) && is_object($value)) {
############ verificar!
$this->checkObj(
$value,
$schema->properties,
$path,
isset($schema->additionalProperties) ? $schema->additionalProperties : null,
$_changing
);
}
// verify a regex pattern
if (isset($schema->pattern) && is_string($value) && !preg_match('/'.$schema->pattern.'/', $value)) {
$this->adderror($path,"does not match the regex pattern " . $schema->pattern);
}
// verify maxLength, minLength, maximum and minimum values
if (isset($schema->maxLength) && is_string($value) && (strlen($value) > $schema->maxLength)) {
$this->adderror($path,"must be at most " . $schema->maxLength . " characters long");
}
if (isset($schema->minLength) && is_string($value) && strlen($value) < $schema->minLength) {
$this->adderror($path,"must be at least " . $schema->minLength . " characters long");
}
if (
isset($schema->minimum) &&
gettype($value) == gettype($schema->minimum) &&
$value < $schema->minimum
) {
$this->adderror($path,"must have a minimum value of " . $schema->minimum);
}
if (isset($schema->maximum) && gettype($value) == gettype($schema->maximum) && $value > $schema->maximum) {
$this->adderror($path,"must have a maximum value of " . $schema->maximum);
}
// verify enum values
if (isset($schema->enum)) {
$found = false;
foreach ($schema->enum as $possibleValue) {
if ($possibleValue == $value) {
$found = true;
break;
}
}
if (!$found) {
$this->adderror($path,"does not have a value in the enumeration " . implode(', ', $schema->enum));
}
}
if (
isset($schema->maxDecimal) &&
( ($value * pow(10, $schema->maxDecimal)) != (int)($value * pow(10, $schema->maxDecimal)) )
) {
$this->adderror($path,"may only have " . $schema->maxDecimal . " digits of decimal places");
}
}
protected function adderror($path, $message)
{
$this->errors[] = array(
'property' => $path,
'message' => $message
);
}
/**
* Take Care: Value is being passed by ref to continue validation with proper format.
* @return array
*/
protected function checkType($type, &$value, $path)
{
if ($type) {
$wrongType = false;
if (is_string($type) && $type !== 'any') {
if ($type == 'null') {
if (!is_null($value)) {
$wrongType = true;
}
}
else {
if ($type == 'number') {
if ($this->checkMode == $this::CHECK_MODE_TYPE_CAST) {
$wrongType = !$this->checkTypeCast($type, $value);
}
else if (!in_array(gettype($value), array('integer','double'))) {
$wrongType = true;
}
} else{
if (
$this->checkMode == $this::CHECK_MODE_TYPE_CAST
&& $type == 'integer'
) {
$wrongType = !$this->checkTypeCast($type, $value);
} else if (
$this->checkMode == $this::CHECK_MODE_TYPE_CAST
&& $type == 'object' && is_array($value)
) {
$wrongType = false;
} else if ($type !== gettype($value)) {
$wrongType = true;
}
}
}
}
if ($wrongType) {
return array(
array(
'property' => $path,
'message' => gettype($value)." value found, but a ".$type." is required"
)
);
}
// Union Types :: for now, just return the message for the last expected type!!
if (is_array($type)) {
$validatedOneType = false;
$errors = array();
foreach ($type as $tp) {
$error = $this->checkType($tp, $value, $path);
if (!count($error)) {
$validatedOneType = true;
break;
} else {
$errors[] = $error;
$errors = $error;
}
}
if (!$validatedOneType) {
return $errors;
}
} else if (is_object($type)) {
$this->checkProp($value, $type, $path);
}
}
return array();
}
/**
* Take Care: Value is being passed by ref to continue validation with proper format.
*/
protected function checkTypeCast($type, &$value)
{
switch ($type) {
case 'integer':
$castValue = (integer)$value;
break;
case 'number':
$castValue = (double)$value;
break;
default:
trigger_error('this method should only be called for the above supported types.');
break;
}
if ((string)$value == (string)$castValue ) {
$res = true;
$value = $castValue;
} else {
$res = false;
}
return $res;
}
protected function checkObj($instance, $objTypeDef, $path, $additionalProp, $_changing)
{
if ($objTypeDef instanceOf \stdClass) {
if (! (($instance instanceOf \stdClass) || is_array($instance)) ) {
$this->errors[] = array(
'property' => $path,
'message' => "an object is required"
);
}
foreach ($objTypeDef as $i => $value) {
$value =
array_key_exists($i, $instance) ?
(is_array($instance) ? $instance[$i] : $instance->$i) :
new Undefined();
$propDef = $objTypeDef->$i;
$this->checkProp($value, $propDef, $path, $i, $_changing);
}
}
// additional properties and requires
foreach ($instance as $i => $value) {
// verify additional properties, when its not allowed
if (!isset($objTypeDef->$i) && ($additionalProp === false) && $i !== '$schema' ) {
$this->errors[] = array(
'property' => $path,
'message' => "The property " . $i . " is not defined in the objTypeDef and the objTypeDef does not allow additional properties"
);
}
// verify requires
if ($objTypeDef && isset($objTypeDef->$i) && isset($objTypeDef->$i->requires)) {
$requires = $objTypeDef->$i->requires;
if (!array_key_exists($requires, $instance)) {
$this->errors[] = array(
'property' => $path,
'message' => "the presence of the property " . $i . " requires that " . $requires . " also be present"
);
}
}
$value = is_array($instance) ? $instance[$i] : $instance->$i;
// To verify additional properties types.
if ($objTypeDef && is_object($objTypeDef) && !isset($objTypeDef->$i)) {
$this->checkProp($value, $additionalProp, $path, $i);
}
// Verify inner schema definitions
$schemaPropName = '$schema';
if (!$_changing && $value && isset($value->$schemaPropName)) {
$this->errors = array_merge(
$this->errors,
checkProp($value, $value->$schemaPropname, $path, $i)
);
}
}
return $this->errors;
}
}

View File

@ -1,5 +1,9 @@
<?php
namespace JsonSchema\Tests;
use JsonSchema\Validator;
class AdditionalPropertiesTest extends BaseTestCase
{
public function getInvalidTests()
@ -37,7 +41,7 @@ class AdditionalPropertiesTest extends BaseTestCase
},
"additionalProperties": false
}',
JsonSchema::CHECK_MODE_TYPE_CAST
Validator::CHECK_MODE_TYPE_CAST
),
array(
'{
@ -64,11 +68,11 @@ class AdditionalPropertiesTest extends BaseTestCase
},
"additionalProperties": {"type":"string"}
}',
JsonSchema::CHECK_MODE_TYPE_CAST
Validator::CHECK_MODE_TYPE_CAST
)
);
}
public function getValidTests()
{
return array(
@ -95,7 +99,7 @@ class AdditionalPropertiesTest extends BaseTestCase
"prop":{"type":"string"}
}
}',
JsonSchema::CHECK_MODE_TYPE_CAST
Validator::CHECK_MODE_TYPE_CAST
),
array(
'{

View File

@ -1,5 +1,7 @@
<?php
namespace JsonSchema\Tests;
class ArraysTest extends BaseTestCase
{
public function getInvalidTests()
@ -35,7 +37,7 @@ class ArraysTest extends BaseTestCase
)
);
}
public function getValidTests()
{
return array(

View File

@ -1,6 +1,10 @@
<?php
abstract class BaseTestCase extends PHPUnit_Framework_TestCase
namespace JsonSchema\Tests;
use JsonSchema\Validator;
abstract class BaseTestCase extends \PHPUnit_Framework_TestCase
{
/**
* @dataProvider getInvalidTests
@ -8,34 +12,36 @@ abstract class BaseTestCase extends PHPUnit_Framework_TestCase
public function testInvalidCases($input, $schema, $checkMode = null, $errors = array())
{
if (null === $checkMode) {
$checkMode = JsonSchema::CHECK_MODE_NORMAL;
$checkMode = Validator::CHECK_MODE_NORMAL;
}
JsonSchema::$checkMode = $checkMode;
$result = JsonSchema::validate(json_decode($input), json_decode($schema));
$validator = new Validator();
$validator->checkMode = $checkMode;
$result = $validator->validate(json_decode($input), json_decode($schema));
if (array() !== $errors) {
$this->assertEquals($errors, $result->errors, var_export($result, true));
}
$this->assertFalse($result->valid, var_export($result, true));
}
/**
* @dataProvider getValidTests
*/
public function testValidCases($input, $schema, $checkMode = null)
{
{
if (null === $checkMode) {
$checkMode = JsonSchema::CHECK_MODE_NORMAL;
$checkMode = Validator::CHECK_MODE_NORMAL;
}
JsonSchema::$checkMode = $checkMode;
$result = JsonSchema::validate(json_decode($input), json_decode($schema));
$validator = new Validator();
$validator->checkMode = $checkMode;
$result = $validator->validate(json_decode($input), json_decode($schema));
$this->assertTrue($result->valid, var_export($result, true));
}
abstract public function getValidTests();
abstract public function getInvalidTests();
}

View File

@ -1,12 +1,14 @@
<?php
namespace JsonSchema\Tests;
class BasicTypesTest extends BaseTestCase
{
public function getInvalidTests()
{
return array(
array(
'{
'{
"string":null,
"number":null,
"integer":null,
@ -15,7 +17,7 @@ class BasicTypesTest extends BaseTestCase
"array":null,
"null":1
}',
'{
'{
"type":"object",
"properties":{
"string":{"type":"string"},
@ -31,12 +33,12 @@ class BasicTypesTest extends BaseTestCase
)
);
}
public function getValidTests()
{
return array(
array(
'{
'{
"string":"string test",
"number":1,
"integer":1,
@ -52,7 +54,7 @@ class BasicTypesTest extends BaseTestCase
"any5": [],
"any6": null
}',
'{
'{
"type":"object",
"properties":{
"string":{"type":"string"},

View File

@ -1,5 +1,7 @@
<?php
namespace JsonSchema\Tests;
class DisallowTest extends BaseTestCase
{
public function getInvalidTests()
@ -35,7 +37,7 @@ class DisallowTest extends BaseTestCase
)
);
}
public function getValidTests()
{
return array(

View File

@ -1,5 +1,7 @@
<?php
namespace JsonSchema\Tests;
class EnumTest extends BaseTestCase
{
public function getInvalidTests()
@ -19,7 +21,7 @@ class EnumTest extends BaseTestCase
)
);
}
public function getValidTests()
{
return array(

View File

@ -1,5 +1,7 @@
<?php
namespace JsonSchema\Tests;
class ExtendsTest extends BaseTestCase
{
public function getInvalidTests()
@ -15,18 +17,18 @@ class ExtendsTest extends BaseTestCase
"type": "object",
"properties": {
"name": {
"type": "string"
"type": "string"
},
"age" : {
"type": "integer",
"maximum":120
}
}
},
"extends": {
"id": "oldPerson",
"type": "object",
"properties": {
"age" : {"minimum":70}
"age" : {"minimum":70}
}
}
}'
@ -41,25 +43,25 @@ class ExtendsTest extends BaseTestCase
"type": "object",
"properties": {
"name": {
"type": "string"
"type": "string"
},
"age" : {
"type": "integer",
"maximum":120
}
}
},
"extends": {
"id": "oldPerson",
"type": "object",
"properties": {
"age" : {"minimum":70}
"age" : {"minimum":70}
}
}
}'
)
);
}
public function getValidTests()
{
return array(
@ -73,18 +75,18 @@ class ExtendsTest extends BaseTestCase
"type": "object",
"properties": {
"name": {
"type": "string"
"type": "string"
},
"age" : {
"type": "integer",
"maximum":120
}
}
},
"extends": {
"id": "oldPerson",
"type": "object",
"properties": {
"age" : {"minimum":70}
"age" : {"minimum":70}
}
}
}'

View File

@ -1,5 +1,7 @@
<?php
namespace JsonSchema\Tests;
class MaxDecimalTest extends BaseTestCase
{
public function getInvalidTests()
@ -18,7 +20,7 @@ class MaxDecimalTest extends BaseTestCase
)
);
}
public function getValidTests()
{
return array(

View File

@ -1,5 +1,7 @@
<?php
namespace JsonSchema\Tests;
class MinItemsMaxItemsTest extends BaseTestCase
{
public function getInvalidTests()
@ -29,7 +31,7 @@ class MinItemsMaxItemsTest extends BaseTestCase
)
);
}
public function getValidTests()
{
return array(
@ -46,7 +48,7 @@ class MinItemsMaxItemsTest extends BaseTestCase
),
array(
'{
"value":[2,2,5,8]
"value":[2,2,5,8]
}',
'{
"type":"object",

View File

@ -1,5 +1,7 @@
<?php
namespace JsonSchema\Tests;
class MinLengthMaxLengthTest extends BaseTestCase
{
public function getInvalidTests()
@ -7,7 +9,7 @@ class MinLengthMaxLengthTest extends BaseTestCase
return array(
array(
'{
"value":"w"
"value":"w"
}',
'{
"type":"object",
@ -29,7 +31,7 @@ class MinLengthMaxLengthTest extends BaseTestCase
)
);
}
public function getValidTests()
{
return array(
@ -55,7 +57,7 @@ class MinLengthMaxLengthTest extends BaseTestCase
}
}'
),
);
}
}

View File

@ -1,5 +1,7 @@
<?php
namespace JsonSchema\Tests;
class MinimumMaximumTest extends BaseTestCase
{
public function getInvalidTests()
@ -29,7 +31,7 @@ class MinimumMaximumTest extends BaseTestCase
)
);
}
public function getValidTests()
{
return array(

View File

@ -1,5 +1,7 @@
<?php
namespace JsonSchema\Tests;
class NumberAndIntegerTypesTest extends BaseTestCase
{
public function getInvalidTests()
@ -18,7 +20,7 @@ class NumberAndIntegerTypesTest extends BaseTestCase
)
);
}
public function getValidTests()
{
return array(

View File

@ -1,5 +1,7 @@
<?php
namespace JsonSchema\Tests;
class PatternTest extends BaseTestCase
{
public function getInvalidTests()
@ -19,7 +21,7 @@ class PatternTest extends BaseTestCase
)
);
}
public function getValidTests()
{
return array(

View File

@ -1,5 +1,9 @@
<?php
namespace JsonSchema\Tests;
use JsonSchema\Validator;
class PhpTypeCastModeTest extends BaseTestCase
{
public function getInvalidTests()
@ -36,7 +40,7 @@ class PhpTypeCastModeTest extends BaseTestCase
)
);
}
public function getValidTests()
{
return array(
@ -50,7 +54,7 @@ class PhpTypeCastModeTest extends BaseTestCase
"a":{"type":"integer","maximum":8.0}
}
}',
JsonSchema::CHECK_MODE_TYPE_CAST
Validator::CHECK_MODE_TYPE_CAST
),
array(
'{
@ -62,7 +66,7 @@ class PhpTypeCastModeTest extends BaseTestCase
"a":{"type":"number"}
}
}',
JsonSchema::CHECK_MODE_TYPE_CAST
Validator::CHECK_MODE_TYPE_CAST
),
);
}

View File

@ -1,5 +1,7 @@
<?php
namespace JsonSchema\Tests;
class RequireTest extends BaseTestCase
{
public function getInvalidTests()
@ -12,14 +14,14 @@ class RequireTest extends BaseTestCase
'{
"type":"object",
"properties":{
"state":{"type":"string","optional":true,"requires":"city"},
"city":{"type":"string","optional":true}
"state":{"type":"string","requires":"city"},
"city":{"type":"string"}
}
}'
)
);
}
public function getValidTests()
{
return array(
@ -31,8 +33,8 @@ class RequireTest extends BaseTestCase
'{
"type":"object",
"properties":{
"state":{"type":"string","optional":true,"requires":"city"},
"city":{"type":"string","optional":true}
"state":{"type":"string","requires":"city"},
"city":{"type":"string"}
}
}'
)

View File

@ -1,6 +1,8 @@
<?php
class OptionalPropertyTest extends BaseTestCase
namespace JsonSchema\Tests;
class RequiredPropertyTest extends BaseTestCase
{
public function getInvalidTests()
{
@ -10,13 +12,13 @@ class OptionalPropertyTest extends BaseTestCase
'{
"type":"object",
"properties":{
"number":{"type":"string","optional":false}
"number":{"type":"string","required":true}
}
}'
)
);
}
public function getValidTests()
{
return array(
@ -27,7 +29,7 @@ class OptionalPropertyTest extends BaseTestCase
'{
"type":"object",
"properties":{
"number":{"type":"string","optional":false}
"number":{"type":"string","required":true}
}
}'
)

View File

@ -1,5 +1,7 @@
<?php
namespace JsonSchema\Tests;
class SelfDefinedSchemaTest extends BaseTestCase
{
public function getInvalidTests()
@ -10,14 +12,13 @@ class SelfDefinedSchemaTest extends BaseTestCase
"$schema": {
"properties": {
"name": {
"type": "string"
"type": "string"
},
"age" : {
"type": "integer",
"maximum": 25,
"optional": true
}
}
"maximum": 25
}
}
},
"name" : "John Doe",
"age" : 30,
@ -27,7 +28,7 @@ class SelfDefinedSchemaTest extends BaseTestCase
)
);
}
public function getValidTests()
{
return array(
@ -36,14 +37,13 @@ class SelfDefinedSchemaTest extends BaseTestCase
"$schema": {
"properties": {
"name": {
"type": "string"
"type": "string"
},
"age" : {
"type": "integer",
"maximum": 125,
"optional": true
}
}
"maximum": 125
}
}
},
"name" : "John Doe",
"age" : 30,

View File

@ -1,5 +1,7 @@
<?php
namespace JsonSchema\Tests;
class TupleTypingTest extends BaseTestCase
{
public function getInvalidTests()
@ -17,7 +19,7 @@ class TupleTypingTest extends BaseTestCase
"items":[
{"type":"string"},
{"type":"number"}
]
]
}
}
}'
@ -69,15 +71,16 @@ class TupleTypingTest extends BaseTestCase
"type":"array",
"items":[
{"type":"string"},
{"type":"number"}
]
{"type":"number"},
{"required":true}
]
}
}
}'
)
);
}
public function getValidTests()
{
return array(
@ -92,9 +95,9 @@ class TupleTypingTest extends BaseTestCase
"type":"array",
"items":[
{"type":"string"},
{"type":"number","optional":true},
{"type":"number","optional":true}
]
{"type":"number","required":false},
{"type":"number","required":false}
]
}
}
}'

View File

@ -1,5 +1,7 @@
<?php
namespace JsonSchema\Tests;
class UnionTypesTest extends BaseTestCase
{
public function getInvalidTests()
@ -20,7 +22,7 @@ class UnionTypesTest extends BaseTestCase
)
);
}
public function getValidTests()
{
return array(

View File

@ -1,5 +1,7 @@
<?php
namespace JsonSchema\Tests;
class UnionWithNullValueTest extends BaseTestCase
{
public function getInvalidTests()
@ -20,7 +22,7 @@ class UnionWithNullValueTest extends BaseTestCase
)
);
}
public function getValidTests()
{
return array(

View File

@ -1,5 +1,7 @@
<?php
namespace JsonSchema\Tests;
class WrongMessagesFailingTestCaseTest extends BaseTestCase
{
public function getInvalidTests()
@ -20,7 +22,7 @@ class WrongMessagesFailingTestCaseTest extends BaseTestCase
)
);
}
public function getValidTests()
{
return array(

View File

@ -1,4 +1,8 @@
<?php
require dirname(__FILE__) . '/../bootstrap.php';
require 'BaseTestCase.php';
require_once __DIR__.'/../vendor/symfony/Component/ClassLoader/UniversalClassLoader.php';
$loader = new Symfony\Component\ClassLoader\UniversalClassLoader();
$loader->registerNamespace('JsonSchema', __DIR__.'/../src');
$loader->registerNamespace('JsonSchema\Tests', __DIR__);
$loader->register();

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
<title>Test Suite</title>
</head>
<body>
<table id="suiteTable" cellpadding="1" cellspacing="1" border="1" class="selenium"><tbody>
<tr><td><b>Test Suite</b></td></tr>
<tr><td><a href="basicTypes">basicTypes</a></td></tr>
<tr><td><a href="unionTypes">unionTypes</a></td></tr>
<tr><td><a href="unionWithNullValue">unionWithNullValue</a></td></tr>
<tr><td><a href="arrays">arrays</a></td></tr>
<tr><td><a href="tupleTyping">tupleTyping</a></td></tr>
<tr><td><a href="numberAndIntegerTypes">numberAndIntegerTypes</a></td></tr>
<tr><td><a href="optionalProperty">optionalProperty</a></td></tr>
<tr><td><a href="additionalProperties">additionalProperties</a></td></tr>
<tr><td><a href="require">require</a></td></tr>
<tr><td><a href="minimumMaximum">minimumMaximum</a></td></tr>
<tr><td><a href="minItemsMaxItems">minItemsMaxItems</a></td></tr>
<tr><td><a href="minLengthMaxLength">minLengthMaxLength</a></td></tr>
<tr><td><a href="pattern">pattern</a></td></tr>
<tr><td><a href="enum">enum</a></td></tr>
<tr><td><a href="maxDecimal">maxDecimal</a></td></tr>
<tr><td><a href="selfDefinedSchema">selfDefinedSchema</a></td></tr>
<tr><td><a href="extends">extends</a></td></tr>
<tr><td><a href="phpTypeCastMode">phpTypeCastMode</a></td></tr>
<tr><td><a href="disallow">disallow</a></td></tr>
<tr><td><a href="wrongMessagesFailingTestCase">wrongMessagesFailingTestCase</a></td></tr>
</tbody></table>
</body>
</html>

View File

@ -1,167 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>additionalProperties</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">additionalProperties</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/validator.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;prop&quot;:&quot;1&quot;,<br />&nbsp;&nbsp;&quot;additionalProp&quot;:&quot;2&quot;<br />}</td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;prop&quot;:{&quot;type&quot;:&quot;string&quot;}<br />&nbsp;&nbsp;}<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;prop&quot;:{&quot;type&quot;:&quot;string&quot;}<br />&nbsp;&nbsp;},<br />&nbsp;&nbsp;&quot;additionalProperties&quot;: false<br />} </td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;prop&quot;:{&quot;type&quot;:&quot;string&quot;}<br />&nbsp;&nbsp;},<br />&nbsp;&nbsp;&quot;additionalProperties&quot;: {&quot;type&quot;:&quot;string&quot;}<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;prop&quot;:&quot;1&quot;,<br />&nbsp;&nbsp;&quot;additionalProp&quot;:2<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -1,152 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>arrays</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">arrays</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/validator.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;array&quot;:[1,2,&quot;a&quot;]<br />}</td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;array&quot;:{&quot;type&quot;:&quot;array&quot;}<br />&nbsp;&nbsp;}<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;array&quot;:[1,2,&quot;a&quot;]<br />}</td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;array&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot;:&quot;array&quot;,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;items&quot;:{&quot;type&quot;:&quot;number&quot;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;}<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>array[2]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>array[2]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;array&quot;:[1,2,null]<br />}</td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;array&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot;:&quot;array&quot;,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;items&quot;:{&quot;type&quot;:[&quot;number&quot;,&quot;boolean&quot;]}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;}<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>NULL value found, but a boolean is required</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -1,62 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://jsonschemaphpv" />
<title>basicTypes</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">basicTypes</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/validator.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{ <br />&nbsp;&nbsp;&quot;string&quot;:&quot;string test&quot;,<br />&nbsp;&nbsp;&quot;number&quot;:1,<br />&nbsp;&nbsp;&quot;integer&quot;:1,<br />&nbsp;&nbsp;&quot;boolean&quot;:true,<br />&nbsp;&nbsp;&quot;object&quot;:{},<br />&nbsp;&nbsp;&quot;array&quot;:[],<br />&nbsp;&nbsp;&quot;null&quot;:null,<br />&nbsp;&nbsp;&quot;any&quot;: &quot;string&quot;,<br />&nbsp;&nbsp;&quot;any1&quot;: 2.6,<br />&nbsp;&nbsp;&quot;any2&quot;: 4,<br />&nbsp;&nbsp;&quot;any3&quot;: false,<br />&nbsp;&nbsp;&quot;any4&quot;: {},<br />&nbsp;&nbsp;&quot;any5&quot;: [],<br />&nbsp;&nbsp;&quot;any6&quot;: null<br />}</td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{ <br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;string&quot;:{&quot;type&quot;:&quot;string&quot;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;number&quot;:{&quot;type&quot;:&quot;number&quot;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;integer&quot;:{&quot;type&quot;:&quot;integer&quot;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;boolean&quot;:{&quot;type&quot;:&quot;boolean&quot;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;object&quot;:{&quot;type&quot;:&quot;object&quot;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;array&quot;:{&quot;type&quot;:&quot;array&quot;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;null&quot;:{&quot;type&quot;:&quot;null&quot;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;any&quot;: {&quot;type&quot;:&quot;any&quot;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;any1&quot;: {&quot;type&quot;:&quot;any&quot;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;any2&quot;: {&quot;type&quot;:&quot;any&quot;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;any3&quot;: {&quot;type&quot;:&quot;any&quot;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;any4&quot;: {&quot;type&quot;:&quot;any&quot;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;any5&quot;: {&quot;type&quot;:&quot;any&quot;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;any6&quot;: {&quot;type&quot;:&quot;any&quot;}<br />&nbsp;&nbsp;},<br />&nbsp;&nbsp;&quot;additionalProperties&quot;:false<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -1,172 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>disallow</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">disallow</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/validator.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;value&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot;:&quot;any&quot;,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;disallow&quot;:{&quot;type&quot;:&quot;string&quot;,&quot;pattern&quot;:&quot;^xpto&quot;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;}<br />}</td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;value&quot;:&quot; The xpto is weird&quot;<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;value&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot;:&quot;any&quot;,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;disallow&quot;:{&quot;type&quot;:&quot;string&quot;,&quot;pattern&quot;:&quot;xpto&quot;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;}<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;value&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot;:&quot;any&quot;,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;disallow&quot;:{&quot;type&quot;:&quot;null&quot;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;}<br />} </td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;value&quot;:1<br />} </td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;value&quot;:null <br />} </td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -1,97 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>enum</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">enum</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/validator.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;value&quot;:&quot;Morango&quot;<br />} </td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;value&quot;:{&quot;type&quot;:&quot;string&quot;,&quot;enum&quot;:[&quot;Abacate&quot;,&quot;Manga&quot;,&quot;Pitanga&quot;]}<br />&nbsp;&nbsp;},<br />&nbsp;&nbsp;&quot;additionalProperties&quot;:false<br />} </td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;value&quot;:&quot;Abacate&quot;<br />} </td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -1,132 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>extends</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">extends</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/validator.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;name&quot;:&quot;bruno&quot;,<br />&nbsp;&nbsp;&quot;age&quot;:50<br />} </td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;id&quot;: &quot;person&quot;,<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot;: &quot;object&quot;,<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;properties&quot;: {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;name&quot;: {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot;: &quot;string&quot; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;age&quot; : {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot;: &quot;integer&quot;,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;maximum&quot;:120<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <br />&nbsp;&nbsp;&nbsp;&nbsp;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;extends&quot;: {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;id&quot;: &quot;oldPerson&quot;,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot;: &quot;object&quot;,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;properties&quot;: {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;age&quot; : {&quot;minimum&quot;:70} <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;name&quot;:&quot;bruno&quot;,<br />&nbsp;&nbsp;&quot;age&quot;:80<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;name&quot;:&quot;bruno&quot;,<br />&nbsp;&nbsp;&quot;age&quot;:180<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -1,97 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>maxDecimal</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">maxDecimal</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/validator.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;value&quot;:{&quot;type&quot;:&quot;number&quot;,&quot;maxDecimal&quot;:3}<br />&nbsp;&nbsp;}<br />}</td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;value&quot;:5.6333<br />} </td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;value&quot;:5.633<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -1,167 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>minItemsMaxItems</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">minItemsMaxItems</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/validator.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;value&quot;:[2]<br />} </td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;value&quot;:{&quot;type&quot;:&quot;array&quot;,&quot;minItems&quot;:2,&quot;maxItems&quot;:4}<br />&nbsp;&nbsp;}<br />} </td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;value&quot;:[2,2] <br />} </td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;value&quot;:[2,2,5,8] <br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;value&quot;:[2,2,5,8,5] <br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -1,167 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>minLengthMaxLength</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">minLengthMaxLength</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/validator.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;value&quot;:&quot;w&quot; <br />} </td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;value&quot;:{&quot;type&quot;:&quot;string&quot;,&quot;minLength&quot;:2,&quot;maxLength&quot;:4}<br />&nbsp;&nbsp;}<br />}&nbsp;&nbsp;</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;value&quot;:&quot;wo&quot; <br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;value&quot;:&quot;wo7u&quot;<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;value&quot;:&quot;wo7us&quot;<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -1,167 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>minimumMaximum</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">minimumMaximum</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/validator.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;value&quot;:2<br />}</td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;value&quot;:{&quot;type&quot;:&quot;integer&quot;,&quot;minimum&quot;:4}<br />&nbsp;&nbsp;}<br />} </td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;value&quot;:6<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;value&quot;:{&quot;type&quot;:&quot;integer&quot;,&quot;maximum&quot;:8}<br />&nbsp;&nbsp;}<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;value&quot;:16<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -1,172 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>numberAndIntegerTypes</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">numberAndIntegerTypes</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/validator.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;number&quot;: 1<br />} </td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;number&quot;:{&quot;type&quot;:&quot;number&quot;}<br />&nbsp;&nbsp;}<br />} </td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;number&quot;: 1.4<br />} </td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;number&quot;:{&quot;type&quot;:&quot;integer&quot;}<br />&nbsp;&nbsp;}<br />}</td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;number&quot;: 1<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;number&quot;: 1.4<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -1,97 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>optionalProperty</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">optionalProperty</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/validator.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;number&quot;: &quot;1.4&quot;<br />} </td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;number&quot;:{&quot;type&quot;:&quot;string&quot;,&quot;optional&quot;:false}<br />&nbsp;&nbsp;}<br />} </td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -1,132 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>pattern</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">pattern</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/validator.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;value&quot;:&quot;Abacates&quot;<br />}</td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;value&quot;:{&quot;type&quot;:&quot;string&quot;,&quot;pattern&quot;:&quot;tes$&quot;}<br />&nbsp;&nbsp;},<br />&nbsp;&nbsp;&quot;additionalProperties&quot;:false<br />} </td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;value&quot;:{&quot;type&quot;:&quot;string&quot;,&quot;pattern&quot;:&quot;cat&quot;}<br />&nbsp;&nbsp;},<br />&nbsp;&nbsp;&quot;additionalProperties&quot;:false<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;value&quot;:{&quot;type&quot;:&quot;string&quot;,&quot;pattern&quot;:&quot;^cat&quot;}<br />&nbsp;&nbsp;},<br />&nbsp;&nbsp;&quot;additionalProperties&quot;:false<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -1,137 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://jsonschemaphpv/" />
<title>phpTypeCastMode</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">phpTypeCastMode</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/validator.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;a&quot;:{&quot;type&quot;:&quot;number&quot;}<br />&nbsp;&nbsp;}<br />}</td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;a&quot;:&quot;c&quot;<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php-type-cast-mode</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;a&quot;:&quot;9&quot;<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php-type-cast-mode</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;a&quot;:{&quot;type&quot;:&quot;integer&quot;,&quot;maximum&quot;:8}<br />&nbsp;&nbsp;}<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php-type-cast-mode</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>must have a maximum value of 8</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;a&quot;:{&quot;type&quot;:&quot;integer&quot;,&quot;maximum&quot;:8.0}<br />&nbsp;&nbsp;}<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php-type-cast-mode</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -1,97 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>require</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">require</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/validator.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;state&quot;:&quot;DF&quot;,<br />&nbsp;&nbsp;&quot;city&quot;:&quot;Brasília&quot;<br />} </td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;state&quot;:{&quot;type&quot;:&quot;string&quot;,&quot;optional&quot;:true,&quot;requires&quot;:&quot;city&quot;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;city&quot;:{&quot;type&quot;:&quot;string&quot;,&quot;optional&quot;:true}<br />&nbsp;&nbsp;}<br />} </td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;state&quot;:&quot;DF&quot;<br />} </td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -1,102 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>selfDefinedSchema</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">selfDefinedSchema</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>validator.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;$schema&quot;: {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;properties&quot;: {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;name&quot;: {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot;: &quot;string&quot; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;age&quot; : {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot;: &quot;integer&quot;,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;maximum&quot;: 125,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;optional&quot;: true <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <br />&nbsp;&nbsp;&nbsp;&nbsp;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;name&quot; : &quot;John Doe&quot;,<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;age&quot; : 30,<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot; : &quot;object&quot;<br />}</td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;$schema&quot;: {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;properties&quot;: {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;name&quot;: {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot;: &quot;string&quot; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;age&quot; : {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot;: &quot;integer&quot;,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;maximum&quot;: 25,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;optional&quot;: true <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <br />&nbsp;&nbsp;&nbsp;&nbsp;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;name&quot; : &quot;John Doe&quot;,<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;age&quot; : 30,<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot; : &quot;object&quot;<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -1,267 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>tupleTyping</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">tupleTyping</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/validator.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;tupleTyping&quot;:[2,&quot;a&quot;]<br />}</td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;tupleTyping&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot;:&quot;array&quot;,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;items&quot;:[<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&quot;type&quot;:&quot;string&quot;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&quot;type&quot;:&quot;number&quot;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;] <br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;}<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>tupleTyping[0]</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>tupleTyping[1]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>tupleTyping[0]</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>tupleTyping[1]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;tupleTyping&quot;:[&quot;2&quot;,2,3]<br />}</td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;tupleTyping&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot;:&quot;array&quot;,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;items&quot;:[<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&quot;type&quot;:&quot;string&quot;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&quot;type&quot;:&quot;number&quot;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;] ,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;additionalProperties&quot;:false<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;}<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>tupleTyping[2]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>tupleTyping[2]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;tupleTyping&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot;:&quot;array&quot;,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;items&quot;:[<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&quot;type&quot;:&quot;string&quot;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&quot;type&quot;:&quot;number&quot;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;] ,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;additionalProperties&quot;:{&quot;type&quot;:&quot;string&quot;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;}<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>tupleTyping[2]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>tupleTyping[2]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;tupleTyping&quot;:[&quot;2&quot;]<br />}</td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;tupleTyping&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot;:&quot;array&quot;,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;items&quot;:[<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&quot;type&quot;:&quot;string&quot;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&quot;type&quot;:&quot;number&quot;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;] <br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;}<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>tupleTyping[1] :: is missing and it is not optional</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>tupleTyping[1] :: is missing and it is not optional</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;tupleTyping&quot;:[&quot;2&quot;]<br />}</td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;tupleTyping&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot;:&quot;array&quot;,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;items&quot;:[<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&quot;type&quot;:&quot;string&quot;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&quot;type&quot;:&quot;number&quot;,&quot;optional&quot;:true},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&quot;type&quot;:&quot;number&quot;,&quot;optional&quot;:true}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;] <br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;}<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -1,97 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>unionTypes</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">unionTypes</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/validator.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;stringOrNumber&quot;:4.8,<br />&nbsp;&nbsp;&quot;booleanOrNull&quot;:false<br />}</td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;stringOrNumber&quot;:{&quot;type&quot;:[&quot;string&quot;,&quot;number&quot;]},<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;booleanOrNull&quot;:{&quot;type&quot;:[&quot;boolean&quot;,&quot;null&quot;]}<br />&nbsp;&nbsp;}<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: VALID</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;stringOrNumber&quot;:4.8,<br />&nbsp;&nbsp;&quot;booleanOrNull&quot;:5<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -1,62 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>unionWithNullValue</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">unionWithNullValue</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/validator.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;stringOrNumber&quot;:null,<br />&nbsp;&nbsp;&quot;booleanOrNull&quot;:null<br />}</td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;stringOrNumber&quot;:{&quot;type&quot;:[&quot;string&quot;,&quot;number&quot;]},<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;booleanOrNull&quot;:{&quot;type&quot;:[&quot;boolean&quot;,&quot;null&quot;]}<br />&nbsp;&nbsp;}<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-php</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>JSON: INVALID</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

View File

@ -1,72 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>failingJson</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">failingJson</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/validator.html</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;stringOrNumber&quot;:{&quot;type&quot;:[&quot;string&quot;,&quot;number&quot;]},<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;booleanOrNull&quot;:{&quot;type&quot;:[&quot;boolean&quot;,&quot;null&quot;]}<br />&nbsp;&nbsp;}<br />}</td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;stringOrNumber&quot;:4.8,<br />&nbsp;&nbsp;&quot;booleanOrNull&quot;:[&quot;A&quot;,&quot;B&quot;]<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>array value found, but a null is required</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>schema</td>
<td>{<br />&nbsp;&nbsp;&quot;type&quot;:&quot;object&quot;,<br />&nbsp;&nbsp;&quot;properties&quot;:{<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;stringOrNumber&quot;:{&quot;type&quot;:[&quot;string&quot;,&quot;number&quot;]},<br />&nbsp;&nbsp;&nbsp;&nbsp;&quot;booleanOrNull&quot;:{&quot;type&quot;:[&quot;boolean&quot;,&quot;null&quot;]}<br />&nbsp;&nbsp;}<br />}</td>
</tr>
<tr>
<td>type</td>
<td>json</td>
<td>{<br />&nbsp;&nbsp;&quot;stringOrNumber&quot;:4.8,<br />&nbsp;&nbsp;&quot;booleanOrNull&quot;:[&quot;A&quot;,&quot;B&quot;]<br />}</td>
</tr>
<tr>
<td>click</td>
<td>bt-validate-js</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>JSON:</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>array value found, but a null is required</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>

@ -0,0 +1 @@
Subproject commit 1c23c336915e4fa11abef2279ee48e7fb660ad8c

View File

@ -1,17 +0,0 @@
*{
font-family: verdana, arial, sans-serif;
}
.campo{
width:550px;
height:230px;
background-color:#eee;
}
.botao{
width:300px;
height:60px;
}
.comment{
background-color:#eee;
color:#363;
font-size: .7em;
}

View File

@ -1,53 +0,0 @@
function print_r( array, return_val ) {
// http://kevin.vanzonneveld.net
// + original by: Michael White (http://getsprink.com)
// + improved by: Ben Bryan
// * example 1: print_r(1, true);
// * returns 1: 1
var output = "", pad_char = " ", pad_val = 4;
var formatArray = function (obj, cur_depth, pad_val, pad_char) {
if (cur_depth > 0) {
cur_depth++;
}
var base_pad = repeat_char(pad_val*cur_depth, pad_char);
var thick_pad = repeat_char(pad_val*(cur_depth+1), pad_char);
var str = "";
if (obj instanceof Array || obj instanceof Object) {
str += "Array\n" + base_pad + "(\n";
for (var key in obj) {
if (obj[key] instanceof Array) {
str += thick_pad + "["+key+"] => "+formatArray(obj[key], cur_depth+1, pad_val, pad_char);
} else {
str += thick_pad + "["+key+"] => " + obj[key] + "\n";
}
}
str += base_pad + ")\n";
} else if(obj == null || obj == undefined) {
str = '';
} else {
str = obj.toString();
}
return str;
};
var repeat_char = function (len, pad_char) {
var str = "";
for(var i=0; i < len; i++) {
str += pad_char;
};
return str;
};
output = formatArray(array, 0, pad_val, pad_char);
if (return_val !== true) {
document.write("<pre>" + output + "</pre>");
return true;
} else {
return output;
}
}

View File

@ -1,67 +0,0 @@
$(document).ready(function(){
$("#bt-validate-js").click(validateJs);
$("#bt-validate-php").click(validatePhp);
$("#bt-validate-php-type-cast-mode").click(validatePhpTypeCastMode);
});
function validatePhpTypeCastMode() {
validatePhp(true);
}
function validatePhp(typeCastMode) {
if(typeCastMode == true) {
typeCastMode = true;
}
else {
typeCastMode = false;
}
$('#resultados').html('. . . w o r k i n g . . . ');
schema = $('#schema').val();
json = $('#json').val();
$.getJSON(
"validate.php",
{"schema":schema,"json":json,"typeCastMode":typeCastMode},
phpCallback
);
}
function phpCallback(json) {
showResponse(json);
}
function validateJs() {
$('#resultados').html('. . . w o r k i n g . . . ');
jsons = getJsons();
//alert(print_r(jsons,true));
if(jsons.schema) {
validateResponse = JSONSchema.validate(jsons.json,jsons.schema);
}
else {
validateResponse = JSONSchema.validate(jsons.json);
}
showResponse(validateResponse);
}
function getJsons() {
schema = $('#schema').val();
json = $('#json').val();
json = eval( '(' + json + ')' );
if(schema) {
schema = eval( '(' + schema + ')' );
}
return {"json":json,"schema":schema};
}
function showResponse(validateResponse) {
//alert(print_r(validateResponse,true));
res = '<b>'+'JSON: '+(validateResponse.valid?' VALID':'INVALID')+'</B><BR/>';
$.each(validateResponse.errors,function(i,item) {
//alert(print_r(item,true));
res += '<b>' + item.property + '</b> :: ' + item.message + '<br/><br/>';
res += '<span class=comment>'+(i+":"+print_r(item,true))+"</span><BR/><br/>";
});
$('#resultados').html(res);
}

11
webroot/js/jquery.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,213 +0,0 @@
/**
* JSONSchema Validator - Validates JavaScript objects using JSON Schemas
* (http://www.json.com/json-schema-proposal/)
*
* Copyright (c) 2007 Kris Zyp SitePen (www.sitepen.com)
* Licensed under the MIT (MIT-LICENSE.txt) licence.
To use the validator call JSONSchema.validate with an instance object and an optional schema object.
If a schema is provided, it will be used to validate. If the instance object refers to a schema (self-validating),
that schema will be used to validate and the schema parameter is not necessary (if both exist,
both validations will occur).
The validate method will return an array of validation errors. If there are no errors, then an
empty list will be returned. A validation error will have two properties:
"property" which indicates which property had the error
"message" which indicates what the error was
*/
JSONSchema = {
validate : function(/*Any*/instance,/*Object*/schema) {
// Summary:
// To use the validator call JSONSchema.validate with an instance object and an optional schema object.
// If a schema is provided, it will be used to validate. If the instance object refers to a schema (self-validating),
// that schema will be used to validate and the schema parameter is not necessary (if both exist,
// both validations will occur).
// The validate method will return an object with two properties:
// valid: A boolean indicating if the instance is valid by the schema
// errors: An array of validation errors. If there are no errors, then an
// empty list will be returned. A validation error will have two properties:
// property: which indicates which property had the error
// message: which indicates what the error was
//
return this._validate(instance,schema,false);
},
checkPropertyChange : function(/*Any*/value,/*Object*/schema) {
// Summary:
// The checkPropertyChange method will check to see if an value can legally be in property with the given schema
// This is slightly different than the validate method in that it will fail if the schema is readonly and it will
// not check for self-validation, it is assumed that the passed in value is already internally valid.
// The checkPropertyChange method will return the same object type as validate, see JSONSchema.validate for
// information.
//
return this._validate(value,schema,true);
},
_validate : function(/*Any*/instance,/*Object*/schema,/*Boolean*/ _changing) {
var errors2 = [];
// validate a value against a property definition
function checkProp(value, schema, path,i) {
if (typeof schema != 'object') {
return;
}
path += path ? typeof i == 'number' ? '[' + i + ']' : typeof i == 'undefined' ? '' : '.' + i : i;
function addError(message) {
errors2.push({property:path,message:message});
}
if (_changing && schema.readonly)
addError("is a readonly field, it can not be changed");
/*
if (schema instanceof Array) {
if (!(value instanceof Array)) {
return [{property:path,message:"An array tuple is required"}];
}
for (i =0; i < schema.length; i++) {
errors2.concat(checkProp(value[i],schema[i],path,i));
}
return errors2;
}
*/
if (schema['extends']) // if it extends another schema, it must pass that schema as well
checkProp(value,schema['extends'],path,i);
// validate a value against a type definition
function checkType(type,value) {
if (type) {
if (typeof type == 'string' && type != 'any'
&& (type == 'null' ? value !== null : typeof value != type)
&& !(value instanceof Array && type == 'array')
&& !(type == 'integer' && !(value%1)))
return [{property:path,message:(typeof value) + " value found, but a " + type + " is required"}];
if (type instanceof Array) {
var unionErrors=[];
for (var j = 0; j < type.length; j++) // a union type
if (!(unionErrors=checkType(type[j],value)).length)
break;
if (unionErrors.length)
return unionErrors;
}
else if (typeof type == 'object') {
checkProp(value,type,path);
}
}
return [];
}
//if (value !== null) {
if (value === undefined) {
if (!schema.optional)
addError("is missing and it is not optional");
}
else {
errors2 = errors2.concat(checkType(schema.type,value));
if (schema.disallow && !checkType(schema.disallow,value).length)
addError(" disallowed value was matched");
if (value instanceof Array) {
if (schema.items) {
if(schema.items instanceof Array) {
for (var k = 0,l=value.length; k < l; k++) {
if(k < schema.items.length) {
errors2.concat(checkProp(value[k],schema.items[k],path,k));
}
else {
if(schema.additionalProperties !== undefined) {
if(schema.additionalProperties === false) {
addError("The item " + i + "[" + k + "] is not defined in the objTypeDef and the objTypeDef does not allow additional properties");
}
else {
errors2.concat(checkProp(value[k],schema.additionalProperties,path,k));
}
}
}
}
if(value.length < schema.items.length) {
for (var k = value.length; k < schema.items.length; k++) {
errors2.concat(checkProp(undefined,schema.items[k],path,k));
}
}
}
else {
for (var i =0,l=value.length; i < l; i++) {
errors2.concat(checkProp(value[i],schema.items,path,i));
}
}
}
if (schema.minItems && value.length < schema.minItems) {
addError("There must be a minimum of " + schema.minItems + " in the array");
}
if (schema.maxItems && value.length > schema.maxItems) {
addError("There must be a maximum of " + schema.maxItems + " in the array");
}
}
else if (schema.properties && typeof value == 'object') {
errors2.concat(checkObj(value,schema.properties,path,schema.additionalProperties));
}
if (schema.pattern && typeof value == 'string' && !value.match(schema.pattern))
addError("does not match the regex pattern " + schema.pattern);
if (schema.maxLength && typeof value == 'string' && (value.length > schema.maxLength))
addError("may only be " + schema.maxLength + " characters long");
if (schema.minLength && typeof value == 'string' && (value.length < schema.minLength))
addError("must be at least " + schema.minLength + " characters long");
if (typeof schema.minimum !== undefined && typeof value == typeof schema.minimum && schema.minimum > value)
addError("must have a minimum value of " + schema.minimum);
if (typeof schema.maximum !== undefined && typeof value == typeof schema.maximum && schema.maximum < value)
addError("must have a maximum value of " + schema.maximum);
if (schema['enum']) {
var enumer = schema['enum'];
var l = enumer.length;
var found;
for (var j = 0; j < l; j++)
if (enumer[j]===value) {
found=1;
break;
}
if (!found) {
addError("does not have a value in the enumeration " + enumer.join(", "));
}
}
if (typeof schema.maxDecimal == 'number' && (value * Math.pow(10,schema.maxDecimal))%1) {
addError("may only have " + schema.maxDecimal + " digits of decimal places");
}
}
//}
}
// validate an object against a schema
function checkObj(instance,objTypeDef,path,additionalProp) {
if (typeof objTypeDef =='object') {
if (typeof instance != 'object' || instance instanceof Array)
errors2.push({property:path,message:"an object is required"});
for (var i in objTypeDef)
if (objTypeDef.hasOwnProperty(i)) {
var value = instance[i];
var propDef = objTypeDef[i];
checkProp(value,propDef,path,i);
}
}
for (var i in instance) {
if (instance.hasOwnProperty(i) && objTypeDef && !objTypeDef[i] && additionalProp===false)
errors2.push({property:path,message:(typeof value) + "The property " + i + " is not defined in the objTypeDef and the objTypeDef does not allow additional properties"});
var requires = objTypeDef && objTypeDef[i] && objTypeDef[i].requires;
if (requires && !(requires in instance))
errors2.push({property:path,message:"the presence of the property " + i + " requires that " + requires + " also be present"});
value = instance[i];
if (objTypeDef && typeof objTypeDef == 'object' && !(i in objTypeDef))
checkProp(value,additionalProp,path,i);
// if (!_changing && value && value.type)
// errors2 = errors2.concat(checkObj(value,value.type,path + '.' + i));
if (!_changing && value && value.$schema)
errors2 = errors2.concat(checkProp(value,value.$schema,path,i));
}
return errors2;
}
if (schema)
checkProp(instance,schema,'','')
if (!_changing && instance.$schema)
checkProp(instance,instance.$schema,'','');
return {valid:!errors2.length,errors:errors2};
}
/* will add this later
newFromSchema : function() {
}
*/
}

View File

@ -1,30 +0,0 @@
<?php
require_once('../../libs/JsonSchema.php');
require_once('../../libs/JsonSchemaUndefined.php');
Dbg::$quietMode = true;
if($_REQUEST['schema']) {
$schema = json_decode($_REQUEST['schema']);
if(!$schema) {
trigger_error('Could not parse the SCHEMA object.',E_USER_ERROR);
}
}
else {
$schema = null;
}
$json = json_decode($_REQUEST['json']);
if(!$json) {
trigger_error('Could not parse the JSON object.',E_USER_ERROR);
}
if($_REQUEST['typeCastMode'] == 'true') {
JsonSchema::$checkMode = JsonSchema::CHECK_MODE_TYPE_CAST;
}
$result = JsonSchema::validate(
$json,
$schema
);
header('Content-type: application/x-json');
echo json_encode($result);
?>

View File

@ -1,50 +0,0 @@
<html>
<head>
<script type="text/javascript" src="../js/jsonschema.js"></script>
<script type="text/javascript" src="../js/functions.js"></script>
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/interface.js"></script>
<link rel="stylesheet" type="text/css" href="../css/interface.css" />
</head>
<body>
<table>
<tr>
<td>
<h3>JSON</h3>
<textarea class='campo' id='json'>
{
"a":1,
"b":"thing I know is that",
"c":"I do exist"
} </textarea>
</td>
<td rowspan="2" valign="top">
<h3>Schema:</h3>
<textarea class='campo' id='schema'>
{
"type":"object",
"properties":{
"a":{"type":"number"},
"b":{"type":"string"}
},
"additionalProperties":false
}
</textarea>
</td>
</tr>
</table>
<button id='bt-validate-js' class='botao'>
Validate With Js
</button>
<button id='bt-validate-php' class='botao'>
Validate With PHP
</button>
<button id='bt-validate-php-type-cast-mode' class='botao'>
Validate With PHP (type cast mode)
</button>
<br/>
<div id='resultados'>...</div>
</body>
</html>