【问题标题】:What does "=" mean within Swagger path parameter?“=”在 Swagger 路径参数中是什么意思?
【发布时间】:2019-09-15 05:55:27
【问题描述】:

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

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时,我得到了以下形式的错误:

需要定义声明的路径参数“name=projects/*/notes/*” 作为路径或操作级别的路径参数

【问题讨论】:

    标签: swagger openapi grafeas


    【解决方案1】:

    我相信这个招摇规范是自动生成的,{param} 块中的 =TEXT 是一个错误。我已将其提出为https://github.com/grafeas/grafeas/issues/379

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-03-12
      • 2023-04-06
      • 2022-09-28
      • 1970-01-01
      • 2022-07-26
      • 1970-01-01
      • 2023-04-03
      • 1970-01-01
      相关资源
      最近更新 更多