Closed toni-moreno closed 7 years ago
When I'm defining an enum validation , I would like also give a default value.
SnmpDebug bool `xorm:"snmpdebug" binding:"Default(0);In(0,1)"`
but when omitting the "snmpdebug" parameter the following error is shown
[ { "fieldNames": [ "SnmpDebug" ], "classification": "InError", "message": "In" } ]
But I've set the Default value as 0, so validation has been done erroneously.
Hi, I think you should use OmitEmpty before other rules in this case: https://go-macaron.com/docs/middlewares/binding#validation-rules
OmitEmpty
When I'm defining an enum validation , I would like also give a default value.
but when omitting the "snmpdebug" parameter the following error is shown
But I've set the Default value as 0, so validation has been done erroneously.