实测总结:导入Postman Collection v1的JSON file能成功
版本环境
Postman 版本:8.11.1
YAPI 版本:1.12.0
问题解决
如果Postman能直接导出v1的JSON file就不需要继续以下步骤;
可惜Postman v8.11.1 当前版本不支持导出v1。
需要使用postman-collection-transformer工具进行转换v2 -> v1
# 外网直接安装工具执行版本转换即可
npm install -g postman-collection-transformer
postman-collection-transformer convert -i <path to the input Postman Collection file> -o <path to the downloaded Postman file> -j 2.0.0 -p 1.0.0 -P
如果没有npm,则安装nodejs环境
下载链接: nodejs官网
我使用的windows .msi安装方式,双击一直下一步就行
当前安装完成后的版本:
npm -v
9.5.0
node -v
v18.15.0
附:内网环境
(我是保证内外网nodejs版本号一致的)
# 1.安装postman-collection-transformer
npm install -g postman-collection-transformer
# 2.任意位置创建文件夹postman-collection-transformer
# 3.进入文件夹postman-collection-transformer
# 打开cmd
# 这边生成了package.json文件
npm init --yes
# 4.安装postman-collection-transformer相关依赖包到此目录
npm install postman-collection-transformer –save # -save就是将package.json文件相关模块存储到当前目录中
# 5.将整个postman-collection-transformer文件夹拷到内网
# 6.进入此文件夹打开cmd进行安装
npm install -g postman-collection-transformer
至此,问题解决。
解决问题参考链接