0

I am trying to generate the API documentation using swagger editor. I specified my API specification as follow

paths:
  /opendata/v1/{index}:
    get:
      tags: [verification]
      description: Verify the person information
      parameters:
        - name: index
          in: path
          description: specific data index
          required: true
          type: string
        - name: name
          in: query
          description: name of a person
          required: false
          type: string
        - name: company name
          in: query
          description: name of a company
          required: false
          type: string

      responses:
        '200':
          description: Success
          content:
            application/json:
              schemas:
                $ref: '#/responses/200'



responses:
    '200':
      description: Success
      schema:
        type: object
        properties:
          verification:
            type: string

But its always showing error in the editor that "Not a valid response definition". I checked the specification for response from here. What changes I should do so that error will not come.

Note: I want the response in the json form like below:

{
    verification:string
}
neha
  • 1,858
  • 5
  • 21
  • 35

1 Answers1

0

You are mixing OpenAPI/Swagger 2.0 and OpenAPI 3.0 syntax. Your spec seems to be swagger: '2.0', so you should use:

paths:
  /opendata/v1/{index}:
    get:
      ...

      produces:
        - application/json
      responses:
        200:
          $ref: '#/responses/200'

Here's a related OpenAPI/Swagger 2.0 guide: Describing Responses

Helen
  • 87,344
  • 17
  • 243
  • 314
  • Thanks, yeah I was referring openApi 3.0 and swagger2.0 that's why I was facing the problem. It got resolved now. – neha Dec 05 '17 at 12:53