NEIAPI / nei

NEI 接口管理平台 源代码
https://nei.netease.com
MIT License
317 stars 77 forks source link

导入swagger失败 #13

Open cnHuaShao opened 4 years ago

cnHuaShao commented 4 years ago

Bug 描述 ono.js:64 Uncaught (in promise) SyntaxError: [object Object] is not a valid Swagger API definition at index.js:65

导入文件


{
  "openapi": "3.0.1",
  "info": {
    "title": "lz2392504 的项目",
    "description": "",
    "version": "1.0.0"
  },
  "tags": [
    {
      "name": "测试分组"
    }
  ],
  "paths": {
    "/getUserInfo": {
      "get": {
        "summary": "测试接口-获取用户信息接口",
        "description": "",
        "tags": [
          "未命名"
        ],
        "parameters": [
          {
            "name": "userId",
            "in": "query",
            "description": "用户编号",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "*/*": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "description": ""
                    },
                    "msg": {
                      "type": "string",
                      "description": ""
                    },
                    "data": {
                      "type": "array",
                      "description": "",
                      "items": {
                        "type": "object",
                        "description": "",
                        "properties": {
                          "userName": {
                            "type": "string",
                            "description": ""
                          },
                          "userAge": {
                            "type": "number",
                            "description": ""
                          },
                          "userSex": {
                            "type": "number",
                            "description": ""
                          }
                        },
                        "required": [
                          "userName",
                          "userAge",
                          "userSex"
                        ]
                      }
                    }
                  },
                  "required": [
                    "code",
                    "msg",
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/testMock": {
      "get": {
        "summary": "测试mock接口",
        "description": "",
        "tags": [
          "未命名"
        ],
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "description": "测试使用的传参参数姓名",
            "required": true,
            "example": "测试姓名",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "*/*": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string",
                      "description": ""
                    },
                    "msg": {
                      "type": "string",
                      "description": ""
                    },
                    "data": {
                      "type": "string",
                      "description": ""
                    }
                  },
                  "required": [
                    "code",
                    "msg",
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    }
  }
}