openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

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

Open oemer-aran opened this issue 2 years ago • 2 comments

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.

oemer-aran avatar Jun 29 '23 13:06 oemer-aran

This would be amazing since I have specified the websocket endpoint in my swagger spec

OptoCloud avatar Jun 29 '23 21:06 OptoCloud

With over 4k issue this will likely never be implemented 😞

oemer-aran avatar Feb 16 '24 18:02 oemer-aran