Skip to content

Commit

Permalink
allow colon in apiDefine (apidoc#1021)
Browse files Browse the repository at this point in the history
  • Loading branch information
esaracco authored Oct 11, 2021
1 parent caa8cb6 commit a5651e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion example/example.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
/**
* @apiDefine admin:computer User access only
* This optional description belong to to the group admin.
*/

/**
* @api {get} /user/:region/:id/:opt Read data of a User
* @apiVersion 0.3.0
* @apiName GetUser
* @apiGroup User
* @apiPermission admin
* @apiPermission admin:computer
*
* @apiDescription Compare version 0.3.0 with 0.2.0 and you will see the green markers with new items in version 0.3.0 and red markers with removed items since 0.2.0.
*
Expand Down
4 changes: 2 additions & 2 deletions lib/core/parsers/api_define.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function parse (content, source, messages) {

content = content.trim();

const parseRegExp = /^(\w*)(.*?)(?:\s+|$)(.*)$/gm;
const parseRegExp = /^([\w:]*)(.*?)(?:\s+|$)(.*)$/gm;
let matches = parseRegExp.exec(content);

if (!matches) { return null; }
Expand All @@ -27,7 +27,7 @@ function parse (content, source, messages) {
}

if (matches[2] !== '') {
throw new ParameterError('Name must contain only alphanumeric characters.',
throw new ParameterError('Name must contain only alphanumeric and colon characters.',
messages.common.element, messages.common.usage, messages.common.example);
}

Expand Down

0 comments on commit a5651e6

Please sign in to comment.