swagger-typescript-api icon indicating copy to clipboard operation
swagger-typescript-api copied to clipboard

BaseUrl option

Open P2uadrat opened this issue 3 years ago • 6 comments

Hello

I'm missing an option to provide a single BaseUrl for the generated 'httpClient'/'Axios'. As I understood, it would be possible to achieve this by specifying a custom httpClient template. But losing the default template only for setting a specific baseUrl is a pity.

What's your intention regarding such a feature?

P2uadrat avatar May 15 '21 17:05 P2uadrat

A baseUrl will be generated if it's included in your swagger file: https://github.com/acacode/swagger-typescript-api/blob/7df956c236d1e7fc051658cd7012c8ea22286b44/tests/schemas/v2.0/github-swagger.json#L3-L5

charpeni avatar Sep 10 '21 17:09 charpeni

The 'usageSchema' variable lost the 'basePath' attribute during call 'convertSwaggerObject' function.imageimage I wanted to use the 'basePath' attribute in the 'apiConfig' variable, but lost it during the template rendering process. Because it uses the usageSchema variable. image

CodePirate7 avatar Sep 28 '21 13:09 CodePirate7

Hello @q389491729, what version of swagger schema are you using ?

js2me avatar Sep 29 '21 05:09 js2me

Hello @q389491729, what version of swagger schema are you using ?

2.0

CodePirate7 avatar Sep 29 '21 09:09 CodePirate7

problem is in the convertSwaggerObject conversion In case openapi is not provided, it creates a usageSchema without the information

paztis avatar Nov 24 '21 09:11 paztis

swagger2openapi deletes the basePath information after computing the baseUrl You might take this information for originalSchema instead of usageSchema

paztis avatar Nov 24 '21 09:11 paztis