0

I want my OpenAPI spec to display the list of both the objects like below but I'm unable to do so.

[
  {
    "studentID": 1,
    "studentName": "Ram"
  },
  {
    "studentID": 2,
    "studentName": "Shyam"
  }
]

Swagger Spec in editor.swagger.io:

enter image description here

1

1 Answer 1

0

example keyword should be at the same level of items:

200:
  description: success response
  content:
    application/json:
      schema:
        type: array
        items:
          properties:
            studentID:
              type: integer
            studentName:
              type: string
        example:
          - { "studentID": 1, "studentName": "Ram" }
          - { "studentID": 2, "studentName": "Shyam" }
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.