You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attempting to validate against a schema which extends another schema at say:
/path/to/abstract/schema.json
...throws a UriResolverException, stating that it's was unable to resolve the URI from base ''.
I'm not sure if I have to set a base somewhere, or if every schema requires an id (I see the code tries to use an id property as base if it's defined), but from my testing I can fix it by doing the following:
// src/JsonSchema/Uri/UriResolver.php:27publicfunctionparse($uri)
{
preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
$components = array();
if (5 < count($match)) {
$components = array(
'scheme' => empty($match[2]) ? 'file' : $match[2], // Default the scheme to file://'authority' => $match[4],
'path' => empty($match[5]) ? '/' : $match[5] // Default the path to /
);
}
if (7 < count($match)) {
$components['query'] = $match[7];
}
if (9 < count($match)) {
$components['fragment'] = $match[9];
}
return$components;
}
From what I can tell, when the resolve function is called with an empty base, then the condition on line 109 is met, causing the exception. This is because parsing the base (which in this case is empty) returns an empty path, meaning the number of basePathSegments will be zero.
The text was updated successfully, but these errors were encountered:
Attempting to validate against a schema which extends another schema at say:
...throws a UriResolverException, stating that it's was unable to resolve the URI from base ''.
I'm not sure if I have to set a base somewhere, or if every schema requires an id (I see the code tries to use an id property as base if it's defined), but from my testing I can fix it by doing the following:
From what I can tell, when the resolve function is called with an empty base, then the condition on line 109 is met, causing the exception. This is because parsing the base (which in this case is empty) returns an empty path, meaning the number of basePathSegments will be zero.
The text was updated successfully, but these errors were encountered: