Closed betzerra closed 8 months ago
hi, the error messages are not necessarily combined or separated by property, they are created with the context of particular validation check (mostly constraint keyword and related parts of value)
here is how this particular error is created: https://github.com/santhosh-tekuri/jsonschema/blob/v3.1.0/schema.go#L298
if len(s.Required) > 0 {
var missing []string
for _, pname := range s.Required {
if _, ok := v[pname]; !ok {
missing = append(missing, strconv.Quote(pname))
}
}
if len(missing) > 0 {
errors = append(errors, validationError("required", "missing properties: %s", strings.Join(missing, ", ")))
}
}
It seems there is no easy way to customize that.
Thank you for your answer. Helped me a lot :-)
Hi! I'm trying to build a custom error middleware and I noticed that I'm getting some validation errors squashed into one item.
I got:
while I was expecting:
when calling
Fields()
. Is that something I could easily override or setup?