DEV Community

Discussion on: Consuming APIs in Angular – The Model-Adapter Pattern

Collapse
 
thiltal profile image
Zdeněk Mlčoch

For advanced front-end developers there is a way of generate the adapter part from openApi (swagger) specification. Even a beginner can generate angular project on page editor.swagger.io/. It can take part in developer flow so you are warned by typescript compiler if the api has changed.

Collapse
 
stereobooster profile image
stereobooster

Also transform.now.sh/json-to-io-ts/ or the big list of similar tools here

Collapse
 
crywolfe profile image
Gerry Wolfe

This is similar to what we do at my place of employment.
We build the back-end service in Java, using Spring and Spring/Swagger annotations.
We take the generated front-end controllers and models from Swagger and then, as an example, for a 'get' request, send the return json object to an NGXS state class that we build out and use the model in the state class to set the respective states.