Adding schema

To add a new schema, simply add a schema object to the components object.

Results

  • The schema name.
  • The structure of the schema object. There is a lot of flexibility here. Use this to guide you: http://swagger.io/specification/#schemaObject. Note that a schema object can contain another schema object, by way of reference to it. For example, see the "address" field. Consider this simple model as a further example of a schema object in the following section.
Headers that are returned with responses can be described by adding a headers property for each responses object. For example, adding a header named Location to the response of a POST request where a resource is created:
"responses": {
  "201": {
    "description": "The operation was successful.",
    "content": {}
    "headers": {
     "Location": {
       "description": "The URI of the currency.",
       "schema": {
         "type": "string"
       }
      }
    },

For more information about OpenAPI specifications, refer to https://swagger.io/specification/.