public function merge(JsonSchema $left, JsonSchema $right)
    {
        $merged = clone $right;

        if ($left->getType() !== null && $right->getType() !== null && $left->getType() !== $right->getType()) {
            throw new \RuntimeException("Both types are defined and different, merge is not possible");
        }

        if ($right->getType() === null && $left->getType() !== null) {
            $merged->setType($left->getType());
        }

        $merged->setProperties($this->arrayMerge($left->getProperties(), $right->getProperties()));
        $merged->setRequired($this->arrayUnique($this->arrayMerge($left->getRequired(), $right->getRequired())));

        return $merged;
    }