{"action":"created","comment":{"url":"https://api.github.com/repos/raml-org/raml-js-parser/pulls/comments/54606556","id":54606556,"diff_hunk":"@@ -0,0 +1,140 @@\n+/* Reject optional scalar parameters */\n+\n+'use strict';\n+\n+if (typeof window === 'undefined') {\n+    var raml           = require('../../lib/raml.js');\n+    var chai           = require('chai');\n+    var chaiAsPromised = require('chai-as-promised');\n+\n+    chai.should();\n+    chai.use(chaiAsPromised);\n+} else {\n+    var raml           = RAML.Parser;\n+\n+    chai.should();\n+}\n+\n+describe('Uri parameter validations', function () {\n+  describe('L2 URI parameters', function () {\n+    it('in baseUriParameters', function (done) {\n+      return raml.load([\n+        '#%RAML 0.8',\n+        'title: Title',\n+        'baseUri: http://domain/{+l2Parameter}',\n+        'baseUriParameters:',\n+        '  l2Parameter:',\n+        '    type: number'\n+      ].join('\\n'), 'api.raml')\n+        .then(function (result) {\n+          setTimeout(function () {\n+            var expected =   {\n+              title: 'Title',\n+              baseUri: 'http://domain/{+l2Parameter}',\n+              baseUriParameters: {\n+                l2Parameter: { type: 'number', displayName: 'l2Parameter', required: true },\n+              },\n+              protocols: [ 'HTTP' ]\n+            };\n+\n+            result.should.deep.equal(expected);\n+            done();\n+          }, 0);\n+        });\n+    });\n+\n+    it('in uriParameters', function (done) {\n+      return raml.load([\n+        '#%RAML 0.8',\n+        'title: Title',\n+        'baseUri: http://domain',\n+        '/resource/{+newParameter}:',\n+        '  uriParameters:',\n+        '    newParameter:',\n+        '      type: number'\n+      ].join('\\n'), 'api.raml')\n+        .then(function (result) {\n+          setTimeout(function () {\n+            var expected =   {\n+              title: 'Title',\n+              baseUri: 'http://domain',\n+              protocols: [ 'HTTP' ],              \n+              resources: [{\n+                uriParameters: {\n+                  newParameter: { type: 'number', displayName: 'newParameter', required: true },\n+                },\n+                \"relativeUri\": \"/resource/{+newParameter}\",\n+                \"relativeUriPathSegments\": [\n+                  \"resource\",\n+                  \"{+newParameter}\"\n+                ]\n+              }]\n+            };\n+\n+            result.should.deep.equal(expected);\n+            done();\n+          }, 0);\n+        }, function (err) {console.log(err)});\n+    });\n+  });\n+\n+  describe('more than one parameter in bracket', function () {\n+    it('in baseUriParameters', function (done) {\n+      return raml.load([\n+        '#%RAML 0.8',\n+        'title: Title',\n+        'baseUri: http://domain/{parameter1,parameter2}/{parameter3,parameter4}'\n+      ].join('\\n'), 'api.raml')\n+        .then(function (result) {\n+          setTimeout(function () {\n+            var expected =   {\n+              title: 'Title',\n+              baseUri: 'http://domain/{parameter1,parameter2}/{parameter3,parameter4}',\n+              protocols: [ 'HTTP' ],\n+              baseUriParameters: {\n+                parameter1: { type: 'string', displayName: 'parameter1', required: true },\n+                parameter2: { type: 'string', displayName: 'parameter2', required: true },\n+                parameter3: { type: 'string', displayName: 'parameter3', required: true },\n+                parameter4: { type: 'string', displayName: 'parameter4', required: true }\n+              },\n+            };\n+\n+            result.should.deep.equal(expected);\n+            done();\n+          }, 0);\n+        }, console.log);\n+    });\n+\n+    it('in uriParameters', function (done) {\n+      return raml.load([\n+        '#%RAML 0.8',\n+        'title: Title',\n+        'baseUri: http://domain',\n+        '/resource/{parameter1,parameter2}:'","path":"test/specs/uriParameters.js","position":113,"original_position":113,"commit_id":"d4b44c5a3cf2eb2381d72c93df50ca13af440a14","original_commit_id":"d4b44c5a3cf2eb2381d72c93df50ca13af440a14","user":{"login":"dmartinezg","id":1099335,"avatar_url":"https://avatars.githubusercontent.com/u/1099335?v=3","gravatar_id":"","url":"https://api.github.com/users/dmartinezg","html_url":"https://github.com/dmartinezg","followers_url":"https://api.github.com/users/dmartinezg/followers","following_url":"https://api.github.com/users/dmartinezg/following{/other_user}","gists_url":"https://api.github.com/users/dmartinezg/gists{/gist_id}","starred_url":"https://api.github.com/users/dmartinezg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmartinezg/subscriptions","organizations_url":"https://api.github.com/users/dmartinezg/orgs","repos_url":"https://api.github.com/users/dmartinezg/repos","events_url":"https://api.github.com/users/dmartinezg/events{/privacy}","received_events_url":"https://api.github.com/users/dmartinezg/received_events","type":"User","site_admin":false},"body":"That is an interesting point, yet, I don't know how to tell the URI template library not to accept these","created_at":"2016-03-01T17:57:19Z","updated_at":"2016-03-01T17:57:19Z","html_url":"https://github.com/raml-org/raml-js-parser/pull/172#discussion_r54606556","pull_request_url":"https://api.github.com/repos/raml-org/raml-js-parser/pulls/172","_links":{"self":{"href":"https://api.github.com/repos/raml-org/raml-js-parser/pulls/comments/54606556"},"html":{"href":"https://github.com/raml-org/raml-js-parser/pull/172#discussion_r54606556"},"pull_request":{"href":"https://api.github.com/repos/raml-org/raml-js-parser/pulls/172"}}},"pull_request":{"url":"https://api.github.com/repos/raml-org/raml-js-parser/pulls/172","id":61278305,"html_url":"https://github.com/raml-org/raml-js-parser/pull/172","diff_url":"https://github.com/raml-org/raml-js-parser/pull/172.diff","patch_url":"https://github.com/raml-org/raml-js-parser/pull/172.patch","issue_url":"https://api.github.com/repos/raml-org/raml-js-parser/issues/172","number":172,"state":"open","locked":false,"title":"Add L2 URI templates/fix issue on determination of varnames in URI templates","user":{"login":"dmartinezg","id":1099335,"avatar_url":"https://avatars.githubusercontent.com/u/1099335?v=3","gravatar_id":"","url":"https://api.github.com/users/dmartinezg","html_url":"https://github.com/dmartinezg","followers_url":"https://api.github.com/users/dmartinezg/followers","following_url":"https://api.github.com/users/dmartinezg/following{/other_user}","gists_url":"https://api.github.com/users/dmartinezg/gists{/gist_id}","starred_url":"https://api.github.com/users/dmartinezg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmartinezg/subscriptions","organizations_url":"https://api.github.com/users/dmartinezg/orgs","repos_url":"https://api.github.com/users/dmartinezg/repos","events_url":"https://api.github.com/users/dmartinezg/events{/privacy}","received_events_url":"https://api.github.com/users/dmartinezg/received_events","type":"User","site_admin":false},"body":"@blakeembrey, @xaka, this brings L2 URI templates, and fixes an issue in the way the parser extracted the variable names from the templates.\r\n\r\nChange is actually very minor, a couple of changes in validator and transformations, and 4 new tests.","created_at":"2016-03-01T17:31:54Z","updated_at":"2016-03-01T17:57:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b9153f313d84730fcf111188839468720f1c8b3e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/raml-org/raml-js-parser/pulls/172/commits","review_comments_url":"https://api.github.com/repos/raml-org/raml-js-parser/pulls/172/comments","review_comment_url":"https://api.github.com/repos/raml-org/raml-js-parser/pulls/comments{/number}","comments_url":"https://api.github.com/repos/raml-org/raml-js-parser/issues/172/comments","statuses_url":"https://api.github.com/repos/raml-org/raml-js-parser/statuses/d4b44c5a3cf2eb2381d72c93df50ca13af440a14","head":{"label":"raml-org:features/add_support_for_l2_uri_templates","ref":"features/add_support_for_l2_uri_templates","sha":"d4b44c5a3cf2eb2381d72c93df50ca13af440a14","user":{"login":"raml-org","id":5579724,"avatar_url":"https://avatars.githubusercontent.com/u/5579724?v=3","gravatar_id":"","url":"https://api.github.com/users/raml-org","html_url":"https://github.com/raml-org","followers_url":"https://api.github.com/users/raml-org/followers","following_url":"https://api.github.com/users/raml-org/following{/other_user}","gists_url":"https://api.github.com/users/raml-org/gists{/gist_id}","starred_url":"https://api.github.com/users/raml-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raml-org/subscriptions","organizations_url":"https://api.github.com/users/raml-org/orgs","repos_url":"https://api.github.com/users/raml-org/repos","events_url":"https://api.github.com/users/raml-org/events{/privacy}","received_events_url":"https://api.github.com/users/raml-org/received_events","type":"Organization","site_admin":false},"repo":{"id":10970624,"name":"raml-js-parser","full_name":"raml-org/raml-js-parser","owner":{"login":"raml-org","id":5579724,"avatar_url":"https://avatars.githubusercontent.com/u/5579724?v=3","gravatar_id":"","url":"https://api.github.com/users/raml-org","html_url":"https://github.com/raml-org","followers_url":"https://api.github.com/users/raml-org/followers","following_url":"https://api.github.com/users/raml-org/following{/other_user}","gists_url":"https://api.github.com/users/raml-org/gists{/gist_id}","starred_url":"https://api.github.com/users/raml-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raml-org/subscriptions","organizations_url":"https://api.github.com/users/raml-org/orgs","repos_url":"https://api.github.com/users/raml-org/repos","events_url":"https://api.github.com/users/raml-org/events{/privacy}","received_events_url":"https://api.github.com/users/raml-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/raml-org/raml-js-parser","description":"A RAML parser based on PyYAML written in CoffeScript and available for use as NodeJs module or in-browser.","fork":false,"url":"https://api.github.com/repos/raml-org/raml-js-parser","forks_url":"https://api.github.com/repos/raml-org/raml-js-parser/forks","keys_url":"https://api.github.com/repos/raml-org/raml-js-parser/keys{/key_id}","collaborators_url":"https://api.github.com/repos/raml-org/raml-js-parser/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/raml-org/raml-js-parser/teams","hooks_url":"https://api.github.com/repos/raml-org/raml-js-parser/hooks","issue_events_url":"https://api.github.com/repos/raml-org/raml-js-parser/issues/events{/number}","events_url":"https://api.github.com/repos/raml-org/raml-js-parser/events","assignees_url":"https://api.github.com/repos/raml-org/raml-js-parser/assignees{/user}","branches_url":"https://api.github.com/repos/raml-org/raml-js-parser/branches{/branch}","tags_url":"https://api.github.com/repos/raml-org/raml-js-parser/tags","blobs_url":"https://api.github.com/repos/raml-org/raml-js-parser/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/raml-org/raml-js-parser/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/raml-org/raml-js-parser/git/refs{/sha}","trees_url":"https://api.github.com/repos/raml-org/raml-js-parser/git/trees{/sha}","statuses_url":"https://api.github.com/repos/raml-org/raml-js-parser/statuses/{sha}","languages_url":"https://api.github.com/repos/raml-org/raml-js-parser/languages","stargazers_url":"https://api.github.com/repos/raml-org/raml-js-parser/stargazers","contributors_url":"https://api.github.com/repos/raml-org/raml-js-parser/contributors","subscribers_url":"https://api.github.com/repos/raml-org/raml-js-parser/subscribers","subscription_url":"https://api.github.com/repos/raml-org/raml-js-parser/subscription","commits_url":"https://api.github.com/repos/raml-org/raml-js-parser/commits{/sha}","git_commits_url":"https://api.github.com/repos/raml-org/raml-js-parser/git/commits{/sha}","comments_url":"https://api.github.com/repos/raml-org/raml-js-parser/comments{/number}","issue_comment_url":"https://api.github.com/repos/raml-org/raml-js-parser/issues/comments{/number}","contents_url":"https://api.github.com/repos/raml-org/raml-js-parser/contents/{+path}","compare_url":"https://api.github.com/repos/raml-org/raml-js-parser/compare/{base}...{head}","merges_url":"https://api.github.com/repos/raml-org/raml-js-parser/merges","archive_url":"https://api.github.com/repos/raml-org/raml-js-parser/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/raml-org/raml-js-parser/downloads","issues_url":"https://api.github.com/repos/raml-org/raml-js-parser/issues{/number}","pulls_url":"https://api.github.com/repos/raml-org/raml-js-parser/pulls{/number}","milestones_url":"https://api.github.com/repos/raml-org/raml-js-parser/milestones{/number}","notifications_url":"https://api.github.com/repos/raml-org/raml-js-parser/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/raml-org/raml-js-parser/labels{/name}","releases_url":"https://api.github.com/repos/raml-org/raml-js-parser/releases{/id}","deployments_url":"https://api.github.com/repos/raml-org/raml-js-parser/deployments","created_at":"2013-06-26T14:49:42Z","updated_at":"2016-02-27T04:20:14Z","pushed_at":"2016-03-01T17:38:41Z","git_url":"git://github.com/raml-org/raml-js-parser.git","ssh_url":"git@github.com:raml-org/raml-js-parser.git","clone_url":"https://github.com/raml-org/raml-js-parser.git","svn_url":"https://github.com/raml-org/raml-js-parser","homepage":"","size":3753,"stargazers_count":166,"watchers_count":166,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":55,"mirror_url":null,"open_issues_count":15,"forks":55,"open_issues":15,"watchers":166,"default_branch":"master"}},"base":{"label":"raml-org:master","ref":"master","sha":"980ce34036149f703205452552be8a970049cacc","user":{"login":"raml-org","id":5579724,"avatar_url":"https://avatars.githubusercontent.com/u/5579724?v=3","gravatar_id":"","url":"https://api.github.com/users/raml-org","html_url":"https://github.com/raml-org","followers_url":"https://api.github.com/users/raml-org/followers","following_url":"https://api.github.com/users/raml-org/following{/other_user}","gists_url":"https://api.github.com/users/raml-org/gists{/gist_id}","starred_url":"https://api.github.com/users/raml-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raml-org/subscriptions","organizations_url":"https://api.github.com/users/raml-org/orgs","repos_url":"https://api.github.com/users/raml-org/repos","events_url":"https://api.github.com/users/raml-org/events{/privacy}","received_events_url":"https://api.github.com/users/raml-org/received_events","type":"Organization","site_admin":false},"repo":{"id":10970624,"name":"raml-js-parser","full_name":"raml-org/raml-js-parser","owner":{"login":"raml-org","id":5579724,"avatar_url":"https://avatars.githubusercontent.com/u/5579724?v=3","gravatar_id":"","url":"https://api.github.com/users/raml-org","html_url":"https://github.com/raml-org","followers_url":"https://api.github.com/users/raml-org/followers","following_url":"https://api.github.com/users/raml-org/following{/other_user}","gists_url":"https://api.github.com/users/raml-org/gists{/gist_id}","starred_url":"https://api.github.com/users/raml-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raml-org/subscriptions","organizations_url":"https://api.github.com/users/raml-org/orgs","repos_url":"https://api.github.com/users/raml-org/repos","events_url":"https://api.github.com/users/raml-org/events{/privacy}","received_events_url":"https://api.github.com/users/raml-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/raml-org/raml-js-parser","description":"A RAML parser based on PyYAML written in CoffeScript and available for use as NodeJs module or in-browser.","fork":false,"url":"https://api.github.com/repos/raml-org/raml-js-parser","forks_url":"https://api.github.com/repos/raml-org/raml-js-parser/forks","keys_url":"https://api.github.com/repos/raml-org/raml-js-parser/keys{/key_id}","collaborators_url":"https://api.github.com/repos/raml-org/raml-js-parser/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/raml-org/raml-js-parser/teams","hooks_url":"https://api.github.com/repos/raml-org/raml-js-parser/hooks","issue_events_url":"https://api.github.com/repos/raml-org/raml-js-parser/issues/events{/number}","events_url":"https://api.github.com/repos/raml-org/raml-js-parser/events","assignees_url":"https://api.github.com/repos/raml-org/raml-js-parser/assignees{/user}","branches_url":"https://api.github.com/repos/raml-org/raml-js-parser/branches{/branch}","tags_url":"https://api.github.com/repos/raml-org/raml-js-parser/tags","blobs_url":"https://api.github.com/repos/raml-org/raml-js-parser/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/raml-org/raml-js-parser/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/raml-org/raml-js-parser/git/refs{/sha}","trees_url":"https://api.github.com/repos/raml-org/raml-js-parser/git/trees{/sha}","statuses_url":"https://api.github.com/repos/raml-org/raml-js-parser/statuses/{sha}","languages_url":"https://api.github.com/repos/raml-org/raml-js-parser/languages","stargazers_url":"https://api.github.com/repos/raml-org/raml-js-parser/stargazers","contributors_url":"https://api.github.com/repos/raml-org/raml-js-parser/contributors","subscribers_url":"https://api.github.com/repos/raml-org/raml-js-parser/subscribers","subscription_url":"https://api.github.com/repos/raml-org/raml-js-parser/subscription","commits_url":"https://api.github.com/repos/raml-org/raml-js-parser/commits{/sha}","git_commits_url":"https://api.github.com/repos/raml-org/raml-js-parser/git/commits{/sha}","comments_url":"https://api.github.com/repos/raml-org/raml-js-parser/comments{/number}","issue_comment_url":"https://api.github.com/repos/raml-org/raml-js-parser/issues/comments{/number}","contents_url":"https://api.github.com/repos/raml-org/raml-js-parser/contents/{+path}","compare_url":"https://api.github.com/repos/raml-org/raml-js-parser/compare/{base}...{head}","merges_url":"https://api.github.com/repos/raml-org/raml-js-parser/merges","archive_url":"https://api.github.com/repos/raml-org/raml-js-parser/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/raml-org/raml-js-parser/downloads","issues_url":"https://api.github.com/repos/raml-org/raml-js-parser/issues{/number}","pulls_url":"https://api.github.com/repos/raml-org/raml-js-parser/pulls{/number}","milestones_url":"https://api.github.com/repos/raml-org/raml-js-parser/milestones{/number}","notifications_url":"https://api.github.com/repos/raml-org/raml-js-parser/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/raml-org/raml-js-parser/labels{/name}","releases_url":"https://api.github.com/repos/raml-org/raml-js-parser/releases{/id}","deployments_url":"https://api.github.com/repos/raml-org/raml-js-parser/deployments","created_at":"2013-06-26T14:49:42Z","updated_at":"2016-02-27T04:20:14Z","pushed_at":"2016-03-01T17:38:41Z","git_url":"git://github.com/raml-org/raml-js-parser.git","ssh_url":"git@github.com:raml-org/raml-js-parser.git","clone_url":"https://github.com/raml-org/raml-js-parser.git","svn_url":"https://github.com/raml-org/raml-js-parser","homepage":"","size":3753,"stargazers_count":166,"watchers_count":166,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":55,"mirror_url":null,"open_issues_count":15,"forks":55,"open_issues":15,"watchers":166,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/raml-org/raml-js-parser/pulls/172"},"html":{"href":"https://github.com/raml-org/raml-js-parser/pull/172"},"issue":{"href":"https://api.github.com/repos/raml-org/raml-js-parser/issues/172"},"comments":{"href":"https://api.github.com/repos/raml-org/raml-js-parser/issues/172/comments"},"review_comments":{"href":"https://api.github.com/repos/raml-org/raml-js-parser/pulls/172/comments"},"review_comment":{"href":"https://api.github.com/repos/raml-org/raml-js-parser/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/raml-org/raml-js-parser/pulls/172/commits"},"statuses":{"href":"https://api.github.com/repos/raml-org/raml-js-parser/statuses/d4b44c5a3cf2eb2381d72c93df50ca13af440a14"}}}}