Open brettz9 opened 3 months ago
Hi, I'm not sure I understand the problem: can you provide an example?
Maybe I am mistaken, but shouldn't the fragments such as listed at https://datatracker.ietf.org/doc/html/rfc6901#section-6 work, e.g., pointer({abc: true}, '#/abc')
?
The path in your example at https://github.com/vivocha/jsonref?tab=readme-ov-file#pointerdata-path--value suggests this form of fragment identifier should work (i.e., #/prop1/prop2
):
`path`, either a string (`#/prop1/prop2`) or an array of path components (`[ "#", "prop1", "prop2" ]`
This doesn't work currently because you have the following code in src/pointer.ts
:
const PREFIX_RE: RegExp = /^(0|[1-9][0-9]*?)([#]?)$/;
// ...
const match = prefix.match(PREFIX_RE);
if (!match) {
throw new SyntaxError(`Bad prefix ${prefix}`);
}
...and that regular expression, PREFIX-RE
will not allow #
at the beginning.
Hi,
Thanks for your library--it's working well for me.
Just a heads up though that although your README mentions use with the
#
character, as expected per the spec, the internalPREFIX_RE
regular expression doesn't allow such paths (it only allows a hash at the end).