SDK
SDK Java v2.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 #

JSONObject fooField = new JSONObject()
  .put("mandatory", "true")
  .put("type", "string")
  .put("defaultValue", "bar");
JSONObject fields = new JSONObject()
  .put("foo", fooField);
JSONObject specifications = new JSONObject()
  .put("strict", "true")
  .put("fields", fields);
kuzzle
  .collection("collection", "index")
  .validateSpecifications(specifications, new ResponseListener<Boolean>() {
    @Override
    public void onSuccess(Boolean isValid) {
      // isValid is a boolean
    }
    @Override
    public void onError(JSONObject error) {
      // Handle error
    }
  });