Input Validation


#1

Hi, I’m new here.

I want to validate that my input ‘formpago’ is one of those values. But send me unhandled. What am I doing wrong?
I leave you the image


#2

Hi @Josseling_Ubeda

Could you also provide the request json?

cc @rubenaeg


#3

I told him a synonym that has defined ‘formpago’ which is “una sola cuota” and apparently it recognizes it, because if you look at it, it identifies it as “al vencimiento”:

>>>>> Request - 2020-11-19T16:11:49.993Z
{
“responseId”: “2dcb4750-aa56-499f-a468-9238d853bd56-ce5e18e2”,
“queryResult”: {
“queryText”: “una sola cuota”,
“parameters”: {
“formapago”: “al vencimiento”
},
“allRequiredParamsPresent”: true,
“outputContexts”: [
{
“name”: “projects/aldeaglobalvoice-f5642/agent/sessions/ABwppHGGMH74shZexLQtZ09UgtIM43GNz1PIj6_YgKTyVYrvp3_0tNcyPd8DmVEOT9T6H8RoEOOs-6BEWe3S2neyPSEQVQ/contexts/actions_capability_media_response_audio”,
“parameters”: {
“formapago”: “al vencimiento”,
“formapago.original”: “una sola cuota”
}
},

However, it always tells me that it is a valid value, until it is a value that is inside the ValidValuesValidator array

<<<< Response - 2020-11-19T16:11:50.008Z
{
“fulfillmentText”: “Porfavor dime una forma de pago valida.”,
“end_interaction”: false,
“outputContexts”: [
{
“name”: “projects/aldeaglobalvoice-f5642/agent/sessions/ABwppHGGMH74shZexLQtZ09UgtIM43GNz1PIj6_YgKTyVYrvp3_0tNcyPd8DmVEOT9T6H8RoEOOs-6BEWe3S2neyPSEQVQ/contexts/_jovo_session_dognu”,
“lifespanCount”: 1,
“parameters”: {
“monto”: 1000,
“plazo”: 2,
“formapago”: “al vencimiento”
}
}
],
“payload”: {
“google”: {
“expectUserResponse”: true,
“richResponse”: {
“items”: [
{
“simpleResponse”: {
“ssml”: “Porfavor dime una forma de pago valida.”
}
}
]
},
“noInputPrompts”: [
{
“ssml”: “Porfavor dime una forma de pago valida.”
}
],
“userStorage”: “{“userId”:“b4994400-0af3-464c-9389-b1451dc0b2a8”}”
}
}
}

Here I show you the model that has defined the value and the synonyms. There it is “al vencimiento” and its synonym "una sola cuota"


#4

Hey @Josseling_Ubeda,

So if I understand problem correctly, you enter the value “una sola cuota” and expect the validation to succeed, because you defined it as a synonym to “al vencimiento”, which you provide to the ValidValuesValidator? Unfortunately, this is not how the ValidValuesValidator works. It only checks for the input value (“una sola cuota”), not the input key (“al vencimiento”). You could either provide the synonyms to the Validator as well, or create your own Validator, which checks for input keys instead.

You can find more about input validation here.


#5

Thank U! :slight_smile: