Parse.Cloud. ValidatorObject

Properties
NameTypeDescription
requireUserBoolean

whether the cloud trigger requires a user.

requireMasterBoolean

whether the cloud trigger requires a master key.

validateMasterKeyBoolean

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

skipWithMasterKeyBoolean

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

requireUserKeysArray.<String> | Object

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

Properties
NameTypeDescription
fieldString

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

Properties
NameTypeDescription
optionsArray | function | Any

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

errorString

custom error message if field is invalid.

requireAnyUserRolesArray.<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.

requireAllUserRolesArray.<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.

fieldsObject | 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
NameTypeDescription
fieldString

name of field to validate.

Properties
NameTypeDescription
typeString

expected type of data for field.

constantBoolean

whether the field can be modified on the object.

defaultAny

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

optionsArray | function | Any

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

errorString

custom error message if field is invalid.