private function buildParameterDefinition(ParameterBuilderInterface $builder): ParameterDefinition
    {
        $data = [
            'name' => $builder->getName(),
            'type' => $builder->getType(),
            'options' => $builder->getOptions(),
            'isRequired' => $builder->isRequired(),
            'defaultValue' => $builder->getDefaultValue(),
            'label' => $builder->getLabel(),
            'groups' => $builder->getGroups(),
            'constraints' => $builder->getConstraints(),
        ];

        // We build the sub parameters in order to lock the child builders
        $subParameters = $builder->buildParameterDefinitions();

        if (!$builder->getType() instanceof CompoundParameterTypeInterface) {
            return ParameterDefinition::fromArray($data);
        }

        $data['parameterDefinitions'] = $subParameters;

        return CompoundParameterDefinition::fromArray($data);
    }