Validating input arguments from Hyperlambda

This project contains input validators for Magic. More specifically it contains the following slots.

All of the above slots takes an expression, or values, as its main input, and will throw exceptions if their input expression’s value(s), or its value, does not follow the rules specified by the validator. This makes them perfect fits for “intercepting” the input specified to an HTTP REST endpoint, to verify the input data conforms to some sort of predefined validation scheme.



Most validators requires some sort of argument(s), such as you can see above in the integer validator - However, some of these validators are without arguments, such as the email validator, that simply verifies the input is a valid email address. To use the [validators.regex] validator, you should probably learn regular expression. However, this is beyond the scope of this article.

Notice - No attempt to invoke the type validator logic will be done unless the value is a non null value. If you want to enforce such logic, you’ll have to combine the specific type validators with the [validators.mandatory] validator, which enforces that a value must be specified and be non null.


You can use one invocation to any of the validators to validate multiple nodes, such as the following illustrates.

      // Throws if you remove the "."


First the above expression will be evaluated, then every resulting value will be validated, and if any of them are not validated according to the validtor’s arguments - Which for the above example is number between 5 and 10 - The validater will throw an exception, providing the invalid value, and the name of the last iterator (effectively being the argument name) to the caller. This allows you to use one single validator to validate multiple arguments, such as the above illustrates. This might be useful if you for instance have an endpoint accepting multiple address fields, and zip code is a mandatory argument, and it needs to be an integer with a [max] and [min] value.

Project website

The source code for this repository can be found at, and you can provide feedback, provide bug reports, etc at the same place.

Quality gates