-
-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parsers/resolvers get partial file URL for json-pointer refs #63
Comments
by the way, #47 seems interestingly aligned with my real use case. its resolution may render this issue redundant. |
Hi @eliranmal. Sorry for taking so long to respond. This behavior is by design. When a JSON Reference ( |
@BigstickCarpet - i get it, i thought it would be easier for my use-case if the hash was passed as well. i'll follow #47 and see if it matches my needs. thanx :) |
description
when a schema definition includes
$ref
s with (non-relative) json-pointer values, any parsers/resolvers hook functions (namely,read()
,parse()
,canRead()
andcanParse()
) are called with a file info object that has a partial URL."partial URL" here refers to the original json-pointer URI, stripped of its anchor segment, for example,
http:https://mydomain/schema#/inner
would becomehttp:https://mydomain/schema
.this behavior is the same for both
bundle()
anddereference()
(other API methods had not been tested).it makes handling of such json-pointer
$ref
s harder when writing custom resolvers/parsers (my use case is returning 'mock' or 'placeholder' schemas for some user defined$ref
matches in a generated bundle).steps to reproduce
create a schema definition with a json-pointer
$ref
, e.g.:implement any of the custom resolvers/parsers hook functions, and test the
file.url
value:see a runnable demo on runkit.
expected result
the file info object's
url
field should hold the$ref
value as found in the original schema definition.actual result
the file info object's
url
field hold a partial value, in case of json-pointer URI values - the anchor segment is stripped out.workarounds
i think one can retrieve the last value ofapparently, this approach doesn't work;parser.$refs.paths()
and have the full URL for a specific invocation ofparse()
,canRead()
etc., but that's quite brittle - as the$refs.paths()
API may change in future versions, and also not very pure (in a FP sense).i haven't tested this approach, though.
parser.$refs.paths()
returns the same stripped path.The text was updated successfully, but these errors were encountered: