使用Swagger Codegen生成TS相关代码

官方介绍地址:https://github.com/swagger-api/swagger-codegen

1.安装JDK【略】

2.下载jar包

wget https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.41/swagger-codegen-cli-3.0.41.jar -O swagger-codegen-cli.jar

Invoke-WebRequest -OutFile swagger-codegen-cli.jar https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.41/swagger-codegen-cli-3.0.41.jar

3.将Swagger的JSON描述文件放置到同目录下

4.执行生成命令

java -jar swagger-codegen-cli-3.0.41.jar generate -i ./swagger.json -l typescript-axios -o ./generate --additional-properties modelPropertyNaming=original stringEnums=true
posted @ 2023-05-06 16:04  SpringCore  阅读(581)  评论(0编辑  收藏  举报