-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Format function doesn't works for numbers #159
Comments
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. |
Perhaps adding a separate option for generic formats that would enable this behavior explicitly would be a non-dangerous path. |
This would be useful. At json-schema.org it says:
For what it's worth, AJV allows defining formats as an object with |
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
The text was updated successfully, but these errors were encountered: