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 #
var specifications = {
strict: 'true',
fields: {
foo: {
mandatory: true,
type: 'string',
defaultValue: 'bar'
}
}
};
// Using callbacks (NodeJS or Web Browser)
kuzzle
.collection('collection', 'index')
.validateSpecifications(specifications, function (err, isValid) {
// isValid is a boolean
});
// Using promises (NodeJS)
kuzzle
.collection('collection', 'index')
.validateSpecificationsPromise(specifications)
.then(isValid => {
// isValid is a boolean
});
Edit this page on Github(opens new window)