如何在 C++ CPP_POST_PROCESS_FILE 的 openapi-generator CLI 中设置 --enable-post-process-file
How to set --enable-post-process-file in openapi-generator CLI for c++ CPP_POST_PROCESS_FILE
每次从 openapi-generator 生成 c++ 客户端时,我都会收到以下消息:
[main] INFO o.o.c.languages.AbstractCppCodegen - Environment variable CPP_POST_PROCESS_FILE not defined so the C++ code may not be properly formatted. To define it, try 'export CPP_POST_PROCESS_FILE="/usr/local/bin/clang-format -i"' (Linux/Mac)
[main] INFO o.o.c.languages.AbstractCppCodegen - NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).
[main] WARN o.o.codegen.DefaultCodegen - The value (generator's option) must be either boolean or string. Default to `false`.
我对生成器 运行 使用了以下命令:
npx openapi-generator generate -i api.yaml -g cpp-restsdk -o %CD%
如何修复这些消息。
请改用 npx @openapitools/openapi-generator-cli
,因为 https://www.npmjs.com/package/@openapitools/openapi-generator-cli 是 openapi-generator 的 npm 包装器的官方仓库。
要启用post文件处理,请在命令中添加--enable-post-process-file
,例如
export CPP_POST_PROCESS_FILE="/usr/local/bin/clang-format -i"
npx @openapitools/openapi-generator-cli generate -i api.yaml -g cpp-restsdk -o %CD% --enable-post-process-file
每次从 openapi-generator 生成 c++ 客户端时,我都会收到以下消息:
[main] INFO o.o.c.languages.AbstractCppCodegen - Environment variable CPP_POST_PROCESS_FILE not defined so the C++ code may not be properly formatted. To define it, try 'export CPP_POST_PROCESS_FILE="/usr/local/bin/clang-format -i"' (Linux/Mac)
[main] INFO o.o.c.languages.AbstractCppCodegen - NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).
[main] WARN o.o.codegen.DefaultCodegen - The value (generator's option) must be either boolean or string. Default to `false`.
我对生成器 运行 使用了以下命令:
npx openapi-generator generate -i api.yaml -g cpp-restsdk -o %CD%
如何修复这些消息。
请改用 npx @openapitools/openapi-generator-cli
,因为 https://www.npmjs.com/package/@openapitools/openapi-generator-cli 是 openapi-generator 的 npm 包装器的官方仓库。
要启用post文件处理,请在命令中添加--enable-post-process-file
,例如
export CPP_POST_PROCESS_FILE="/usr/local/bin/clang-format -i"
npx @openapitools/openapi-generator-cli generate -i api.yaml -g cpp-restsdk -o %CD% --enable-post-process-file