Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support validation annotations on properties #14

Closed
ljacqu opened this issue Sep 10, 2016 · 1 comment
Closed

Support validation annotations on properties #14

ljacqu opened this issue Sep 10, 2016 · 1 comment
Labels

Comments

@ljacqu
Copy link
Member

ljacqu commented Sep 10, 2016

Proposition:
Allow other annotations to define certain constraints, e.g. only positive numbers. Maybe we can have some implementations already for some of http://docs.oracle.com/javaee/6/api/javax/validation/constraints/package-summary.html

@ljacqu
Copy link
Member Author

ljacqu commented Aug 11, 2019

Closing as wontfix as it's easier to have validation in a PropertyType or Property implementation that discards the value of the YML if it's invalid so that ConfigMe uses the default, e.g. if we only allowed positive numbers a type impl could easily call reader#getInt and then still return null from BaseProperty#getFromReader if the value is <= 0, for example.
I think this keeps everything clearer and doesn't add an additional layer of complexity that one must keep in mind.
I'm not sure if I rather had bean properties in mind while writing this but there also I think writing some sort of validator class by hand and calling it is sufficient.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Development

No branches or pull requests

1 participant