SDK
SDK Java v3.x
2

This SDK is deprecated. We recommend to use the Kuzzle SDK-JVM.
A migration guide is available here

validateSpecifications #

The validateSpecifications method checks if a validation specification is well formatted. It does not store or modify the existing specification.

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


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

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

specifications #

A ConcurrentHashMap<String, Object> representing the specifications.

This object must follow the Specification Structure.

Returns #

Returns a ConcurrentHashMap<String, Object> which contains information about the specifications validity.

It contains the following properties:

Property Type Description
valid
Boolean
Specifications validity
details ArrayList<String> Specifications errors
description
String
Global description of errors

Usage #

Copied to clipboard!
ConcurrentHashMap<String, Object> specifications = new ConcurrentHashMap<>();
ConcurrentHashMap<String, Object> fields = new ConcurrentHashMap<>();
ConcurrentHashMap<String, Object> license = new ConcurrentHashMap<>();
specifications.put("strict", false);
license.put("mandatory", true);
license.put("type", "symbol"); // type 'symbol' is not a recognized type
fields.put("license", license);
specifications.put("fields", fields);
ConcurrentHashMap<String, Object> result = kuzzle
  .getCollectionController()
  .validateSpecifications("nyc-open-data", "yellow-taxi", specifications)
  .get();
/*
  {
    valid=false,
    details=[
      "In nyc-open-data.yellow-taxi.license: symbol is not a recognized type."
    ],
    description="Some errors with provided specifications."
  }
*/