1
0
Fork 0

properly display required pathParams in Foxx documentation

do not restrict route summary to 60 characters
This commit is contained in:
Jan Steemann 2014-11-26 11:20:05 +01:00
parent a8282f8220
commit e5adbf4f56
2 changed files with 9 additions and 8 deletions

View File

@ -133,13 +133,14 @@ constructRoute = function (method, route, callback, controller, constraints) {
};
};
constructPathParamDoc = function (paramName, description, dataType) {
constructPathParamDoc = function (paramName, description, dataType, required) {
'use strict';
return {
paramType: "path",
name: paramName,
description: description,
dataType: dataType
dataType: dataType,
required: required
};
};

View File

@ -138,9 +138,9 @@ extend(SwaggerDocs.prototype, {
this.docs.nickname = internal.constructNickname(httpMethod, match);
},
addPathParam: function (paramName, description, dataType) {
addPathParam: function (paramName, description, dataType, required) {
'use strict';
this.docs.parameters.push(internal.constructPathParamDoc(paramName, description, dataType));
this.docs.parameters.push(internal.constructPathParamDoc(paramName, description, dataType, required));
},
addQueryParam: function (paramName, description, dataType, required, allowMultiple) {
@ -279,7 +279,7 @@ extend(RequestContext.prototype, {
} else {
type = cfg.type;
}
required = Boolean(cfg.flags && cfg.flags.presense === 'required');
required = Boolean(cfg.flags && cfg.flags.presence === 'required');
description = cfg.description;
if (
type === 'number' &&
@ -302,7 +302,7 @@ extend(RequestContext.prototype, {
throw new Error("Illegal attribute type: " + regexType);
}
this.route.url = internal.constructUrlObject(url.match, urlConstraint, url.methods[0]);
this.docs.addPathParam(paramName, description, type);
this.docs.addPathParam(paramName, description, type, required);
return this;
},
@ -490,8 +490,8 @@ extend(RequestContext.prototype, {
summary: function (summary) {
'use strict';
if (summary.length > 60) {
throw new Error("Summary can't be longer than 60 characters");
if (summary.length > 8192) {
throw new Error("Summary can't be longer than 8192 characters");
}
this.docs.addSummary(summary);
return this;