swagger - “=”在 Swagger 路径参数中是什么意思?
问题描述
=
以下 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/*”需要在路径或操作级别定义为路径参数
解决方案
我相信这个招摇规范是自动生成的,并且=TEXT
在{param}
块内是一个错误。我已将此作为https://github.com/grafeas/grafeas/issues/379提出。
推荐阅读
- c# - C# 在另一个系统上使用已发布的程序
- java - 如何在android中获取可绘制的图像路径?
- php - 如何隐藏数据库的数据但将其显示为交互式可视化?
- angular - 找不到 Angular 5 的 html 模板文件
- android - 当调试器关闭但在打开时运行
- facebook-opengraph - 在路径(对象)和“属性”中发现冲突的 og:类型
- ios - CardPlayer 卡未加载
- mongoose - 使用填充时执行了多少个数据库查询?
- laravel - Laravel 5.7 OpenSSL SSL_connect:SSL_ERROR_SYSCALL 连接到 graph.facebook.com:443
- android - 带有条件的Android firebase列表视图