OpenAPITools / OpenAPITools/openapi-generator

[REQ] [typescript] Allow ParameterizedServer servers for typescript-node

Open
#7,623 1 comment 1 reaction 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

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

Currently OAS 3 and some of its generators in this repo support ParameterizedServer which allows a server to be designed as follows:

servers:
  - url: https://{environment}.example.com/v2
    variables:
      environment:
        default: api    # Production server
        enum:
          - api         # Production server
          - api.dev     # Development server
          - api.staging # Staging server

This feature is to track adding in the usage of parameterized servers in typescript-node.

Describe the solution you'd like

This is likely possible by:

  1. Adding a configuration object which is sent to the constructor of the API
  2. The configuration object will refer to the servers variables as enums and reconstruct the URL using the variables passed in.

If multiple servers are found, a warning can be logged.

Describe alternatives you've considered

Open for intepretation

Additional context

Would like advice on the best way to look into this since typescript-node still uses basePath which would likely have to be overwritten.

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

Start by locating the typescript-node generator's handling of the API constructor and basePath, then compare how other generators support ParameterizedServer. Define how constructor configuration supplies server variables and how the URL is reconstructed; done should include the selected server behavior and a warning when multiple servers are present.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
api, 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.