lib/common.js
function addResponse(response, options) {
    addToCommon({
        schemaKey: schemaIds.response,
        object: response,
        targetObject: state.common.responses,
        displayName: 'response'
    }, options);
}
function addResponse(response, options) {
    addToCommon({
        schemaKey: schemaIds.response,
        object: response,
        targetObject: state.common.responses,
        displayName: 'response'
    }, options);
}
function addResponse ( response , options ) { addToCommon ( { schemaKey : schemaIds . response , object : response , targetObject : state . common . responses , displayName : 'response' } , options ) ; }
Adds a common response for later use.
@paramSchema response ./lib/schemas/response.json
@param {object} response Describes a single response from an API Operation.
@param {string} response.description - **Required.** A short description of the response. [GFM syntax](https://help.github.com/articles/github-flavored-markdown) can be used for rich text representation.
@param {object} [response.schema] - A definition of the response structure. It can be a primitive, an array or an object. If this field does not exist, it means no content is returned as part of the response. As an extension to the [Schema Object](http://swagger.io/specification/#schemaObject), its root type value may also be `file`. This SHOULD be accompanied by a relevant produces mime-type.
@param {object} [response.headers] - A list of headers that are sent with the response. See [http://swagger.io/specification/#headersObject](http://swagger.io/specification/#headersObject)
@param {object} [response.examples] - An example of the response message. See [http://swagger.io/specification/#exampleObject](http://swagger.io/specification/#exampleObject)
@param {string} response.name - The name or http status code used to refer to this response at a later stage.
@param {string} [response.model] - The name of the model produced or consumed.
@param {string} [response.arrayOfModel] - The name of the model produced or consumed as an array.
@param {AddCommonItemOptions} [options] - Options to apply when adding the provided item.
@returns {void}
@example
var swagger = require('swagger-spec-express');
swagger.common.addResponse({
name: "500",
description: "Server Error",
"schema": {
$ref: "#/definitions/serverError"
}
});
//...
router.get('/', function (req, res) {
//...
}).describe({
//...
common: {
//...
responses: ["500", "400", "401", "404"],
//...
}
//...
});
Adds a common response for later use .