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

How to specify custom enum-data-contract.ejs template?

Open ezhylin opened this issue 1 month ago • 0 comments

Summary

I'm trying to provide a custom enum template enum-data-contract.ejs in my custom templates folder, but although the generator logs that it finds the enum template in my custom folder, the rendered output still uses the package default. How should I correctly specify a custom enum template so it will actually be used at render time?

What I did

I set templates prop to my templates folder

<project-root>/generate-api.ts snippet
...
templates: path.join(process.cwd(), '/templates'),
debug: true,
...

My custom file is located at: /templates/enum-data-contract.ejs

Logs (relevant lines)

From the run with debug: true:

[10:52:59 PM]  WARN  Code generator will use the default template: "api" template not found in "<project-root>\templates"
[10:52:59 PM] ℹ "enumdatacontract" template found in <project-root>\templates"
[10:52:59 PM]  WARN  Code generator will use the default template: "routetypes" template not found in "<project-root>\templates"

Actual behavior

The generator logs that enumdatacontract is found in my custom folder. However the final generated code uses the package's default enum template, not my custom enum-data-contract.ejs.

ezhylin avatar Nov 22 '25 21:11 ezhylin