Closed pmg103 closed 3 years ago
There is a plugin called Aliased in case you want to rename a field:
Aliased
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.
There is a plugin called
Aliased
in case you want to rename a field:However there’s been an oversight — you can only alias a nested relation like that, not a basic field:
For the sake of orthoginality, this form of
Aliased
, that takes only one argument and renames a field, should be implemented as expected.