santhosh-tekuri/jsonschema

Feature request: JSON error offset in ValidationError

Closed this issue · 2 comments

It would be amazing to be able to give feedback to the enduser where their JSON input failed to validate against the schema, so I guess an Offset field similiar to the field in json.SyntaxError would be great.

during validation, we get the json-path at which validation has failed.

computing offset for given json-path is not trivial.

also we support validation given map:
func (s *Schema) ValidateInterface(doc interface{}) (err error)
in this case offset field does not make sense

WON'T FIX

json parser in std library does not provide offset for json tokens.
so it is not trivial supporting this