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

Pass a "nested.property" to Validator.validateProperty #389

Closed
fkleuver opened this issue Nov 29, 2016 · 1 comment
Closed

Pass a "nested.property" to Validator.validateProperty #389

fkleuver opened this issue Nov 29, 2016 · 1 comment

Comments

@fkleuver
Copy link
Member

fkleuver commented Nov 29, 2016

I'm submitting a feature request

Current behavior:
Given a Rule with a nested property accessor (like "some.nested.property"), the accessor is treated as a single property rather than nested properties, e.g. obj["some.nested.property"]

Expected/desired behavior:
The property to be accessed like so: obj.some.nested.property

This is my proposed solution (line 108 for the function call; the function itself is at the bottom): https://github.com/fkleuver/validation/blob/master/src/implementation/standard-validator.ts

What is the motivation / use case for changing the behavior?
When dynamically generating validation rules from arbitrary JSON, it's not always possible/practical to stick to direct property accessors. It appears to be relatively simple to implement, but correct me if I'm overseeing something!

@jdanyow
Copy link
Contributor

jdanyow commented Nov 29, 2016

#283

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

No branches or pull requests

3 participants