function JsonApiJsonSchemaTestTrait::getValidator
Get the JSON Schema Validator.
Override this method to add additional schema translations to the loader.
Return value
\JsonSchema\Validator Schema validator.
Overrides JsonSchemaTestTrait::getValidator
3 calls to JsonApiJsonSchemaTestTrait::getValidator()
- JsonApiTopLevelResourceNormalizerTest::testConfigEntityResourceObjectSchema in core/
modules/ jsonapi/ tests/ src/ Kernel/ Normalizer/ JsonApiTopLevelResourceNormalizerTest.php - Test the generated config resource object normalization against the schema.
- JsonApiTopLevelResourceNormalizerTest::testResourceObjectSchema in core/
modules/ jsonapi/ tests/ src/ Kernel/ Normalizer/ JsonApiTopLevelResourceNormalizerTest.php - Test the generated resource object normalization against the schema.
- JsonApiTopLevelResourceNormalizerTest::testTopLevelResourceWithSingleResource in core/
modules/ jsonapi/ tests/ src/ Kernel/ Normalizer/ JsonApiTopLevelResourceNormalizerTest.php - Tests the serialization of a top-level JSON:API document with a single resource.
File
-
core/
modules/ jsonapi/ tests/ src/ Traits/ JsonApiJsonSchemaTestTrait.php, line 33
Class
- JsonApiJsonSchemaTestTrait
- Support methods for testing JSON API schema.
Namespace
Drupal\Tests\jsonapi\TraitsCode
protected function getValidator() : Validator {
$uriRetriever = new UriRetriever();
$uriRetriever->setTranslation('|^' . JsonApiSpec::SUPPORTED_SPECIFICATION_JSON_SCHEMA . '#?|', sprintf('file://%s/schema.json', realpath(__DIR__ . '/../../..')));
return new Validator(new Factory(uriRetriever: $uriRetriever));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.