OpenAPITools / OpenAPITools/openapi-generator

[REQ] Add TypeScript generator with functions to construct URL's instead of API calls

Open
#15,951 2 comments 2 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

Request

Add generator that generates TypeScript functions to construct URLs to be used in any fetching library.

Example:

// buildCompanyGet should be generated by openapi
const companyGetUrl = buildCompanyGet(baseUrl, { companyId: "xyz" })

// e.g. returns http://localhost:8080/api/company/xyz
console.log(companyGetUrl)

// use in any fetch library, here Nuxt 3 $fetch
$fetch(companyGetUrl)

This could be very useful if you are using a fetching library which has no generator (In my case $fetch from Nuxt 3) or any other use case. I think this flexibility could also be added to existing generators, like typescript. It could be as easy as extracting the assertion and building of URLs into own functions.

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 existing TypeScript generator, especially the URL construction and assertion behavior mentioned in the request. Define the generated function interface and verify that it produces reusable URL builders for the requested paths and parameters, with coverage in the generator's existing tests if applicable.

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
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.