acacode / swagger-typescript-api

Generate the API Client for Fetch or Axios from an OpenAPI Specification
MIT License
3.12k stars 345 forks source link

Can http-client.ts be customized? #700

Open DominiY opened 3 months ago

DominiY commented 3 months ago

Can http-client.ts be customized? Because wechat mini programs or other projects may not be axios or fetch.

I want to wrap a wx.request around it.

woutervanvliet commented 3 months ago

Yes it can, quite easily. Use swagger-typescript-api generate-templates to get all the templates, and then use http-client.ejs to customize http-client.ts

gaowujian commented 1 month ago

image

I use nodejs scripts to create ts files. you need to create your file structure like this and name the template file as http-client.ejs. The simplest way is to copy axios-http-client or fetch-http-client and rename it image