for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace JsonSchema\Keyword;
use JsonSchema\Property\PropertyInterface;
use Webmozart\Assert\Assert;
class PropertiesKeyword extends AbstractKeyword
{
const NAME = 'properties';
/**
* @param PropertyInterface[]|null $properties
*/
public function __construct(?array $properties)
if (null === $properties) {
null === $properties
false
parent::__construct(static::NAME, null);
return;
}
Assert::isNonEmptyList($properties);
Assert::allIsInstanceOf($properties, PropertyInterface::class);
$propertiesValue = [];
foreach ($properties as $property) {
$propertiesValue[$property->getName()] = $property->toJsonSchema();
parent::__construct(static::NAME, (object) $propertiesValue);