const parseResponses = function (route) {
  const responses = {}
  let specObject = get(route, 'config.response.status')

  // Get the pairs and sort by HTTP code (lower first)
  const specPairs = Object.entries(specObject).sort((a, b) => a[0] - b[0])

  // For each response
  for (const [code, response] of specPairs) {
    // Get its info and any reference id
    const info = response.describe()

    if (code === '204') { // No body reply
      responses[code.toString()] = {description: info.description}
    } else { // Assign the new response, either with a reference or by converting the object
      responses[code.toString()] = {
        description: info.description,
        content: {
          'application/json': {
            schema: addReference(response)
          }
        }
      }
    }
  }

  return responses
}