Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.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
Api YAML语法错误:不完整的显式映射对;此时缺少一个关键节点_Api_Swagger_Specifications_Swagger Editor - Fatal编程技术网

Api YAML语法错误:不完整的显式映射对;此时缺少一个关键节点

Api YAML语法错误:不完整的显式映射对;此时缺少一个关键节点,api,swagger,specifications,swagger-editor,Api,Swagger,Specifications,Swagger Editor,我正在用YAML编写招摇过市的规范,并且出现了模糊的错误。我已经映射了我认为正确的路径和定义,但不确定此错误的含义: YAML语法错误不完整的显式映射对;关键节点是 第66行第30列缺失:格式:int64schema:^t 线路: Line 65: type: integer Line 66: format: int64 昂首阔步: /product/{productId}: get: tags: - content

我正在用YAML编写招摇过市的规范,并且出现了模糊的错误。我已经映射了我认为正确的路径和定义,但不确定此错误的含义:

YAML语法错误不完整的显式映射对;关键节点是 第66行第30列缺失:格式:int64schema:^t

线路:

 Line 65:         type: integer
 Line 66:         format: int64
昂首阔步:

  /product/{productId}:
    get:
      tags:
        - content
      summary: Find product item by ID
      description: Returns a product item when ID < 10.  ID > 10 or nonintegers will simulate API error conditions
      operationId: getProductItemByID
      produces:
        - application/json
        - application/xml
      parameters:
        - in: path
          name: productId
          description: ID of menu item that needs to be fetched
          required: true
          type: integer
          format: int64
          schema:
            $ref: "#/definitions/Product"
      responses:
        "404":
          description: Product item not found
        "200":
          description: successful operation
          schema:
            $ref: "#/definitions/Product"
        "400":
          description: Invalid ID supplied
      security:
        - api_key: []
        - my_auth:
          - write
          - read
从,如果“in”参数是“path”,则不能使用架构。 我认为这是一个错误,您应该使用:

/product/{productId}:
  get:
    tags:
      - content
    summary: Find product item by ID
    description: Returns a product item when ID < 10.  ID > 10 or nonintegers will simulate API error conditions
    operationId: getProductItemByID
    produces:
      - application/json
      - application/xml
    parameters:
      - in: path
        name: productId
        description: ID of menu item that needs to be fetched
        required: true
        type: integer
        format: int64
    responses:
      "404":
        description: Product item not found
      "200":
        description: successful operation
        schema:
          $ref: "#/definitions/Product"
      "400":
        description: Invalid ID supplied
...
/product/{productId}:
获取:
标签:
-内容
摘要:按ID查找产品项
描述:当ID<10时返回产品项。ID>10或非整数将模拟API错误条件
操作ID:getProductItemByID
生产:
-应用程序/json
-应用程序/xml
参数:
-在:路径
名称:productId
description:需要提取的菜单项的ID
必填项:true
类型:整数
格式:int64
响应:
"404":
说明:找不到产品项
"200":
说明:操作成功
模式:
$ref:“#/定义/产品”
"400":
描述:提供的ID无效
...

YAML解析的这两个部分没有这个或任何错误,只需将逐字粘贴到主解析器中即可-至少我现在这样做了•…粘贴后插入第一行,说“第一部分:”,那么现在两个部分都有相同的缩进级别•你知道会发生这种情况吗那你以前为什么会犯这个错误呢-因为YAML规范已经更新,所以没有这个错误?
/product/{productId}:
  get:
    tags:
      - content
    summary: Find product item by ID
    description: Returns a product item when ID < 10.  ID > 10 or nonintegers will simulate API error conditions
    operationId: getProductItemByID
    produces:
      - application/json
      - application/xml
    parameters:
      - in: path
        name: productId
        description: ID of menu item that needs to be fetched
        required: true
        type: integer
        format: int64
    responses:
      "404":
        description: Product item not found
      "200":
        description: successful operation
        schema:
          $ref: "#/definitions/Product"
      "400":
        description: Invalid ID supplied
...