Skip to content
This repository was archived by the owner on Apr 20, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Json/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ public function __construct($content)
$this->content = $this->decode((string) $content);
}

public function getContent()
{
return $this->content;
}

public function read($expression, PropertyAccessor $accessor)
{
if (is_array($this->content)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Json/JsonSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function resolve(RefResolver $resolver)

public function validate(Json $json, Validator $validator)
{
$validator->check($json, $this);
$validator->check($json->getContent(), $this->getContent());

if (!$validator->isValid()) {
$msg = "JSON does not validate. Violations:".PHP_EOL;
Expand Down
2 changes: 1 addition & 1 deletion tests/units/Json/JsonSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function test_should_validate_correct_json()
)
->mock($validator)
->call('check')
->withArguments($json, $schema)
->withArguments($json->getContent(), $schema->getContent())
->once()

->boolean($result)
Expand Down