Fugue.AWS.Internal.Validation

Module Members

allEqual

(Function)

Type Signature

 fun (List<a>) -> Bool
Argument: items
Type: List<a>
Returns:
Type: Bool

listLenValidator

(Function)

Construct a validation function to verify the length of a list is within the provided bounds.

Example usage:

validateFoo: listLenValidator {field: "foo", min: 1, max: 10}
validateFoo([]) # => Fail("foo must be between 1 and 10 characters in length")

Type Signature

 fun { field: String,
       min: Int,
       max: Int} -> fun (Optional<List<a>>) -> Validation
Argument: field

The name of the field being validated. Used to customize the error message for invalid lists.

Type: String

Argument: min

The minimum length of the target list.

Type: Int

Argument: max

The maximum length of the target list.

Type: Int

Returns:
Type: fun ( Optional<List<a>>) -> Validation

nonNegativeValidator

(Function)

Construct a validation function to verify that an int is non-negative.

Example usage:

validateBar: nonNegativeValidator("bar")
validateBar(-1) # => Fail("bar must be non-negative")

Type Signature

 fun (String) -> fun (Int) -> Validation
Argument: field

The name of the field being validated. Used to customize the error message for invalid ints.

Type: String

Returns:
Type: fun ( Int) -> Validation

runValidations

(Function)

Type Signature

 fun { prefix: Optional<String>,
       validations: List<Validation> } -> 0-tuple
Argument: prefix
Type: Optional<String>
Argument: validations
Type: List<Validation>
Returns:
Type: 0-tuple

strLenValidator

(Function)

Construct a validation function to verify the length of a string is within the provided bounds.

Example usage:

validateFoo: strLenValidator {field: "foo", min: 1, max: 10}
validateFoo(11) # => Fail("foo must be between 1 and 10 characters in length")

Type Signature

 fun { field: String,
       min: Int,
       max: Int} -> fun (Optional<String>) -> Validation
Argument: field

The name of the field being validated. Used to customize the error message for invalid strings.

Type: String

Argument: min

The minimum length of the target string.

Type: Int

Argument: max

The maximum length of the target string.

Type: Int

Returns:
Type: fun ( Optional<String>) -> Validation