function JsonSchemaTestTrait::doTestJsonSchemaIsValid
Same name and namespace in other branches
- 11.x core/modules/serialization/tests/src/Traits/JsonSchemaTestTrait.php \Drupal\Tests\serialization\Traits\JsonSchemaTestTrait::doTestJsonSchemaIsValid()
Validate the normalizer's JSON schema.
Parameters
mixed $type: Object/type being normalized.
bool $accept_no_schema_type: Whether to accept a schema with no meaningful type.
Return value
array Schema, so later tests can avoid retrieving it again.
File
-
core/
modules/ serialization/ tests/ src/ Traits/ JsonSchemaTestTrait.php, line 98
Class
- JsonSchemaTestTrait
- Trait for testing JSON Schema validity and fit to sample data.
Namespace
Drupal\Tests\serialization\TraitsCode
public function doTestJsonSchemaIsValid(mixed $type, bool $accept_no_schema_type = FALSE) : array {
$defined_schema = $this->getNormalizer()
->normalize($type, 'json_schema');
$this->doCheckSchemaAgainstMetaSchema($defined_schema, $accept_no_schema_type);
return $defined_schema;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.