OpenAPITools / OpenAPITools/openapi-generator

[REQ] Requesting output of the generator typesafe.

Open
#6,590 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Required the output of generatior should be typesafe

Right now the client code we are getting generated there is use of Language primitive data type which is not recommended by our organisation or not considered as the best practice to use as it allows to pass argument of any type or internally the apis that were getting generated may won't work because of the use of .
e.g. private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
if (typeof value === 'object' && value instanceof Date === false) {
httpParams = this.addToHttpParamsRecursive(httpParams, value);
} else {
httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
}
return httpParams;
}

This is the sample of generated client code it is in one of the apis file to set Http param and uses .

Solution seeking or possible

If it could possible to introduce some new configuration so that a new configuration can be added into the config file and restrict the use of

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

The issue names no repository file or test; start by tracing the generator entry point and configuration that produce the shown addToHttpParams method. Determine how a typesafety option should control generated any usage, then verify the resulting generated client output against the requested behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.