OpenAPITools / OpenAPITools/openapi-generator-cli
Unable to provide custom files for generation [BUG]
@kay-schecker 已经在做这个了。
开始于 2022年11月1日。
- 主要语言
- TypeScript
- 星标
- 2k
- 派生
- 208
- 平均合并
- 7 小时 12 分钟
- 30 天内合并 PR
- 6
描述
🐛 Bug Report:
Describe the bug
The openapi generator specifies the ability to provide custom files/templates (https://openapi-generator.tech/docs/customization).
This feature does not work with the current version of the CLI.
Steps to Reproduce
Steps to reproduce the behavior:
-
Install latest version of openapi-generator-cli (currently 5.4.0)
npm install openapi-generator-cli@5.4.0 -
Provide the following for the
openapitools.jsonfile (note thefileskeyword), e.g.{ "$schema": "/path/to/schema", "generator-cli": { "version": "5.4.0", "generators": { "nodejs": { "templateDir": "#{cwd}/nodejs/templates", "generator-name": "typescript", "output": "#{cwd}/nodejs/sdk", "inputSpec": "#{cwd}/openapi.json", "additionalProperties": { "esTargetVersion": "ES2020", "moduleResolution": "nodejs", "framework": "fetch-api", "platform": "node", "license": "MIT", "useInversify": false, "legacyDiscriminatorBehavior": false }, "files": { "api_test.mustache": { "templateType": "ApiTests", "destinationFilename": "spec/api_test.spec.ts" } } } } } } } -
Execute the generator
openapi-generator-cli generate --generator-key nodejs -
See error
[[nodejs] #{cwd}/openapi.json] [error] Found unexpected parameters: [--files=api_test.mustache=[object Object]]
[[nodejs] #{cwd}/openapi.json]
[[nodejs] #{cwd}/openapi.json] See 'openapi-generator-cli help' for usage.
java -jar "node_modules/@openapitools/openapi-generator-cli/versions/5.4.0.jar" generate
--input-spec="/openapi.json"
--template-dir="/openapi-spec/nodejs/templates"
--generator-name="typescript"
--output="/nodejs/sdk"
--additional-properties="esTargetVersion=ES2020,moduleResolution=nodejs,framework=fetch-api,platform=node,license=MIT,useInversify=false,legacyDiscriminatorBehavior=false"
--files="api_test.mustache=[object Object]" exited with code 1
Expected behavior
the "files" keyword gets resolved properly and all sub-properties are provided to the cli.
Operation System (please complete the following information):
- OS: MacOS
- Version 12.6.1
Package System (please complete the following information):
- Version 5.4.0
Additional context
The typescript generator doesn't ship with a test runtime, so I was in the process of using the customization feature - ran into this instead.
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
评估
这个 Issue 还没有评估数据。