SDK
SDK Jvm v1.x
2

validate #

Validates data against existing validation rules.

Note that if no validation specifications are set for the <index>/<collection>, the document will always be valid.

This request does not store or publish the document.


:::: tabs ::: tab Java

Copied to clipboard!
public CompletableFuture<Boolean> validate(
      String index,
      String collection,
      Map<String, Object> document)
throws NotConnectedException, InternalException
Argument Type Description
index
String
Index name
collection
String
Collection name
document
Map<String, Object>
Document to validate

Returns #

Returns a boolean value set to true if the document is valid and false otherwise.

Usage #

Copied to clipboard!
Map<String, Object> document = new HashMap<>();
document.put("key", "value");
Boolean result = kuzzle
.getDocumentController()
.validate("nyc-open-data", "yellow-taxi", document)
.get();

::: ::: tab Kotlin

Copied to clipboard!
  fun validate(
      index: String,
      collection: String,
      document: Map<String, Any?>): CompletableFuture<Boolean>
Argument Type Description
index
String
Index name
collection
String
Collection name
document
Map<String, Any?>
Document to validate

Returns #

Returns a boolean value set to true if the document is valid and false otherwise.

Usage #

Copied to clipboard!
val document: Map<String, Any?> =
  HashMap<String, Any?>().apply {
    put("key", "value")
  }
val result: Boolean =
  kuzzle
    .documentController
    .validate("nyc-open-data", "yellow-taxi", document)
    .get()

::: ::::