SDK
SDK Jvm v1.x
2

updateSpecifications #

The updateSpecifications method allows you to create or update the validation specifications for a collection.

When the validation specification is not formatted correctly, a detailed error message is returned to help you to debug.


:::: tabs ::: tab Java

Arguments #

Copied to clipboard!
public CompletableFuture<Map<String, Object>> updateSpecifications(
      final String index,
      final String collection,
      final Map<String, Object> specifications)

Arguments Type Description
index
String
Index name
collection
String
Collection name
specifications
Map<String, Object>
Specifications to update

specifications #

A Map<String, Object> representing the specifications.

It must follow the Specification Structure.

Returns #

Returns a Map<String, Object> containing the specifications.

Usage #

Copied to clipboard!
Map<String, Object> specifications = new HashMap<>();
Map<String, Object> fields = new HashMap<>();
Map<String, Object> license = new HashMap<>();
specifications.put("strict", false);
license.put("mandatory", true);
license.put("type", "string");
fields.put("license", license);
specifications.put("fields", fields);
Map<String, Object> result = kuzzle
  .getCollectionController()
  .updateSpecifications("nyc-open-data", "yellow-taxi", specifications)
  .get();
/*
  {
    strict=false,
    fields={
      license={
        mandatory=true,
        type="string"
      }
      }
    }
 */

::: ::: tab Kotlin

Arguments #

Copied to clipboard!
fun updateSpecifications(
      index: String,
      collection: String,
      definition: Map<String, Any?>
      ): CompletableFuture<Map<String, Any?>>

Arguments Type Description
index
String
Index name
collection
String
Collection name
specifications
Map<String, Any?>
Specifications to update

specifications #

A Map<String, Any?> object representing the specifications.

It must follow the Specification Structure.

Returns #

Returns a Map<String, Any?> containing the specifications.

Usage #

Copied to clipboard!
val license: Map<String, Any?> =
HashMap<String, Any?>().apply {
  put("mandatory", true);
  put("type", "string");
};
val fields: Map<String, Any?> =
HashMap<String, Any?>().apply {
  put("license", license);
};
val specifications: Map<String, Any?> =
HashMap<String, Any?>().apply{
  put("strict", false);
  put("fields", fields);
};
val result: Map<String, Any?> = kuzzle
  .collectionController
  .updateSpecifications("nyc-open-data", "yellow-taxi", specifications)
  .get()
/*
  {
    strict=false,
    fields={
      license={
        mandatory=true,
        type="string"
      }
      }
    }
 */

::: ::::