Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Global validators are very restrictive, please support an alternative #26

Open
fejesjoco opened this issue Oct 2, 2016 · 1 comment

Comments

@fejesjoco
Copy link

Validators are registered into a global namespace with iron-meta. This is very restrictive.

Eg. consider I want to implement a date validator that takes a format string as an argument. But validators have to be stateless basically. If you register this validator with different settings but the same name, only the last applied setting will take effect. The caller would have to remember to always use a different name for different instances. But that is complicated and error prone.

Or, in a big application, different validators with the same name might get registered and that would lead to strange errors. It may even be very hard to solve if 3rd party libraries are involved.

One way to solve this would be component-scoped validator registration. This even fits better with the web component paradigm. Additionally, it would be nice to support binding a validator function, instead of a name, directly into iron-validatable-behavior. This skips the entire registration problem, but doesn't solve it of course.

@sebs
Copy link

sebs commented Apr 10, 2018

Yes, actually it seems you can only use the tag name as a reference? The docs state otherwise.

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

No branches or pull requests

2 participants