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

Added new populate, dePopulate, serialze hooks. #62

Merged
merged 5 commits into from
Dec 8, 2016
Merged

Conversation

eddyystop
Copy link
Collaborator

  • Docs are in github eddyystop/feathers-hooks-populate for the moment.
  • Old populate hook renamed legacyPopulate.
  • New populate calls legacyPopulate based on func signature for backward compatibility.
  • @marshall reviewed the README and pushed a PR.
  • @ekryski "took a quick gander as well and it looks pretty good." I assume he looked at the code.
  • I'll copy the README to GitBook once the code is reviewed.
  • Perhaps these 3 hooks ought to have their own subpage hooks/common/populate
    as the docs are not short.

- Docs are in eddyystop/feathers-hooks-populate for the moment.
- Old populate hook renamed legacyPopulate.
- New populate calls legacyPopulate based on func signature.
- @marshall reviewed the README and pushed a PR.
- @ekryski "took a quick gander as well and it looks pretty good."
- I'll copy the README to GitBook once the code is reviewed.
- Perhaps these 3 hooks ought to have their own subpage hooks/common/populate
as the docs are not short.
@@ -391,7 +391,7 @@ export function disable (realm, ...args) {
*
* If 'senderId' is an array of keys, then 'sender' will be an array of populated items.
*/
export function populate (target, options) {
export function legacyPopulate (target, options) {
options = Object.assign({}, options);
Copy link
Member

@ekryski ekryski Dec 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably add a deprecation warning telling them to use the new function signature.


return populate({ schema, checkPermissions })(hook)
.then(() => { throw new Error('was not supposed to succeed'); })
.catch(() => {});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to stop this PR but I usually check that an error exists as well

.catch(error) => expect(error).to.not.equal(undefined))

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Info, thxs.

@ekryski
Copy link
Member

ekryski commented Dec 7, 2016

@ekryski "took a quick gander as well and it looks pretty good." I assume he looked at the code.

I did. Didn't see anything that stood out.

Perhaps these 3 hooks ought to have their own subpage hooks/common/populate
as the docs are not short.

Agreed.

New populate calls legacyPopulate based on func signature for backward compatibility.

💥 nice. I'd add a note about adding a deprecation warning guiding people towards the new format. Even just something like "Calling populate(target, options) is now deprecated and will be removed in the future. Refer to docs.feathersjs.com for more information"

Other than that I think it looks pretty good. I'll have to pull it down and give it a try.

- legacyPopulate has a deprecate message
- throws tests check err is defined
@ekryski
Copy link
Member

ekryski commented Dec 8, 2016

I think this is probably good to :shipit:

@eddyystop eddyystop merged commit b12b70e into master Dec 8, 2016
@eddyystop eddyystop deleted the new-populate branch December 8, 2016 20:35
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

Successfully merging this pull request may close these issues.

2 participants