OpenAPITools / OpenAPITools/openapi-generator

[BUG] [angular-typescript] Angular-typescript generated services should be tree-shakable

Open
#11,654 0 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Is your feature request related to a problem? Please describe.

Generated services for angular-typescript generator result in one angular service class per API controller. However, if the app only uses one or two endpoints from that controller, we still load in the entire angular service class.

Describe the solution you'd like

There should be a way to tree-shake away any unused API endpoints from the production bundles.

Describe alternatives you've considered

I've considered customizing the angular-typescript generator templates for my own case to be smaller and tree-shakable, but the documentation for how to customize generator templates is very confusing and I have not had any success.

Additional context

There does not seem to be any version of generated typescript or javascript code that generates tree shakable functions instead of relying on classes.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the angular-typescript generator templates and the documentation for customizing generator templates first. Define how generated services could support tree-shakable endpoint usage, then verify the generated output in a representative Angular application. The issue is done when unused endpoints are excluded from production bundles.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
api, frontend, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.