public function onPreDeserialize(PreDeserializeEvent $event)
    {
        $class = $event->getType()['name'];

        if (!class_exists($class)) {
            return; // skip custom JMS types
        }

        $data   = $event->getData();
        $object = new \ReflectionClass($class);

        $discriminator = $this->reader->getClassAnnotation($object, Discriminator::class);

        if ($discriminator) {
            $event->setType($discriminator->getClass($data));
        }
    }