lib/common.js
function addBodyParameter(body, options) {
    addToCommon({
        schemaKey: schemaIds.parameter.body,
        in: 'body',
        object: body,
        targetObject: state.common.parameters.body,
        displayName: 'body parameter'
    }, options);
}
function addBodyParameter(body, options) {
    addToCommon({
        schemaKey: schemaIds.parameter.body,
        in: 'body',
        object: body,
        targetObject: state.common.parameters.body,
        displayName: 'body parameter'
    }, options);
}
function addBodyParameter ( body , options ) { addToCommon ( { schemaKey : schemaIds . parameter . body , in : 'body' , object : body , targetObject : state . common . parameters . body , displayName : 'body parameter' } , options ) ; }
Adds a common body parameter for later use.
@paramSchema body ./lib/schemas/body-parameter.json
@param {object} body The payload that's appended to the HTTP request. Since there can only be one payload, there can only be one body parameter. The name of the body parameter has no effect on the parameter itself and is used for documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist together for the same operation.
@param {string} [body.description] - A brief description of the parameter. This could contain examples of use.  GitHub Flavored Markdown is allowed.
@param {string} [body.name] - The name of the parameter.
@param {string} [body.in] - Determines the location of the parameter.
@param {boolean} [body.required] - Determines whether or not this parameter is required or optional.
@param {object} [body.schema] - A deterministic version of a JSON Schema object.
@param {string} [body.model] - The name of the model produced or consumed.
@param {string} [body.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.parameters.addBody({
name: "process",
description: "Kicks off the process function on the server at the rest endpoint using the options provided",
required: true,
type: "object",
schema : {
type: "object",
properties: {
"async": {
"type": "boolean"
}
}
additionalProperties: true
}
});
//...
router.get('/', function (req, res) {
//...
}).describe({
//...
common: {
//...
parameters: {
body: ["process"]
}
//...
}
//...
});
Adds a common body parameter for later use .