Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Need support for Polymorphism #70

Open
twicksell opened this issue Jun 13, 2014 · 1 comment
Open

Need support for Polymorphism #70

twicksell opened this issue Jun 13, 2014 · 1 comment

Comments

@twicksell
Copy link
Member

Person has List. Pet is an abstract class. Dog is a pet. Dog has a field called smelly. Cat is a pet. Cat has a field called douchey.

Rule for Person:
pets.douchey, Rules.required

Blows up because on fail-fast field validation it can't find the field douchey on abstract class Pet.

Expected behavior for fail-fast:
Check for all implementations of Pet, see if at least one of them has field douchey. If so, move along, else, throw error.

Expected behavior of rule validation:
When executing rule against path, make sure object has instance of field. If field not present (because no instanceof Cat), move along, else validate. Might need some configurability for this if people really did want to error on the field not being present, but I doubt it.

@cduplichien
Copy link
Member

"Check for all implementations of Pet, see if at least one of them has field douchey. If so, move along, else, throw error."
Do you mean all implementations of Pet with rules configured? What if you haven't configured rules for Cat because you just want to apply rules to Pet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants