OptionalInputFilter does not contains set required method

I could not see any setIsRequired() method in the OptionalInputFilter object how can i set it as required ?

The input filter is called “Optional” why do you want to invert the functionality?

Please look at the last four code examples in the related documentation and if you do not want this then this kind of input filter is wrong for your use case.