5

We are currently migrating a loopback3 application to loopback4. The migration of the server is steight forward, but migrating the angular client seems become an issue because of the "sdk".

For loopback3 we used @mean-expert/loopback-sdk-builder to generate a client sdk for angular6+. This project seems reaced end-of-life and is not compatible with loopback4.

Generating the sdk for loopback3 worked for us that way:

package.json of server:

"scripts": {
    "gen-sdk": "node ./node_modules/@mean-expert/loopback-sdk-builder/bin/lb-sdk src/server.js ../frontend/src/app/shared/sdk --wipe=enabled"
}

The generator starts a copy of the server, reads different internal metadata and writes the generated files to the client project - as far i can see it does not make use of the swagger.json provided by loopback3.

We are searching for an alternative sdk to use with loopback4. The backend provides a openapi.json to describe the endpoints.

Which sdk do you use in your angular projects (ideally written in TypeScript)? Is there a sdk which generated code is mostly compatible with @mean-expert/loopback-sdk-builder?

So far I found and tested the following projects to generate a openapi client:

  • openapi-generator
    • con: is written in Java
    • con: throws NullpointerExceptions all the time (maybe our openapi.json is not correct, but this generator does not provide useful error messages)
  • ng-openapi-gen
    • pro: is written in TypeScript
    • con: the generated operation names are really strage, maybe only in combination with loopback4?
    • con: the project does not seem to be very active

Which angular setup do you suggest to talk to an loopback4 rest backend?

derdeka
  • 156
  • 5

0 Answers0