OpenAPITools / OpenAPITools/openapi-generator

[REQ][typescript-angular] Type ConfigurationParameters.credentials properly

Open
#21,642 0 comments 0 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

ConfigurationParameters.credentials index does not list possible security schemes

Can we improve type safety of ConfigurationParameters field credentials? Currently it is generated as:

credentials?: {[ key: string ]: string | (() => string | undefined)};

That does not have great DX, because security schemes are not suggested by IDE and the value is not checked for possible typos.

Improved type definition

My suggestion is to create a type that lists security schemes, like:

type SecuritySchemes = 'ExampleA' | 'ExampleB';

And use it for credentials like:

credentials?: Partial<Record<SecuritySchemes, string | (() => string | undefined)>>;

That way we achieve better type safety and DX.

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

No files or tests are named. Start by locating the typescript-angular generator or template that emits ConfigurationParameters.credentials, then inspect how security schemes are represented in generated output. Done means credentials uses a generated security-scheme key type while retaining the documented string-or-function values.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, openapi, typescript
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.