Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swagger 招摇过市:Get方法使用的body不起作用,也更改为查询、路径、头仍然不起作用_Swagger_Swagger Ui_Swagger 2.0_Openapi_Swagger Editor - Fatal编程技术网

Swagger 招摇过市:Get方法使用的body不起作用,也更改为查询、路径、头仍然不起作用

Swagger 招摇过市:Get方法使用的body不起作用,也更改为查询、路径、头仍然不起作用,swagger,swagger-ui,swagger-2.0,openapi,swagger-editor,Swagger,Swagger Ui,Swagger 2.0,Openapi,Swagger Editor,到目前为止,我正在制作openapi.yaml,并在谷歌云端点上部署我的测试API正在工作,但现在我做了一些更改,我正在将参数发送到get API(例如电子邮件)并且得到了一些响应,但实际上在本地,部署openapi.yaml文件后,它与postman的工作情况良好。它在google cloud endponits门户上不起作用 所以,任何人对此有任何解决方案或答案,请帮助我 为了安全起见,我还分享了错误截图和y代码片段 "/api/getRecords": get: descri

到目前为止,我正在制作openapi.yaml,并在谷歌云端点上部署我的测试API正在工作,但现在我做了一些更改,我正在将参数发送到get API(例如电子邮件)并且得到了一些响应,但实际上在本地,部署openapi.yaml文件后,它与postman的工作情况良好。它在google cloud endponits门户上不起作用

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

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

"/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:
而且


尝试以下代码:

# [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"

在OpenAPI 2.0中,查询参数不能是对象,只能是基元值或基元数组。是否应该在请求正文中发送
echoMessage
对象?如果是这样,请将HTTP方法更改为
post
,将参数类型更改为
in:body
,并删除
type
。如果我更改为string,然后仍然无法工作(type:string),我无法将更改的每个HTTP post方法改为Get