acacode / swagger-typescript-api

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

Template configuration does not work #890

Open snuup opened 1 month ago

snuup commented 1 month ago

My Api has name "getDog" which the tool renames into getDogList although its a single dog, so that makes no sense at all.

I copied the templates folder from the repo and pointed to my own templates folder like so:

... -t tools/swaggerts/templates/default

Then I changed the route-name.ejs to

const methodAliases = {
     get: (pathName, hasPathInserts) => _.camelCase(`${pathName}_${hasPathInserts ? "detailaaaa" : "listxxxxx"}`),

But those changes do not appear in the generated api. How do custom templates work?

duola8789 commented 1 month ago

I have encountered a similar issue as well.

I edit the api.ejs like this:

image

the result is

image

where is “import x from "../../utils/request";