我正在尝试为 Webcase Create session 创建 OpenAPI 定义。这是我的 YAML 代码:
openapi: '3.0.0'
info:
title: WebcastCreateMeeting
version: "1.1"
servers:
- url: https://api.webcasts.com/api
paths:
'/event/create':
post:
tags:
- CreateMeetingCallbody
summary: EventGM
parameters:
- in: path
name: event_title # >> line 15
description: name of the event from Cvent
required: true
schema:
type: string
responses:
200:
description: This would be the response.
content:
application/json;charset=utf-8:
schema:
type: array
items:
properties:
scheduled_duration:
type: integer
example: 30
event_id:
type: integer
example: 0000000
event_title:
type: string
example: Cvent Testing sync event
我在 Swagger 编辑器中看到的错误是:Semantic error at paths./event/create.post.parameters.0.name
Path parameter "event_title" must have the corresponding {event_title} segment in the "/event/create" path
Jump to line 15
这个错误是什么意思以及如何修复它?
最佳答案
使用路径参数 ( in: path
) 时,路径必须在大括号中包含参数名称 { }
, 指示该参数在路径中的确切位置。
paths:
'/event/create/{event_title}':
见 Describing Path Parameters详情。
关于swagger - 如何修复 Swagger 编辑器中的 "Path parameter ... must have the corresponding {...} segment in the/path"错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62754001/