cyclosproject / ng-openapi-gen

An OpenAPI 3.0 codegen for Angular
MIT License
397 stars 132 forks source link

Generate each service call as a function, and add the option to no longer generate services #282

Closed luisfpg closed 1 year ago

luisfpg commented 1 year ago

For very large APIs, a lot of unused code is generated, because the services have code to handle every request. So, we'll always generate a function per service operation. The function will get as parameters:

It will return the Observable as always.

The generated services are refactored to call those functions instead of having the code inline.

As such, no perceptible changes will be introduced to existing generations.

A new option, "services" (which defaults to true) will control whether services should be generated. Setting it to false will only generate the functions, which can be directly imported and used by the application.