Attribute mappings in serializers should use underscore notation

This commit is contained in:
Piotr Sarnacki 2015-11-11 16:24:23 +01:00
parent dbd83c8643
commit 35f95739c7
5 changed files with 8 additions and 8 deletions

View File

@ -14,7 +14,7 @@ Build = Model.extend DurationCalculations,
_duration: DS.attr('number') _duration: DS.attr('number')
_config: DS.attr('object') _config: DS.attr('object')
_startedAt: DS.attr() _startedAt: DS.attr()
_finishedAt: DS.attr() _finishedAt: DS.attr('string')
pullRequest: DS.attr('boolean') pullRequest: DS.attr('boolean')
pullRequestTitle: DS.attr() pullRequestTitle: DS.attr()
pullRequestNumber: DS.attr('number') pullRequestNumber: DS.attr('number')

View File

@ -7,10 +7,10 @@ var Serializer = V2FallbackSerializer.extend({
_config: { _config: {
key: 'config' key: 'config'
}, },
_finishedAt: { _finished_at: {
key: 'finished_at' key: 'finished_at'
}, },
_startedAt: { _started_at: {
key: 'started_at' key: 'started_at'
}, },
_duration: { _duration: {

View File

@ -5,8 +5,8 @@ Serializer = V2FallbackSerializer.extend
isNewSerializerAPI: true isNewSerializerAPI: true
attrs: { attrs: {
_config: { key: 'config' } _config: { key: 'config' }
_finishedAt: { key: 'finished_at' } _finished_at: { key: 'finished_at' }
_startedAt: { key: 'started_at' } _started_at: { key: 'started_at' }
} }
keyForV2Relationship: (key, typeClass, method) -> keyForV2Relationship: (key, typeClass, method) ->

View File

@ -3,8 +3,8 @@
Serializer = ApplicationSerializer.extend Serializer = ApplicationSerializer.extend
attrs: { attrs: {
branchName: { key: 'branch' } branch_name: { key: 'branch' }
tagName: { key: 'tag' } tag_name: { key: 'tag' }
repo: { key: 'repository_id' } repo: { key: 'repository_id' }
} }

View File

@ -27,7 +27,7 @@ export default DS.JSONSerializer.extend({
} }
}, },
extractAttributes() { extractAttributes(modelClass, resourceHash) {
let attributes = this._super(...arguments); let attributes = this._super(...arguments);
for(let key in attributes) { for(let key in attributes) {
if(key.startsWith('@')) { if(key.startsWith('@')) {