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

configure mapping of source field names to model attributes #492

Open
guyjacks opened this issue May 3, 2020 · 0 comments
Open

configure mapping of source field names to model attributes #492

guyjacks opened this issue May 3, 2020 · 0 comments

Comments

@guyjacks
Copy link

guyjacks commented May 3, 2020

I have an API that uses snake case for object keys (i.e. attr_name_here) that I would like to load into a model with camel case attributes (i.e. attrNameHere). Is there a way to to tell Redux-Orm to map incoming field names to a different model field name?

Model.fields = {
  // works, but I want use camel case attribute names
  attr_name_here: attr() 

  // does not work because Redux-Orm does not know to map
  // attr_name_here to attrNameHere
  attrNameHere: attr() 

  // Can I do something like this?
  attrNameHere: attr({ sourceFieldName: 'attr_name_here' })

Thank you.

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

No branches or pull requests

1 participant