- Notifications
You must be signed in to change notification settings - Fork909
Open
Labels
Description
Currently we usegithub.com/go-playground/validator/v10
inhttpapi.Read
. The downside of this is that our customer validators cannot return errors:
coder/coderd/httpapi/httpapi.go
Lines 38 to 46 inf1da2f1
nameValidator:=func(fl validator.FieldLevel)bool { | |
f:=fl.Field().Interface() | |
str,ok:=f.(string) | |
if!ok { | |
returnfalse | |
} | |
valid:=NameValid(str) | |
returnvalid==nil | |
} |
So the errors sent to the user are completely unhelpful aside from "This field is incorrect".
We should redo validation to allow for better errors.