I have written a custom validator that extends Zend\Validator\AbstractValidator
that is meant to check a field in my Apigility based REST API. I've been digging through documentation and examples and I have yet to see an example of this being done.
Within my module.config.php
I have added it to the field under the validator within input_filter_specs
. Like so:
...
'input_filter_specs' => [
'Application\\V1\\Rest\\Class\\Validator' => [
[
'type' => 'Float',
'required' => true,
'validators' => [
'name' => 'Zend\\I18n\\Validator\\IsFloat',
'options' => [],
],
'filters' => [],
'name' => 'aFloatParameter',
'description' => 'Float based parameter',
],
[
'type' => 'String',
'required' => false,
'validators' => [
'name' => 'Application\\Validator\\CustomValidator',
'options' => [],
],
'filters' => [],
'name' => 'parameterToValidate',
'description' => 'This is a parameter to be validator',
],
],
...
When I make the request the native Zend validators all work as expected but my custom validator class does not.
There are no errors, it just simply does not fire.
Can anyone help me figure out what I am missing? Do I need to register the validator somewhere else as well?
TIA