Manta Developers
GitHub
Menu

Validate

Check that staged rules can be evaluated.

What it is

Validation checks staged rules before they go live. Stage the change first. Commit does not run this check. Run it here so syntax and stratification errors are caught before the rules go live. You can also ask the agent to run the whole flow in chat.

A rule that feeds back into itself through an aggregate or a negation cannot be evaluated. This check lists those parts in nonStratifiableComponents.

Import

import { useValidateStagedRulesMutation } from "@manta-eu/client";
import { useMantaClient } from "@manta-eu/react/providers";

Example

const { mantaClient } = useMantaClient();
const validate = useValidateStagedRulesMutation(mantaClient);

const result = await validate.mutateAsync();

Request

A backend sends the same step as a GraphQL mutation. See calling Manta from a backend for the endpoint and authentication.

mutation {
  validateStagedRules {
    isValid
    isStratifiable
    syntaxErrors
    nonStratifiableComponents
    error
  }
}

ruleIris is optional. Pass it to check a subset of the staged rules. Omit it to check all of them.

Response

result.validateStagedRules returns isValid, isStratifiable, syntaxErrors, nonStratifiableComponents, and error. syntaxErrors lists syntax errors. nonStratifiableComponents lists the parts that cannot be evaluated. error is set when the check fails.