【发布时间】: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/*” 作为路径或操作级别的路径参数
【问题讨论】: