daves-weblab / rest-bundle

Bundle for creating REST Apis for Pimcore Objects for REST and JsonApi Json Standards.
3 stars 0 forks source link

Computed Properties #1

Closed daves-weblab closed 6 years ago

daves-weblab commented 6 years ago

Some properties being sent via the Api might not come directly from the data object itself. Those include properties which are calculated by a certain logic that should not be leaked outside the application (e.g. via Javascript). These properties should be computed before being sent via the Api.

A computed property should be represented by a class with a get() and a set() method for computing the value with get() and writing data back by decomputing it with set().

Computed properties should be configurable by passing it into the serialize/deserialize methods of the Serializer or by defining them in a configuration YAML file.

Computed properties should contain a name, which is used for sending and retrieving the data as well as a supported class or interface respectively for which they can operate.