How To: Configure user-defined numeric parameter¶
In this example, we configure a numeric parameter. This parameter accepts only integer values and allows values between 9 and 99 (non-inclusive). If the request includes anything other than an integer, it will trigger the VIOL_PARAMETER_DATA_TYPE
violation. If the parameter value falls beyond or below the desired values, it will trigger the VIOL_PARAMETER_NUMERIC_VALUE
violation. Note that if you change the values of exclusiveMin
and exclusiveMax
to false, values equal to the boundary values will be accepted (namely 9 and 99).
{
"policy": {
"name": "user_defined_parameters_data_types",
"template": {
"name": "POLICY_TEMPLATE_RATING_BASED"
},
"applicationLanguage": "utf-8",
"enforcementMode": "blocking",
"blocking-settings": {
"violations": [
{
"name": "VIOL_PARAMETER_NUMERIC_VALUE",
"alarm": true,
"block": true
},
{
"name": "VIOL_PARAMETER_VALUE_LENGTH",
"alarm": true,
"block": true
},
{
"name": "VIOL_PARAMETER_STATIC_VALUE",
"alarm": true,
"block": true
},
{
"name": "VIOL_PARAMETER_DATA_TYPE",
"alarm": true,
"block": true
}
]
},
"parameters": [
{
"name": "number",
"type": "explicit",
"parameterLocation": "any",
"mandatory": false,
"allowEmptyValue": false,
"allowRepeatedParameterName": false,
"sensitiveParameter": false,
"valueType": "user-input",
"dataType": "integer",
"checkMinValue": true,
"checkMaxValue": true,
"minimumValue": 9,
"maximumValue": 99,
"exclusiveMin": true,
"exclusiveMax": true
}
]
}
}