mirror of https://gitee.com/bigwinds/arangodb
Add simple documentation for methods without bodyParam
post, put and patch requests without a bodyParam will now be documented with an undocumented bodyParam. This will allow people to try out this undocumented field in the Swagger documentation in the admin interface.
This commit is contained in:
parent
ea9ea54de5
commit
b9d4a96652
|
@ -174,6 +174,11 @@ extend(Controller.prototype, {
|
|||
|
||||
this.applicationContext.clearComments();
|
||||
|
||||
if (method === 'post' || method === 'put' || method === 'patch') {
|
||||
var UndocumentedBody = require('org/arangodb/foxx').Model.extend();
|
||||
requestContext.bodyParam("undocumented body", "Undocumented body param", UndocumentedBody);
|
||||
}
|
||||
|
||||
return requestContext;
|
||||
},
|
||||
|
||||
|
|
|
@ -144,12 +144,22 @@ extend(SwaggerDocs.prototype, {
|
|||
'use strict';
|
||||
this.models[jsonSchema.id] = jsonSchema;
|
||||
|
||||
this.docs.parameters.push({
|
||||
name: paramName,
|
||||
paramType: "body",
|
||||
description: description,
|
||||
dataType: jsonSchema.id
|
||||
var param = _.find(this.docs.parameters, function (parameter) {
|
||||
return parameter.name === 'undocumented body';
|
||||
});
|
||||
|
||||
if (_.isUndefined(param)) {
|
||||
this.docs.parameters.push({
|
||||
name: paramName,
|
||||
paramType: "body",
|
||||
description: description,
|
||||
dataType: jsonSchema.id
|
||||
});
|
||||
} else {
|
||||
param.name = paramName;
|
||||
param.description = description;
|
||||
param.dataType = jsonSchema.id;
|
||||
}
|
||||
},
|
||||
|
||||
addSummary: function (summary) {
|
||||
|
|
Loading…
Reference in New Issue