You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
but my API produces an error like this
"code": "99",
"message": "Validation Error",
"data": {
"NIK": "Key: 'CreateKtpRequest.NIK' Error:Field validation for 'NIK' failed on the 'unique' tag"
}
I have made sure that the data I entered is not duplicated, all tag working normal except unique tag
The text was updated successfully, but these errors were encountered:
The unique validation tag is designed for arrays, slices, and maps - not for single string fields.
Since NIK is a string, the unique=NIK validation does not work as expected.
For arrays & slices, unique will ensure that there are no duplicates. For maps, unique will ensure that there are no duplicate values.
For slices of struct, unique will ensure that there are no duplicate values in a field of the struct specified via a parameter.
i create request and using validator like this :
but my API produces an error like this
"code": "99",
"message": "Validation Error",
"data": {
"NIK": "Key: 'CreateKtpRequest.NIK' Error:Field validation for 'NIK' failed on the 'unique' tag"
}
I have made sure that the data I entered is not duplicated, all tag working normal except unique tag
The text was updated successfully, but these errors were encountered: