Run this test:
composer testOnly ValidatorTest::test774RedundantErrorInValidationComponentsschemasanswerpropertiesiddollarrefThePropertyDollarrefIsRequired
{ | |
"openapi": "3.0.3", | |
"info": { | |
"title": "Test", | |
"version": "0.1.0" | |
}, | |
"paths": { | |
"/test": { | |
"get": { | |
"responses": { | |
"200": { | |
"description": "Test" | |
} | |
} | |
} | |
} | |
}, | |
"components": { | |
"schemas": { | |
"answer": { | |
"type": "object", | |
"properties": { | |
"id": { | |
"type": "integer", | |
"summary": "the summary" | |
} | |
} | |
} | |
} | |
} | |
} |
<?php | |
namespace JsonSchema\Tests; | |
use JsonSchema\Validator; | |
use PHPUnit\Framework\TestCase; | |
class ValidatorTest extends TestCase | |
{ | |
public function test774RedundantErrorInValidationComponentsschemasanswerpropertiesiddollarrefThePropertyDollarrefIsRequired() | |
{ | |
$data = json_decode('"42"'); | |
$schema = json_decode(file_get_contents(__DIR__ . '/774.json')); | |
$validator = new Validator(); | |
// $validator->validate($data, (object)['$ref' => 'file://' . dirname(__DIR__) . '/tests/774.json']); | |
$validator->validate($data, $schema); | |
$this->assertTrue($validator->getErrors()); | |
} |