-
-
Notifications
You must be signed in to change notification settings - Fork 141
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
WIP: Support nested keys #140
Conversation
@poteto Do you have an ETA on when this will get merged ? |
Sorry for the delay! Will get this over the line shortly. |
Hi @poteto , what about this PR? |
Hi there! Just ran into needing this as well. Is there a relevant workaround available? |
@poteto Ran into this use case today, any idea when this could be merged? Glad to help with any work that may be needed. |
Sorry, work keeps getting in the way :( If someone would like to help me get this over the line I would be very grateful! This is how I'm thinking this feature will be implemented:
|
@poteto I'll take a look at this tonight and see where I get. The work should be based on what you already have here in the |
Yup! |
Update: It seems changeset relies on the As a baseline first test I have the following: set(dummyModel, 'contact', { phoneNumber: 1112223333 });
let expectedResult = [ { key: 'contact', value: { phoneNumber: 9998887777 } } ];
let dummyChangeset = new Changeset(dummyModel);
dummyChangeset.set('contact.phoneNumber', 9998887777);
assert.deepEqual(get(dummyChangeset, 'changes'), expectedResult, 'precondition')); |
be45426
to
9c05fda
Compare
I had another go at it with some inspiration from @jgwhite. However there are still some weird issues I'm trying to figure out
If anyone has any clues, please let me know... |
9c05fda
to
052968c
Compare
Inspiration from @jgwhite
052968c
to
2492bbf
Compare
hey @poteto, I'm trying to work on the points you wrote above. We would love to have nested validations in our application for a few "interesting" forms. Are you committed to having this structure for the validations? {
name: validateWhatever(),
"address.street_name": validateWhatever()
} It seems at the moment you can't access keys that contain dots within ember objects, so accessing the validator function is tricky. I'm @willrax on Slack if you want to discuss in more detail, but would you consider: {
name: validateWhatever(),
address: {
street_name: validateWhatever()
}
} as an alternative? |
I think the string option is the general practice in other ember validation libraries. I'm unsure what kind of extra complexity the object form would introduce, although in theory I think it should be the same code to retrieve the function via |
Ah right, If other libraries do it, it's probably best to stick to the convention then. I'll attempt to get the validations lookups (with the string keys) and that debugger in the tests at least hitting today. |
Would you mind if we rebased (or merged) master in to this branch? |
This seemed to not matter in the end. Doing |
@willrax I don't mind! If you'd like, please open a PR merging into this branch Also, huge thanks for stepping up to take this over the line! |
* Add option to skip validations when setting values (#148) * Add option to skip validations on setting values * Rename option for skipping validation * Change object merge to use pureAssign * Update readme to reflect `skipValidate` option * Update helper to pass along `skipValidate` option * obj.hasOwnProperty(key) => key in obj (#151) obj.hasOwnProerty(key) seems to be returning false for ember data models. key in obj seems to work for me. * [BUG]: clear errors for ember 1.13.13 (#157) * [BUG]: clear errors for ember 1.13.13 * Update index.js * Released v1.2.3 * Added isValidating and events (#152) * Added isValidating function to changeset * Added beforeValidation and afterValidation events * Updated README.md for isValidating and events * Update README.md * Update index.js * Update ember and friends (#165) * update to ember-cli 2.8.0 * update to ember-cli 2.9.0 * update to ember-cli 2.10.1 * update to ember-cli 2.12.1 * remove bower from circle build * update ember-try configuration * remove bower install from circle setup ember-cli removed the bower.json file so running this step causes the tests to fail as it can't find the file. * add ember 1.13 back to try tests * add yarn lock file for yarn support (#164) * allow empty objects (#166)
Hello, Just wondering if there is any news regarding this. I am currently encountering this issue and there are workaround but it would be awesome if we can do nested property validation. |
hey @minhnq013 Yep, still working on this 👍 |
Would also love to get this merged. I've got arrays in my changeset that don't rollback, which is annoying. Let me know if there is any way I can help! |
@nrcjbarry does my fork in #194 help? If not, what's the data structure? |
Bump, need to get the amazing work by @webark reviewed and merged! Would be great to add him as a collaborator, and I am happy to review and help out any way I can! |
* Added ability to generate track changesets of nested values. Based off of the work done on #140 * added rollback support for nested values when set on the child changeset * added test for an array that has been changed, rolledback, and saved to a nested object * moving the deepset to a dependency rather then a dev dependency for propper instalation. * added a missing comma. Will squash this when merging * testing arrays of child changesets as well * upgrading ember-cli and packages to latest to see if issue with clircle ci is resolved * using yarn to globaly add bower. autocomplete failed me * adding strict so that the travis tests will run. * just some updates to the travis config to try to determin if it's a circle ci or travis issue * Not understanding why travis is throwing a error for somereson, so trying to get to the base of whats going on
Still getting that
error every other circle ci test. I'm unsure what in circle ci is causing this error. |
Curious if this feature has made any additional headway and if not what are the remaining items to be completed? Perhaps I can assist as I'd really like to see this introduced into Changeset. |
@steverhoades as far as I'm concerned, everything is working as expected. We've gone back and forth on some extra tests, and all of those have been added and resolved. I am unsure as to why the circle ci build errors are occurring, but I didn't run into any errors locally, or with Travis. THere are some merge conflicts, but those are easier for a maintainer to resolve due to the back and forth with doing PR's on to side branches, but if that is a blocker I am more the willing to issue a pr against the side branch to resolve those issues. |
@webark I vote we just remove circle and rely on travis, since that is the supported CI for Ember addons out of the box anyway. |
@webark @rwwagner90 I'm getting the following error when attempting to use this branch:
I am running Ember 2.15 as well as ember-changset-validations v1.2.8. I've also noticed that this branch is quite a bit behind master - does anyone have a rebased version of this branch somewhere? My first attempt at rebasing didn't result in working code. |
@webark @rwwagner90 Please disregard my last message. I apologize, when i updated ember-changeset-validations it removed my link to ember-changeset. I do not see this error with this branch. |
I would like to remove CircleCI as well, but in a separate PR. Does anyone have the bandwidth to help with rebasing this and resolving merge conflicts? |
@poteto I'm attempting this now. If I can get something working i'll submit a PR. |
* Added ability to generate track changesets of nested values. Based off of the work done on adopted-ember-addons#140 * added rollback support for nested values when set on the child changeset * added test for an array that has been changed, rolledback, and saved to a nested object * moving the deepset to a dependency rather then a dev dependency for propper instalation. * added a missing comma. Will squash this when merging * testing arrays of child changesets as well * upgrading ember-cli and packages to latest to see if issue with clircle ci is resolved * using yarn to globaly add bower. autocomplete failed me * adding strict so that the travis tests will run. * just some updates to the travis config to try to determin if it's a circle ci or travis issue * Not understanding why travis is throwing a error for somereson, so trying to get to the base of whats going on
* Added ability to generate track changesets of nested values. Based off of the work done on adopted-ember-addons#140 * added rollback support for nested values when set on the child changeset * added test for an array that has been changed, rolledback, and saved to a nested object * moving the deepset to a dependency rather then a dev dependency for propper instalation. * added a missing comma. Will squash this when merging * testing arrays of child changesets as well * upgrading ember-cli and packages to latest to see if issue with clircle ci is resolved * using yarn to globaly add bower. autocomplete failed me * adding strict so that the travis tests will run. * just some updates to the travis config to try to determin if it's a circle ci or travis issue * Not understanding why travis is throwing a error for somereson, so trying to get to the base of whats going on
Hey folks, since this is the issue/PR with the most activity, I'll try to find some time to review this and get it merged. As a newly appointed maintainer, I'd also like to start doing monthly releases in order to close out all the issues/PRs. Hope that's okay with everyone! |
@nucleartide sounds great! Glad to have you on board 😄 |
So I notice that this PR has some changes that aren't necessarily related to nested keys support. I'd like to break this PR into smaller ones, so the actual change is easier to review. 🙂 It seems like |
@nucleartide I was having issues with circle CI tests not passing, so I tried updating yarn and ember/ember-cli to see if that would resolve the issue, which it didn't. Feel free to pull out all the non-code changes, and put that into a separate PR. |
some of the other stuff is coming through due to a poor merge confict. |
@nucleartide I just created #211 #211 is what this PR should be if it was able to be done in a cleaner way. (doing PR's against long-lived branches that are not up to date with master.. has complexities) |
Closed by #211 |
No description provided.