OpenAPITools / OpenAPITools/openapi-generator

[REQ][typescript-fetch] Add the API version string as a constant.

Open Beginner friendly
#13,935 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

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

We want to be able to log / send the used version of the spec, so that we can trace problems to incompatible API versions of the client.

Describe the solution you'd like

Add in runtime.mustache:

export const API_DOCUMENT_VERSION = "{{{version}}}";

Describe alternatives you've considered

There is none: the information is currently lost in generation.

Additional context

We can provide a PR, if necessary, or put it together with a PR for https://github.com/OpenAPITools/openapi-generator/issues/13933.

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 in the typescript-fetch generator's runtime.mustache template and inspect how the OpenAPI document version is passed into generated files. Add the requested API_DOCUMENT_VERSION constant using the template version value, then verify that a generated TypeScript fetch client exposes the expected version string.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.