broadinstitute / barclay

Command line argument parser and online documentation generation utilities for java command line programs.
BSD 3-Clause "New" or "Revised" License
8 stars 6 forks source link

Proposal: use java bean validation (JSR 380) for constraint arguments #134

Open magicDGS opened 6 years ago

magicDGS commented 6 years ago

Because barclay already use annotations for the main functionality of parsing and documenting, I think that a flexible way to validate arguments on the command line will be to use bean validation. This allow to annotate arguments as, for example, @PositiveOrZero to constraint an argument to be on that range. In addition, it allows to use custom annotations for downstream projects to add more customization for custom classes (I am thinking about the new URI class in GATK).

What do you think, @cmnbroad?

More information about bean validation in http://beanvalidation.org/

cmnbroad commented 6 years ago

@magicDGS I'll take a look at the spec and let you know what I think.

cmnbroad commented 6 years ago

@magicDGS I took a quick look - I'm not sure I'd want to integrate this directly into Barclay, but I would like Barclay to be flexible enough that something like this could be integrated by consumers like you that want to use it. It would be interesting to know if the refactoring PR moves us closer to making that possible.