Data transformers

Schemas of the flow overview.

Why we need to transform data ?

  • To have uniformed data structure

So to facilitate maintenance and debug, we just modify data from transformers.

What is transformer responsibility?

To convert an external data into an internal and vice versa

When we should have a transformer ?

A transformer is a kind of bridge between two layers. Each layer has its own structure to represent data.

transformer cycle layer
  • data API called to internal

What is rule regarding our transformer ?

  • We must have general transformer interface witch define our future transformers method, with 2 generics types (source and return types) as this example:

- Your services transformers will implement this interface to keep the rules that one transform method by Transformer service.


  • On 1st line, we add on TransformerInterface the 2 types we’ll use (source and return type)



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sophie Andriamahenintsoa

developer: Angular7+, RxJS, NgRx,Typescript, Javascript/ES6+, NodeJS, ReactJS, Redux, responsive design, animations, git