jonasschmidt / ex_json_schema

An Elixir JSON Schema validator
MIT License
366 stars 98 forks source link

Error line number #79

Open vishal-h opened 2 years ago

vishal-h commented 2 years ago

Is it possible to add the line number at which the error occurred? Is there a setting perhaps?

Something similar to https://www.jsonschemavalidator.net/. It highlights the line at which the error has occurred.

jonasschmidt commented 2 years ago

Phew, I don't have any idea how we could support that. The line number is the line in a JSON file, and this library doesn't even deal with files. It get the parsed JSON, so Elixir/Erlang terms. And I think the JSON library would have to support this somehow, it would have to annotate every piece of data with the line numbers it was read from, I don't know of any Elixir JSON parser that can do that. Also, in most cases the JSON doesn't even have lines when it comes from an API and has no line breaks.