OpenAPITools / OpenAPITools/openapi-generator
[REQ] Add TypeScript generator with functions to construct URL's instead of API calls
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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