netceteragroup / valdr-bean-validation

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

Add support for selecting simple (default) or full type names #26

Closed robert-iddink closed 9 years ago

buildhive commented 9 years ago

Netcetera » valdr-bean-validation #100 SUCCESS This pull request looks good (what's this?)

coveralls commented 9 years ago

Coverage Status

Coverage increased (+0.06%) to 90.67% when pulling 6f964e7c8318771ab894e1d51ec1c5718b47d33b on Arzie:master into c9fc45cea850e36562ceef69f598701b2e5ce4c0 on netceteragroup:master.

marcelstoer commented 9 years ago

@philippd what's your take on this? We've been using the class' simple name on purpose because we want to "encourage" people to use unique names for their entities/model classes. One shouldn't have two Person model classes in two different packages.

robert-iddink commented 9 years ago

@marcelstoer How about two Name classes in different packages? That's our use case at the moment ;-).

philippd commented 9 years ago

This should work fine. The only thing to keep in mind is to always use the fully qualified class name in the valdr-type directive when this option is enabled.

marcelstoer commented 9 years ago

This should work fine.

Yes, it will work. I'm just not sure whether we should offer that option at all? IIRC we've been discussing this before during the initial implementation. It's irrelevant whether your model class is a Person or a Name (even though it's semantically more generic) it's IMO still bad practice.

My point essentially is about how restrictive the project should be in enforcing what we consider good or bad practice.

philippd commented 9 years ago

Yes we discussed it back then and decided to use the simple name to encourage best practices and keep the names in the markup short.

IMO it's fine to add the option as long as the default is to use the simple name. This way we still encourage to use what we consider good practice, but also support cases where someone might not be able to avoid having two classes with the same name (3rd party code).

robert-iddink commented 9 years ago

I could add a comment to make it explicit that the simple name is the suggested usage, would that help?