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

Reason behind using _.merge instead of _.extend #637

Closed
isthar opened this issue Oct 14, 2014 · 1 comment
Closed

Reason behind using _.merge instead of _.extend #637

isthar opened this issue Oct 14, 2014 · 1 comment

Comments

@isthar
Copy link

isthar commented Oct 14, 2014

I found that in generated api controller update method you are using _.merge. I had to replace those to _.extend everywhere because it proved to me working better for complex models especially with list of sub schemas.

example of undesired behaviour using _.merge ( removed _ids )

EXISTING:

{ name: 'PART01',
  values: [ 
      { name: 'strProp', value: 'ZZZ' }, 
      { name: 'boolProp',value: 'TRUE' } ] 
}

BODY as received from request:

{ name: 'PART01',
  values: [ 
     { name: 'otherProp', value: 'A111' },
     { name: 'yetAnotherProp', value: 'A999' } ] 
}

UPDATED:

{ name: 'PART01',
  values: [ 
     { name: 'otherProp', value: 'A111' },
     { name: 'otherProp', value: 'A111' } ] 
} 

Again, I am not sure what was your intention but _.extends seems to work better for me ;)

Thanks
-tk

@JaKXz
Copy link
Collaborator

JaKXz commented Oct 14, 2014

Please see issues #310, #473, #564, and #582.

@JaKXz JaKXz closed this as completed Oct 14, 2014
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

2 participants