Hi, yes you can create your own custom validators.  There is a Validator class 
that you can implement, and based on the validation chain, you can choose to 
allow (say a value is valid), reject, or pass on to the next in line.

Take a look at NumericValidator.java as an example, and configure custom 
validators by adding a configuration in your inflector.yaml:

inputValidators:
  # use your validator first
  - com.mypackage.CustomValidator
  # These are configured as the default validators.  Mix ‘n match
  - io.swagger.inflector.validators.DefaultValidator
  - io.swagger.inflector.validators.NumericValidator
  - io.swagger.inflector.validators.StringTypeValidator

The order in the array is the order of execution

> On Jul 14, 2016, at 4:28 PM, Abdullah Mourad <[email protected]> wrote:
> 
> I am new to using inflector and considering it for a project I am working on.
> 
> I am wondering if it is possible to implement any type of custom payload 
> validation using Swagger inflector? For example, let's say I want to validate 
> email addresses to a specific format, or more generally run a regex against a 
> string to see if it is valid or not. Is this possible and if so can anyone 
> point me to any examples?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Swagger" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to