Swagger response returns multiple instances

use swagger 2.0 to generate documents, and you now expect response to return multiple instances. However, the official examples are all for one schema instance, so ask for help on how to write the information that returns multiple instances.


create a new class, including those instances, and write the new class


in response.

official examples are directly returned to schema without a package key, ignoring that you can wrap it with object. The problem has been resolved, and the code is as follows

"get": {
  "tags": [
    "option_types"
    ],
  "responses": {
    "200": {
    "description": "optionType: {}; OptionValues: []",
    "schema": {
      "type": "object",
      "properties": {
        "option_type": {
          "$ref": "-sharp/definitions/OptionType"
          },
        "option_values": {
          "type": "array",
          "items": {
            "$ref": "-sharp/definitions/OptionValue"
            }
          }
        }
      }
    }
  }
}
Menu