How to fix the "Path parameter ... must have the corresponding {...} segment in the /path" error in Swagger Editor?

Viewed 4213

I am trying to create OpenAPI definition for a Webcase Create meeting. This is my YAML code:

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

The error I see in the Swagger Editor is:

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

What does this error mean and how to fix it?

1 Answers

When using path parameters (in: path), the path must include the parameter name in curly braces { }, to indicate where exactly in the path that parameter is inserted.

paths:
  '/event/create/{event_title}':

See Describing Path Parameters for details.

Related