7.1.1.2. Policy Implementation Function

Each policy ID has a corresponding policy implementation function that performs the validation. Functions take the following form:

function <name>(fullObject, value, params, propName) {	
	<implementation_logic>
}
        
fullObject is the full resource object that is supplied with the request.
value is the value of the property that is being validated.
params refers to the "params" array that is specified in the property's policy configuration.
propName is the name of the property that is being validated.

The following example shows the implementation function for the "required" policy.

function required(fullObject, value, params, propName) {
    if (value === undefined) {
        return [ { "policyRequirement" : "REQUIRED" } ];
    }
    return [];
}