Replies: 2 comments
-
|
Lets view that Json schema: And that Json that will be validated against schema Normally validator will say that "Invalid type. Expected Integer but got Boolean.", but user of the lib could wanted to fix that Json. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks. Regarding error translation, long term I'd like to move away from error messages hard coded in C++ source code to parameterized messages in resource files, like networknt/json-schema-validator does with message properties. I like the idea of supporting user augmented json patches in custom reporters to fix the validating object. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Add to the Json-schema validator custom reporters:
json-patches- allows users to take action on an error by providing a Json Patcherror type (enum class)indicates the exact type of error that occurred, making it easy to identify what happened.optional<Json> objInfo1/2/3- contain contextual information about the error. For example, for an error like"Wrong field type XXX", whereobjInfo1will be "field name",objInfo2- "expected type name",objInfo3- "current type name". It will depend fully on the (2) error type enum-class. (of course docs will tell about it)json_schema_fragment- the specific part of the Json Schema where the problem occurred.report->SetError(false/true);- to be able mark that problem as not an errorReplaceable error text- allows the user to customize the error message, for example, to translate it into another languagevalidating object json path- shows the path within the object being validated where the problem occurredjson schema path- for showing path to the checking part of the schemaThat idea allows users to do such thing:
Raw execution of that idea: #677
Beta Was this translation helpful? Give feedback.
All reactions