ValidatorObject

Parse.Cloud. ValidatorObject

Properties:
Properties
Name Type Description
requireUser Boolean

whether the cloud trigger requires a user.

requireMaster Boolean

whether the cloud trigger requires a master key.

validateMasterKey Boolean

whether the validator should run if masterKey is provided. Defaults to false.

skipWithMasterKey Boolean

whether the cloud code function should be ignored using a masterKey.

requireUserKeys Array.<String> | Object

If set, keys required on request.user to make the request.

Properties
Name Type Description
field String

If requireUserKeys is an object, name of field to validate on request user

Name Type Description
options Array | function | Any

array of options that the field can be, function to validate field, or single value. Throw an error if value is invalid.

error String

custom error message if field is invalid.

requireAnyUserRoles Array.<String> | function

If set, request.user has to be part of at least one roles name to make the request. If set to a function, function must return role names.

requireAllUserRoles Array.<String> | function

If set, request.user has to be part all roles name to make the request. If set to a function, function must return role names.

fields Object | Array.<String>

if an array of strings, validator will look for keys in request.params, and throw if not provided. If Object, fields to validate. If the trigger is a cloud function, request.params will be validated, otherwise request.object.

Properties
Properties
Name Type Description
field String

name of field to validate.

Name Type Description
type String

expected type of data for field.

constant Boolean

whether the field can be modified on the object.

default Any

default value if field is null, or initial value constant is true.

options Array | function | Any

array of options that the field can be, function to validate field, or single value. Throw an error if value is invalid.

error String

custom error message if field is invalid.