Merge: serialization: new annotation to rename an attribute in the serialization...
authorJean Privat <jean@pryen.org>
Fri, 18 Mar 2016 20:14:49 +0000 (16:14 -0400)
committerJean Privat <jean@pryen.org>
Fri, 18 Mar 2016 20:14:49 +0000 (16:14 -0400)
commita705d044a16f6221cbb2da1015efead5a9f7d0d5
tree37beb97c26c6e1dbc515934e589745e1017d804b
parent30194998c022bb84e09b6f73fa132496783d14ac
parentbc6aa951d97a7bfb1d73c08654478621c859f9e9
Merge: serialization: new annotation to rename an attribute in the serialization format

By default, an attribute is identified in the serialization format by its Nit name. The `serialize_as` attribute changes this behavior and sets the name of an attribute in the serialization format. It works with both the JSON and the binary implementations.

This annotation can be useful to change the name of an attribute to what is expected by a remote service. Or to use identifiers in the serialization format that are reserved keywords in Nit (like `class` and `type`).

Pull-Request: #1985
Reviewed-by: Jean Privat <jean@pryen.org>