Implement `Aliased` for fields
pmg103 opened this issue · 0 comments
pmg103 commented
There is a plugin called Aliased
in case you want to rename a field:
serialization_spec = [
'id',
'name',
{'kittehs': Aliased('cats', [
'name'
]}
]
However there’s been an oversight — you can only alias a nested relation like that, not a basic field:
serialization_spec = [
'id',
{'title', Aliased('name')}, # DOESN'T WORK
]
For the sake of orthoginality, this form of Aliased
, that takes only one argument and renames a field, should be implemented as expected.