Apigee 招摇过市:路径参数有问题

Apigee 招摇过市:路径参数有问题,apigee,swagger,Apigee,Swagger,我正在尝试使用以下路径创建一个招摇过市文件: 路径: /v1/customers/{id}/摘要: 但是,我立即得到以下错误: API需要路径参数,但未定义:id 在小路上▹ /v1/customers/{id}/summary 它似乎不喜欢“id”参数。有人能告诉我如何纠正这个问题吗 如果我深入研究这一点,我会看到以下内容: Details Object swaggerError: Object errors: Array [1] 0: Object code: "MISSING_A

我正在尝试使用以下路径创建一个招摇过市文件: 路径: /v1/customers/{id}/摘要:

但是,我立即得到以下错误:

API需要路径参数,但未定义:id 在小路上▹ /v1/customers/{id}/summary

它似乎不喜欢“id”参数。有人能告诉我如何纠正这个问题吗

如果我深入研究这一点,我会看到以下内容:

Details
 Object
 swaggerError: Object
 errors: Array [1]
 0: Object
code:  "MISSING_API_PATH_PARAMETER"
message:  "API requires path parameter but it is not defined: id"
data:  "/v1/customers/{id}/summary"
 path: Array [2]
 warnings: Array [0]

基本上,您是通过使用路径模板来声明一个包含路径参数的路径。在本例中,
{id}
声明一个名为
id
的路径参数

当您声明这样一个路径时,这意味着您必须将该路径参数声明为操作的一部分

看看这个YAML示例:

  /pets/{id}:
    get:
      description: Returns a user based on a single ID, if the user does not have access to the pet
      operationId: findPetById
      produces:
        - application/json
        - application/xml
        - text/xml
        - text/html
      parameters:
        - name: id
          in: path
          description: ID of pet to fetch
          required: true
          type: integer
          format: int64
      responses:
        '200':
          description: pet response
          schema:
            $ref: '#/definitions/pet'
        default:
          description: unexpected error
          schema:
            $ref: '#/definitions/errorModel'

您可以看到路径中有一个
{id}
,以及相应的
id
参数定义。如果没有它,规范将无效。

您使用的是哪种招摇过市的版本?你是如何创建规范的?我使用的是Swagger 2.0。我从Apigee_127的命令行创建规范&填充编辑器中创建的YAML文件。希望这能回答问题。如果我深入研究错误,我会得到以下结果:还要注意,required是必需的,并且需要将其设置为true@Ron嗨,罗恩,你能看看这个问题吗?让我知道你对这个问题的看法。我知道你得到了迪利普的答复。他是《春狐》的作者,也是你将得到的最好的答复。