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 #
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
}
});
Edit this page on Github(opens new window)