for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace JsonSchema\Keyword;
use JsonSchema\Schema\SchemaInterface;
use Webmozart\Assert\Assert;
class OneOfKeyword extends AbstractKeyword
{
const NAME = 'oneOf';
/**
* @param SchemaInterface[]|null $oneOfs
*/
public function __construct(?array $oneOfs)
if (null === $oneOfs) {
null === $oneOfs
false
parent::__construct(static::NAME, null);
return;
}
Assert::isNonEmptyList($oneOfs);
Assert::allIsInstanceOf($oneOfs, SchemaInterface::class);
parent::__construct(static::NAME, array_map(
function (SchemaInterface $schemaMetadata) {
return $schemaMetadata->toJsonSchema();
},
$oneOfs
));