From e5adbf4f56c9ab4241e4e3caba9283db6093dad3 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Wed, 26 Nov 2014 11:20:05 +0100 Subject: [PATCH] properly display required pathParams in Foxx documentation do not restrict route summary to 60 characters --- js/server/modules/org/arangodb/foxx/internals.js | 5 +++-- .../modules/org/arangodb/foxx/request_context.js | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/js/server/modules/org/arangodb/foxx/internals.js b/js/server/modules/org/arangodb/foxx/internals.js index 2c8cbd161a..1b4b5afe74 100644 --- a/js/server/modules/org/arangodb/foxx/internals.js +++ b/js/server/modules/org/arangodb/foxx/internals.js @@ -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 }; }; diff --git a/js/server/modules/org/arangodb/foxx/request_context.js b/js/server/modules/org/arangodb/foxx/request_context.js index 75f9a4976f..5498e22d5a 100644 --- a/js/server/modules/org/arangodb/foxx/request_context.js +++ b/js/server/modules/org/arangodb/foxx/request_context.js @@ -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;