validateSpecifications #
Validate a specification.
validateSpecifications(content, [options], callback) #
Arguments | Type | Description |
---|---|---|
content | JSON object | Content of the specification to validate |
options | JSON object | Optional parameters |
callback | function | Callback handling the response |
Options #
Option | Type | Description | Default |
---|---|---|---|
queuable | boolean | Make this request queuable or not | true |
Callback Response #
Returns a boolean indicating whether or not the input specifications is valid or not.
Usage #
<?php
use \Kuzzle\Kuzzle;
$specifications = [
'strict' => true,
'fields' => [
'foo' => [
'mandatory' => true,
'type' => 'string',
'defaultValue' => 'bar'
]
]
];
$kuzzle = new Kuzzle('localhost');
$dataCollection = $kuzzle->collection('collection', 'index');
try {
// $isValid is a boolean
$isValid = $dataCollection->validateSpecifications($specifications);
}
catch (ErrorException $e) {
}
Edit this page on Github(opens new window)