netceteragroup / valdr-bean-validation

Java Bean Validation plugin
MIT License
35 stars 21 forks source link

Allow configuration via JSON file #16

Closed philippd closed 10 years ago

philippd commented 10 years ago

The configuration of the scanned packages and custom validators would be easier to maintain and share between the CLI (used for example for Maven) and the servlet setup if it could be provided in a JSON file.

The default file that valdr reads could be a valdr.json file that's in the root of the classpath to make configuration even easier.

Example:

{
  packages: ['package.a', 'package.b'],
  validators: ['annotations.ConstraintA', 'annotations.ConstraintB']
}
marcelstoer commented 10 years ago

What about config options that are not shared between CLI and Servlet (e.g. corsAllowOriginPattern and -o)? Should they also be added to the config file? I guess yes...don't see a real problem with that.

Should the config file replace the existing individual parameters or be offered as an alternative? I'd prefer the first even though it'd be a breaking change.