`#` is a valid JSON Pointer (and JSON Reference)
brettz9 opened this issue · comments
The message "ptr must be a JSON Pointer: ptr must start with a / or #/" is reported when a JSON reference refers to just "#".
However, per https://tools.ietf.org/html/rfc6901#section-6 , #
is a valid pointer (to the whole document).
(And FWIW, JSON Schema uses such JSON references in its metaschemas.)
We do support #
as a valid JSON Pointer so is this just about the error message?
Apologies, on testing now, I can't replicate--but in any case, the message should instead say "must start with a / or #", no?
Yup, I'm in agreement. It's really /
, #
or #/
. We don't support #something
for example.
Yeah. The https://tools.ietf.org/html/rfc6901#section-3 doesn't even seem to allow #
by itself, but again, it is indicated in other sections (and used in other specs).
https://tools.ietf.org/html/rfc6901#section-6 documents the fragment-style, and #
is clearly marked as referencing the whole document, or the root.
Yes--I was just saying section 3 seemed inadequate, but I agree.
I am closing this since it appears json-refs
is doing the right thing. Feel free to reopen if I'm wrong.
Maybe just if you want to fix the error message to include "#" as that threw me off a little at first...
I think I'm misunderstanding. You said you couldn't reproduce it so what error message are you referring? Since #
is a valid JSON Reference, you'd never get an error message for it where #
would need to be explicitly mentioned in the invalid JSON Reference error message.
I just mean if you're informing people that "ptr must start with a / or #/"", it is a little more friendly not to confuse matters by implying that a pointer cannot start with a #
. But not a big deal...
I get it. I just figured /
and #
were implied and that I needed only to mention the requirements assuming those were already met.