Indication of position(line and column) in json-file, when the validation against json-schema fails #347
Unanswered
Omar-Medina
asked this question in
Q&A
Replies: 1 comment
-
With the latest version of nlohmann::json I don't know, but with versions I used heavily the file location information is lost after the json-file has been parsed. In other words, once you have your json-variable available the file location origin of this key cannot be retrieved any longer. Therefore the validator is unable to provide the file location if it encounters a validation failure. Maybe you could ask at nlohmann/json whether file locations can be retrieved after parsing. |
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
-
Hello dear json-schema-validator-team,
Is it possible to get the position (line and column) in a JSON file when validation against a JSON schema fails?
This can help pinpoint exactly where the error occurs, making it easier to troubleshoot and fix the input file.
I use the following versions:
Due to the following reasons:
the json-schema-validator-library reports for the json input
the next error message:
The indication of line and column will be helpfull for fixing the JSON-file .
By the way. the error reported by son-schema-validator-library is "for me" more understanble compared to other library for the same error (In this case were only 2 errors):
It will be great , that this information (position) is provided.
OR,
You can provide me information (code / function) how to extend/modify the code to get the possition.
I am aware, that the nLohmann library provides the position principle/usually in detected exceptions.
See: nlohmann/json#4649
By the way. Last but not least and Just for your information (I can try to fix that, if you provide a little information, where to start).
If the define JSON_DIAGNOSTICS is enabled ans set to 1, then the c++ linker reports the following message:
I use the TDM-GCC-64 compiler in windows environment
Also When the define JSON_DIAGNOSTICS is not enabled ( set to 0 ), then the c++ linker does not report any error.
Your library has been incredibly helpful, and I appreciate the hard work you put into it.
Omar
Beta Was this translation helpful? Give feedback.
All reactions