Filter XML for Input Array Values from Optional Input

I have a custom plugin with a filter which has two inputs, the second input is optional. I want to add a widget to select input arrays on the second optional input if it is present and need to write the XML for this.
Adding a StringVectorProperty as described in the docs (ParaView: Plugin Howto at Drop Down List with Values from Input Arrays) works only if both inputs are connected. If the optional input is empty I get a lot of Index out of range: 0 errors from vtkSMArrayListDomain. How I can tell the StringVectorProperty widget that the input is optional and may nothing is select?
I also tried to hide the widget based on the InputProperty state, but this XML leads to ProxyProperty not properly specified in XML.
<PropertyWidgetDecorator type="GenericDecorator" mode="visibility" property="Input1" value="1"/>

There is (sadly) no such thing as optional secondary inputs in ParaView.

But that part is actually working for a long time already:

this->SetNumberOfInputPorts(2);
int vtkFooBar::FillInputPortInformation(int port, vtkInformation* info) {
    if (port == 0) {
        info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkRectilinearGrid");
        return 1;
    }
    if (port == 1) {
        info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPolyData");
        info->Set(vtkAlgorithm::INPUT_IS_OPTIONAL(), 1);
        return 1;
    }
    return vtkDataSetAlgorithm::FillInputPortInformation(port, info);
}

I can then either connect or not connect the second input. Only part not working is using StringVectorProperty to select arrays on the optional input if nothing is connected.

Nevertheless, I think for my specific usecase I found a workaround. As I require the data arrays I want from different datasets to have the same size anyway I can just use the Append Attributes filter before my filter and then handle the data as additional optional arrays from a single input.

This is VTK, not ParaView.

Great that you found a solution.