SDK
SDK Javascript v5.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

validateSpecifications #

Validate a specification.


validateSpecifications(content, [options], callback) #

ArgumentsTypeDescription
contentJSON objectContent of the specification to validate
optionsJSON objectOptional parameters
callbackfunctionCallback handling the response

Options #

OptionTypeDescriptionDefault
queuablebooleanMake this request queuable or nottrue

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
  });