OpenAPITools / OpenAPITools/openapi-generator

[BUG] [typescript-axios]

Open
#16,995 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

My question is: when I use -t xxxx and -c xxxin the same command, the template is not efffective.
The steps are as follows:
In my project, I install @openapitools/openapi-generator-cli dependence.
the content of configuration file openapitools.jsonis:

{
  "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
  "spaces": 2,
  "generator-cli": {
      "version": "6.6.0",
      "generators": {
          "v2.0": {
              "generatorName": "typescript-axios",
              "output": "./api",
              "inputSpec": "./json/api.json",
              "templateDir": "./template",
              "additionalProperties": {
                  "apiPackage": "api",
                  "modelPackage": "interface",
                  "withSeparateModelsAndApi": true,
                  "withInterfaces": true,
                  "supportsES6": true
              }
          }
      }
  }
}

the command is: npx openapi-generator-cli generate -c ./openapitools.json --generator-key v2.0.
the template can be used normally.
when I change the command: npx openapi-generator-cli generate -c ./openapitools.json --generator-key v2.0 -t /Users/wutao/Desktop/demo/generate-api/template, and delete the templateDir properties of the configuration file, the templatefiles are not efffective.
Is there any kind person who can help me tell me the reason for this

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with openapitools.json and the template directory, then run the two provided npx openapi-generator-cli commands using the typescript-axios generator. Compare the effects of templateDir and the -t option, and verify the generated files to determine why the custom templates are not applied.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, openapi, typescript
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.