Open avkos opened 1 year ago
Hm. While the specs say that built-in formats apply only to strings and ignore/always pass on non-string values, that doesn't necessary mean that custom formats should be only applicable to strings.
That means that changing the impl in a way that will attempt to run custom format validators on everything including non-strings is acceptable per spec.
That might cause backwards incompatibility though (and might be unexpected in some cases), so likely shouldn't be the default behavior, but rather an option.
Will work on this.
That said, the schema you provided looks problematic as it lacks type checks. I'll think if there could be a way to reduce the probability of mistakes here (though strong mode should help).
Perhaps adding a separate option for generic formats that would enable this behavior explicitly would be a non-dangerous path.
I want to use the custom format function, but it doesn't call if the data has a number type.
example:
Expect behavior: Formats works for numbers and any other types