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')
_config: DS.attr('object')
_startedAt: DS.attr()
_finishedAt: DS.attr()
_finishedAt: DS.attr('string')
pullRequest: DS.attr('boolean')
pullRequestTitle: DS.attr()
pullRequestNumber: DS.attr('number')

View File

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

View File

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

View File

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

View File

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