mirror of
https://github.com/justinrainbow/json-schema.git
synced 2025-05-03 04:48:11 +02:00
Merge pull request #152 from alecsammon/refArrayJson
Fetching JSON Array from URI
This commit is contained in:
commit
c76301b61e
@ -150,7 +150,10 @@ class UriRetriever
|
||||
|
||||
// Use the JSON pointer if specified
|
||||
$jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
|
||||
$jsonSchema->id = $resolvedUri;
|
||||
|
||||
if ($jsonSchema instanceof \stdClass) {
|
||||
$jsonSchema->id = $resolvedUri;
|
||||
}
|
||||
|
||||
return $jsonSchema;
|
||||
}
|
||||
|
@ -287,6 +287,25 @@ JSN
|
||||
);
|
||||
}
|
||||
|
||||
public function testFetchRefArray()
|
||||
{
|
||||
$retr = new \JsonSchema\Uri\Retrievers\PredefinedArray(
|
||||
array(
|
||||
'http://example.org/array' => <<<JSN
|
||||
[1,2,3]
|
||||
JSN
|
||||
)
|
||||
);
|
||||
|
||||
$res = new \JsonSchema\RefResolver();
|
||||
$res->getUriRetriever()->setUriRetriever($retr);
|
||||
|
||||
$this->assertEquals(
|
||||
array(1, 2, 3),
|
||||
$res->fetchRef('http://example.org/array', 'http://example.org/array')
|
||||
);
|
||||
}
|
||||
|
||||
public function testSetGetUriRetriever()
|
||||
{
|
||||
$retriever = new \JsonSchema\Uri\UriRetriever;
|
||||
|
Loading…
x
Reference in New Issue
Block a user