Liking cljdoc? Tell your friends :D

clojure-commons.validators


nonnegative-int?clj

(nonnegative-int? str-val)

Indicates whether or not the unparsed field value contains a nonnegative integer.

Parameters: str-val - the unparsed value

Returns: It returns true if str-val contains a 32-bit integer value that is zero or positive, otherwise it returns false.

Indicates whether or not the unparsed field value contains a nonnegative integer.

Parameters:
  str-val - the unparsed value

Returns:
  It returns true if str-val contains a 32-bit integer value that is zero or positive, otherwise
  it returns false.
sourceraw docstring

user-owns-app?clj

(user-owns-app? {:keys [email]} {:keys [integrator_email]})

Checks if the given user owns the given app, determined by comparing the user's email with the app's integrator_email.

Checks if the given user owns the given app, determined by comparing the user's email with the
app's integrator_email.
sourceraw docstring

validate-fieldclj

(validate-field field-name field-value)
(validate-field field-name field-value valid?)
source

validate-mapclj

(validate-map a-map func-map)
source

validate-query-paramsclj

(validate-query-params params validators)

Given a set of URL query parameters and a set of corresponding validation functions, this function first verifies that the query parameters are present, and then validates the values.

The validation map is a mapping of the parameter name to its validator. Each validator is a predicate that accepts the unparsed parameter value and returns whether or not the value is valid. The validation map serves a second purpose. It indicates whether or not the parameter is required. The presence of the parameter in the map indicates that it is required.

Parameters: params - the parameter map. It is a map of parameter names to their unparsed values. It should have the following form.

             {:<param-1> <value-1>
              :<param-2> <value-2>
              ...
              :<param-n> <value-n>}

validators - the validation map. It should have the following form.

             {:<param-1> <validator-1>
              :<param-2> <validator-2>
              ...
              :<param-n> <validator-n>}

           Each validator should be a function of the form (^Boolean [^String]).

Throws: If any of the parameters are missing, a map with the following fields is thrown.

:error_code - ERR_MISSING_QUERY_PARAMETER
:parameters - [a list of keys associated with the missing parameters]

If all of the parameters are present, but some of them have bad values, a map with the following fields is thrown.

:error_code - ERR_BAD_QUERY_PARAMETER
:parameters - The params map filtered for those parameters with bad values.
Given a set of URL query parameters and a set of corresponding validation functions, this
function first verifies that the query parameters are present, and then validates the values.

The validation map is a mapping of the parameter name to its validator. Each validator is a
predicate that accepts the unparsed parameter value and returns whether or not the value is
valid. The validation map serves a second purpose. It indicates whether or not the parameter is
required. The presence of the parameter in the map indicates that it is required.

Parameters:
  params     - the parameter map. It is a map of parameter names to their unparsed values. It
               should have the following form.

                 {:<param-1> <value-1>
                  :<param-2> <value-2>
                  ...
                  :<param-n> <value-n>}

  validators - the validation map. It should have the following form.

                 {:<param-1> <validator-1>
                  :<param-2> <validator-2>
                  ...
                  :<param-n> <validator-n>}

               Each validator should be a function of the form (^Boolean [^String]).

Throws:
  If any of the parameters are missing, a map with the following fields is thrown.

    :error_code - ERR_MISSING_QUERY_PARAMETER
    :parameters - [a list of keys associated with the missing parameters]

  If all of the parameters are present, but some of them have bad values, a map with the
  following fields is thrown.

    :error_code - ERR_BAD_QUERY_PARAMETER
    :parameters - The params map filtered for those parameters with bad values.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close