diff --git a/packages/ember-data/lib/serializers/json-serializer.js b/packages/ember-data/lib/serializers/json-serializer.js index ea101eb9e21..4f501546343 100644 --- a/packages/ember-data/lib/serializers/json-serializer.js +++ b/packages/ember-data/lib/serializers/json-serializer.js @@ -274,6 +274,7 @@ export default Serializer.extend({ this.normalizeId(hash); this.normalizeAttributes(typeClass, hash); this.normalizeRelationships(typeClass, hash); + this.normalizeUsingDeclaredMapping(typeClass, hash); }, /** diff --git a/packages/ember-data/tests/integration/serializers/json-serializer-test.js b/packages/ember-data/tests/integration/serializers/json-serializer-test.js index 7a7af6450aa..0a7f2acfd84 100644 --- a/packages/ember-data/tests/integration/serializers/json-serializer-test.js +++ b/packages/ember-data/tests/integration/serializers/json-serializer-test.js @@ -454,3 +454,26 @@ test('serializeBelongsTo with async polymorphic', function() { deepEqual(json, expected, 'returned JSON is correct'); }); + +test('extractErrors respects custom key mappings', function() { + env.registry.register('serializer:post', DS.JSONSerializer.extend({ + attrs: { + title: 'le_title', + comments: { key: 'my_comments' } + } + })); + + var payload = { + errors: { + le_title: ["title errors"], + my_comments: ["comments errors"] + } + }; + + var errors = env.container.lookup('serializer:post').extractErrors(env.store, Post, payload); + + deepEqual(errors, { + title: ["title errors"], + comments: ["comments errors"] + }); +});