Swagger:使用主体的Get方法不起作用,也更改为查询,路径,标题仍然不起作用

问题描述 投票:1回答:1

我到目前为止一直在制作openapi.yaml以及在谷歌云端点上部署我的测试API都可以,但是现在我进行了一些更改,我在体内将参数发送到get api(例如电子邮件)并获得了一些响应,但实际上在本地,在部署openapi.yaml文件后,它与邮递员可以正常工作,但在google cloud endponits门户网站上却不起作用

所以,任何人对此都有任何解决方案或答案,请帮助我

为了安全起见,我也分享错误截图和代码片段

"/api/getRecords":
   get:
    description: "Get All Records Details."
    operationId: "getRecords"
    produces:
      - "application/json"    
    parameters:
    - description: "Message to getRecords"
      in: query
      name: getRecords
      type: object
      required: false
      schema:
        $ref: "#/definitions/echoMessage"         
    responses:
      200:

也,

enter image description here

swagger swagger-ui swagger-2.0 openapi swagger-editor
1个回答
1
投票

尝试这样的代码:

# [START swagger]
  swagger: "2.0"
  info:
    description: "A simple Google Cloud Endpoints API example."
    title: "Endpoints Example"
    version: "1.0.0"
  host: "abc.appspot.com"
# [END swagger]
  parameters:
    email:
      name: email
      in: query
      type: string
      required: true

然后在路径中使用速记语法:

path:
 "/api/getRecords":
   get:
     description: "Get All Records Details."
     operationId: "getRecords"
     parameters:
       - $ref: "#/parameters/email"
     responses:
       200:
         description: "Get records details"
         schema:
           $ref: "#/definitions/postMessage"

它将起作用。

© www.soinside.com 2019 - 2024. All rights reserved.