Serverless-aws-documentation调整参数

时间:2019-05-23 10:26:10

标签: serverless

当我使用serverless openapi generate时,生成的openapi.yaml不包含任何参数

我尝试使用参数而不是queryParams和pathParams

functions:
  get:
    handler: retransmit/get.get
    events:
      - http:
          path: retransmit/{game_id}/{camera_id}
          method: get
          cors: true
          documentation:
            summary: "Fetch frame_id"
            description: "Fetch frame_id ranges for given grab_id and camera_id"
            queryParams:
              - name: "game_id"
                description: "app id"
                required: true
              - name: "camera_id"
                description: "user id or 'my'"
                required: true

错误:

Semantic error at paths./retransmit/{game_id}/{camera_id}
Declared path parameter "game_id" needs to be defined as a path parameter at either the path or operation level
Jump to line 27
Semantic error at paths./retransmit/{game_id}/{camera_id}
Declared path parameter "camera_id" needs to be defined as a path parameter at either the path or operation level
Jump to line 27

1 个答案:

答案 0 :(得分:0)

queryParams 更改为 pathParams

functions:
  get:
    handler: retransmit/get.get
    events:
      - http:
          path: retransmit/{game_id}/{camera_id}
          method: get
          cors: true
          documentation:
            summary: "Fetch frame_id"
            description: "Fetch frame_id ranges for given grab_id and camera_id"
            pathParams:
              - name: "game_id"
                description: "app id"
                required: true
              - name: "camera_id"
                description: "user id or 'my'"
                required: true