无法将 swagger JSON 或 YAML 导入 Postman [英] Unable to import swagger JSON or YAML into Postman
问题描述
问题
无法将 swagger 2.0 转换为受 Postman 导入功能影响的格式
Unable to convert swagger 2.0 into a format which is being affected by Postman import functionality
通过 /swagger.json|yaml
生成
使用 swagger 通过 dropwizard jetty 暴露的 Swagger 端点
Swagger endpoint exposed via dropwizard jetty using swagger
- swagger-core:1.5.17
- swagger-jaxrs:1.5.17
- swagger-jersey2-jaxrs:1.5.17
- swagger 模型:1.5.17
尝试
尝试通过导入屏幕手动导入 JSON 或 YAML 版本
Tried manually importing the JSON or YAML versions via the import screen
- 导入文件
- 从链接导入
- 粘贴原始文本
尝试使用以下方法转换为不同的格式:api-spec-converter 和swagger2-postman-generator
Tried converting to different formats using: api-spec-converter and swagger2-postman-generator
结果
导入错误:必须包含信息对象
问题
有没有人设法解决这个问题,允许导入
Has anyone managed to get around this issue allowing the import
推荐答案
在 Swagger 2.0 中,info 字段是强制性的.只需将以下内容添加到您的 YAML 根目录:
In Swagger 2.0 the info field is mandatory. Just add the following to your YAML root:
info:
title: 'EmptyTitle'
description: 'EmptyDescription'
version: 0.1.0
或者如果你有 JSON 格式(在根目录中),也可以这样:
Or like this if you have it in JSON format (in the root too):
"info": {
"title": "EmptyTitle",
"description": "EmptyDescription",
"version": "0.1.0"
}
希望对您有所帮助!
这篇关于无法将 swagger JSON 或 YAML 导入 Postman的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!