您可以使用。\ swagger-codegen-cli.jar生成以生成与Swagger-Codegen-CLI同一文件夹中不在同一文件夹中的文件吗?

发布于 2025-01-21 05:18:03 字数 377 浏览 2 评论 0原文

使用Java -jar。 。但是,.json文件必须swagger-codegen-cli在同一文件夹中,当您要转换许多文件时,这是不切实际的(您必须手动下载并移动每个文件)。我已经搜寻了网络,但是找不到实用的解决方案。有办法这样做吗?我是否能够以“大规模生产”文件的方式集成Swagger-codegen?我知道我可以更改输出目录(-o),但这不是我想要的。说我有一个名为“脚本”的文件夹,其中我有很多.json文件。我是否可以在该文件夹内部的任何文件上调用Swagger-Codegen-cli生成,即使Swagger> Swagger-Codegen-Cli位于其他文件夹中?

Using java -jar .\swagger-codegen-cli.jar generate -l typescript-angular -i .\swagger.json, I can turn ".\swagger.json" into a typescript-angular file. However, the .json file must be in the same folder as the swagger-codegen-cli, which is impractical when you have many files to convert (You have to manually download and move every file). I've scoured the web, but haven't been able to find a practical solution. Is there a way to do this? Am I able to integrate swagger-codegen in such a way that I can "mass produce" files? I know I can change the output directory (-o) but that isn't what I'm looking for. Say I have a folder called "scripts" where I've got a lot of .json files. Am I able to call swagger-codegen-cli generate on any file inside of that folder, even if swagger-codegen-cli is located in a different folder?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一生独一 2025-01-28 05:18:03

-i参数期望OpenAPI文件或该文件所在的URL完全合格或相对路径。也就是说,该文件不必与Swagger Codegen CLI在同一文件夹中。

示例:

# The file is in the current working folder
-i swagger.json
-i ./swagger.json

# The file is in a subfolder of the current working folder
-i sub/folder/swagger.json
-i ./sub/folder/swagger.json

# Relative path to a file in another folder
-i ../../path/to/swagger.json

# Absolute path - Windows
-i C:/path/to/swagger.json

# Absolute path - *nix
-i ~/path/to/swagger.json

# URL
-i https://petstore.swagger.io/v2/swagger.json

The -i argument expects a fully-qualified or relative path to an OpenAPI file, or an URL where that file is located. That is, the file does not have to be in the same folder as the Swagger Codegen CLI.

Examples:

# The file is in the current working folder
-i swagger.json
-i ./swagger.json

# The file is in a subfolder of the current working folder
-i sub/folder/swagger.json
-i ./sub/folder/swagger.json

# Relative path to a file in another folder
-i ../../path/to/swagger.json

# Absolute path - Windows
-i C:/path/to/swagger.json

# Absolute path - *nix
-i ~/path/to/swagger.json

# URL
-i https://petstore.swagger.io/v2/swagger.json
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文