Validation results
SingleValidationResult
When validating a value, the validateValue
method returns a SingleValidationResult
object. This object is an instance of a sealed class that can be either a SingleValidationSuccess
or a SingleValidationError
.
Example:
You can also use the isValid
property to check if the validation was successful:
SchemaValidationResult
When using the validateSchema
method on a Map
to validate a schema, the validateSchema
method returns a SchemaValidationResult
object. This object is an instance of a sealed class that can be either a SchemaValidationSuccess
or a SchemaValidationError
.
Example:
You can also use the isValid
property to check if the validation was successful:
When dealing with a SchemaValidationError
, you can use the getError()
method to get first the error message for a specific key or nested key using a dot-separated path. If there no errors for the specified key, it will return null
.