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 #
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:
{
"strict": "true",
"fields": {
"licence": {
"mandatory": true,
"type": "string"
}
// ... specification for each field
}
}
Return #
A boolean telling whether the provided specifications are valid.
Usage #
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);
}
Edit this page on Github(opens new window)