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

[RFR] Clarify Map logic, allow nested fields #549

Merged
merged 19 commits into from
Jul 10, 2015
Merged

Conversation

fzaninotto
Copy link
Member

Currently, callbacks registered on fields with map() are applied to the REST response to turn it into an Entry (when fetching results) AND to the entries to turn them into a response (when pushing modifications). It doesn't make sense, and prevents some new features, such as deeply nested fields (refs. #525).

This PR fixes that. Now you can do things like:

listView.fields([
    nga.field('title'),
    nga.field('author.name')
]);

to map REST responses looking like:

[
  {
    "title": "War and Peace",
    "author": {
      "name": "Leo Tolstoi"
    }
  },
  {
    "title": "Anna Karenina",
    "author": {
      "name": "Leo Tolstoi"
    }
  }
]

Depends on marmelab/admin-config#20

@fzaninotto fzaninotto changed the title [WIP] Clarify Map logic, allow nested fields [RFR] Clarify Map logic, allow nested fields Jul 9, 2015
@fzaninotto
Copy link
Member Author

Switching to RFR!

@@ -13,7 +13,7 @@
"npm": "^2.10.0"
},
"devDependencies": {
"admin-config": "^0.2.4",
"admin-config": "marmelab/admin-config#map_transform",
Copy link
Contributor

Choose a reason for hiding this comment

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

admin-config 0.2.5 version had been published.

Copy link
Member Author

Choose a reason for hiding this comment

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

Switched dependency to fixed version

jeromemacias added a commit that referenced this pull request Jul 10, 2015
[RFR] Clarify Map logic, allow nested fields
@jeromemacias jeromemacias merged commit d404831 into master Jul 10, 2015
@jeromemacias jeromemacias deleted the map_transform branch July 10, 2015 07:37
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.

None yet

2 participants