Closed mitar closed 7 years ago
Fixed a couple of issues you noted. Getting line/column or JSON pointer not really feasible, as first pass turns JSON into Ruby representation and such information is not available. Constructing a JSON pointer could be possible, but not something I have time to tackle.
Hm, does this addresses that the output is Error in -stdin-
despite me passing a filename in?
Yes, the problem is that remote files are loaded using something other than File.open
, so path
was not an accessor. It no uses either requested_url
, or base_uri
, depending.
Oh, I understand, that error is not coming from some other remote file and not in.json
?
In this case, the error comes form a context definition for the term B
, which is inline (there is no remote context). As mentioned, the use of JSON-LD 1.1 features requires announcement, typically using the @version
property in the context. The updated error message attempts to clarify this.
The filename is reported based on that passed in, not one found through context resolution. In a perfect world, the exception would record the context URL used to resolve the issue, but it's not currently available. But, with knowledge of what term it is that's causing the problem, it should be straightforward to track it down.
Good error reporting is about the most difficult thing of all. And, I need to leave something for other contributors to do 😄; that's the beauty of open-source.
:-)
Thanks for all the explanation and all the work. :-) All this really looks amazing already.
I run the program:
I would expect that the error was
Error in in.json
. Hopefully maybe even the file line and column in which the error happens (or JSON path/pointer or something). It might be that there are multiple@context
s present in a file. From the error message it is hard to kw which one is a problem.