-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: add basic bracket notation support, accept path array #5068
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
Conversation
⚠️ No Changeset found
Latest commit: 7a3e972
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
✅ Deploy Preview for vee-validate-docs canceled.
|
🔎 Overview
This PR extends the current path syntax to allow for bracket notation.
The reasoning is to allow object keys that contains a "." (dot).
The current syntax only allow bracket notation for root level keys, but not for nested keys.
🤓 Code snippets/examples (if applicable)
✔ Issues affected
Possibly closes #4762 ?
Discussion
From my perspective, there are 2 possible solutions for this issue (both are not mutually exclusive)
Solution 1 - Extend path syntax
Advantage:
Disadvantage:
Example implementation (first commit in this PR): 7d3308f
Solution 2 - Accept array as path
Advantage:
Disadvantage:
Implementation: This PR (both solutions are present)
From my understading, this PR does not contain any breaking changes, so could be released as a minor update.
At least, all tests are passing, but maybe I'm missing something?.
Notes
I would be very interested on this solution since I do work with forms that have keys containing dots and they don't work with the current version of this library - not without a patch at least. But at the same time, I understand that this proposed feature has not been fully discussed, so there is a chance that this PR will not be accepted, which would be sad, since I believe this functionality should in one form or another be added. For this reason, I'm creating this PR as a draft.
I'm happy to further discuss the issue and to update the PR if spec modifications are needed.