Swagger path参数中的“ =”是什么意思?

时间:2019-09-15 05:55:27

标签: swagger openapi grafeas

在以下OpenApi / Swagger规范的path参数中,“ =”是什么意思?

https://github.com/grafeas/grafeas/blob/master/proto/v1beta1/swagger/grafeas.swagger.json#L18

这是摘录(出于可读性,已从JSON转换为YAML):

swagger: '2.0'
info:
  title: grafeas.proto
  version: version not set
schemes:
  - http
  - https
consumes:
  - application/json
produces:
  - application/json
paths:
  '/v1beta1/{name=projects/*/notes/*}':
    get:
      summary: Gets the specified note.
      operationId: GetNote
      responses:
        '200':
          description: A successful response.
          schema:
            $ref: '#/definitions/v1beta1Note'
      parameters:
        - name: name
          description: |-
            The name of the note in the form of
            `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
          in: path
          required: true
          type: string
      tags:
        - GrafeasV1Beta1

路径定义为/v1beta1/{name=projects/*/notes/*},并且定义了名为name的参数,但是当我将整个.json放入https://editor.swagger.io时,会出现以下形式的错误:

  

声明的路径参数“名称=项目/ * /注释/ *”需要定义   作为路径或操作级别的路径参数

1 个答案:

答案 0 :(得分:0)

我认为此规范是自动生成的,并且=TEXT内的{param}属于错误。我将其举为https://github.com/grafeas/grafeas/issues/379