SDK
SDK C# v1.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.

ValidateSpecificationsAsync #

The validateSpecifications method checks if validation specifications are well-formed. It does not store nor modify the existing specifications.

If the validation specifications are not formatted correctly, a detailed error message is returned to help with debugging.

Arguments #

Copied to clipboard!
public async Task<bool> ValidateSpecificationsAsync(JObject specifications);
Argument Type Description
specifications
JObject
JObject representating the specifications to validate

specifications #

A JObject representing the specifications to validate.

The JObject data must follow the Specifications Structure:

Copied to clipboard!
{
  "strict": "true",
  "fields": {
    "licence": {
      "mandatory": true,
      "type": "string"
    }
    // ... specification for each field
  }
}

Return #

A boolean telling whether the provided specifications are valid.

Usage #

Copied to clipboard!
try {
  JObject specifications = JObject.Parse(@"{
    strict: false,
    fields: {
      license: {
        mandatory: true,
        type: 'string'
      }
    }
  }");
  bool validation_response =
    await kuzzle.Collection.ValidateSpecificationsAsync(
      specifications
    );
  Console.WriteLine("Success");
} catch (Exception e) {
  Console.WriteLine(e);
}