Replies: 2 comments 1 reply
-
I am not aware of a way to pass custom errors on JSON Schema specification. Is there a case beyond regex format validation that we would need a custom message? |
Beta Was this translation helpful? Give feedback.
1 reply
-
I second this. It would be great to customise the error message, especially for pattern-mismatch errors. I found this: https://stackoverflow.com/a/45202473/5056599, unsure if we could use a similar structure. I just realised that this can be achieved with "date_published": {
"title": "Date of publication of the dataset",
"description": "Date when the article was published.",
"pattern": "(^\\d\\d\\d\\d\\-\\d\\d\\-\\d\\d$)|(^\\d{4}$)",
"errorMessage": "Correct format of date_published is YYYY-MM-DD or YYYY.",
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm working on writing a JSON schema for my company's metadata files and I'm loving the extension and how it enforces the schema. One issue I'm encountering though is that the error messages for the properties are not very helpful (I'd prefer a message like "Name cannot be null"):
That is a very simple, unimportant example but it becomes much more needed when the errors are the result of failures associated with regex patterns:
I am new to JSON schemas, so its very possible I've just overlooked how to properly configure them to be surfaced by the extension, but the few things I've tried that were suggested online don't seem to be captured and surfaced by the extension.
Does the extension support custom error messages within a JSON schema?
Beta Was this translation helpful? Give feedback.
All reactions