{"action":"created","comment":{"url":"https://api.github.com/repos/RepreZen/SwagEdit/pulls/comments/63931330","id":63931330,"diff_hunk":"@@ -187,4 +189,89 @@ class ValidatorTest {\n \t\t\tassertEquals(IMarker.SEVERITY_ERROR, it.level)\n \t\t]\n \t}\n-}\n\\ No newline at end of file\n+\n+\t@Test\n+\tdef void shouldWarnOnDuplicateKeys() {\n+\t\tval content = '''\n+\t\t\tswagger: '2.0'\n+\t\t\tswagger: '2.0'\n+\t\t\tinfo:\n+\t\t\t  version: 0.0.0\n+\t\t\t  title: Simple API\n+\t\t\tpaths:\n+\t\t\t  /foo/{bar}:\n+\t\t\t    get:\n+\t\t\t      responses:\n+\t\t\t        '200':\n+\t\t\t          description: OK\n+\t\t'''\n+\n+\t\tdocument.set(content)\n+\t\tval errors = validator.validate(document)\n+\n+\t\tassertEquals(2, errors.size())\n+\t\tassertThat(errors, hasItems(\n+\t\t\tnew SwaggerError(1, IMarker.SEVERITY_WARNING, String.format(Messages.error_duplicate_keys, \"swagger\")),\n+\t\t\tnew SwaggerError(2, IMarker.SEVERITY_WARNING, String.format(Messages.error_duplicate_keys, \"swagger\"))\n+\t\t))\n+\t}\n+\n+\t@Test\n+\tdef void shouldWarnOnDuplicateKeys_InsideObjects() {\n+\t\tval content = '''\n+\t\t\tswagger: '2.0'\n+\t\t\tinfo:\n+\t\t\t  version: 0.0.0\n+\t\t\t  version: 1.0.0\n+\t\t\t  title: Simple API\n+\t\t\tpaths:\n+\t\t\t  /foo/{bar}:\n+\t\t\t    get:\n+\t\t\t      responses:\n+\t\t\t        '200':\n+\t\t\t          description: OK\n+\t\t'''\n+\n+\t\tdocument.set(content)\n+\t\tval errors = validator.validate(document)\n+\n+\t\tassertEquals(2, errors.size())\n+\t\tassertThat(errors, hasItems(\n+\t\t\tnew SwaggerError(3, IMarker.SEVERITY_WARNING, String.format(Messages.error_duplicate_keys, \"version\")),\n+\t\t\tnew SwaggerError(4, IMarker.SEVERITY_WARNING, String.format(Messages.error_duplicate_keys, \"version\"))\n+\t\t))\n+\t}\n+\n+\t@Test\n+\tdef void shouldWarnOnDuplicateKeys_InsideItems() {\n+\t\tval content = '''\n+\t\t\tswagger: '2.0'\n+\t\t\tinfo:\n+\t\t\t  version: 0.0.0\n+\t\t\t  title: Simple API\n+\t\t\tpaths:\n+\t\t\t  /foo/{bar}:\n+\t\t\t    get:\n+\t\t\t      parameters:\n+\t\t\t         - name: bar\n+\t\t\t           in: path\n+\t\t\t           in: path\n+\t\t\t           type: string\n+\t\t\t           required: true\n+\t\t\t      responses:\n+\t\t\t        '200':\n+\t\t\t          description: OK\n+\t\t'''\n+\n+\t\tdocument.set(content)\n+\t\tval errors = validator.validate(document)\n+\n+\t\tassertEquals(2, errors.size())\n+\t\tassertThat(errors, hasItems(\n+\t\t\tnew SwaggerError(10, IMarker.SEVERITY_WARNING, String.format(Messages.error_duplicate_keys, \"in\")),\n+\t\t\tnew SwaggerError(11, IMarker.SEVERITY_WARNING, String.format(Messages.error_duplicate_keys, \"in\"))\n+\t\t))\n+\t}","path":"com.reprezen.swagedit.tests/src/com/reprezen/swagedit/tests/ValidatorTest.xtend","position":101,"original_position":101,"commit_id":"5b560a469e5de2067c8073fbdd9eaf44c1b5da82","original_commit_id":"5b560a469e5de2067c8073fbdd9eaf44c1b5da82","user":{"login":"tfesenko","id":644582,"avatar_url":"https://avatars.githubusercontent.com/u/644582?v=3","gravatar_id":"","url":"https://api.github.com/users/tfesenko","html_url":"https://github.com/tfesenko","followers_url":"https://api.github.com/users/tfesenko/followers","following_url":"https://api.github.com/users/tfesenko/following{/other_user}","gists_url":"https://api.github.com/users/tfesenko/gists{/gist_id}","starred_url":"https://api.github.com/users/tfesenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tfesenko/subscriptions","organizations_url":"https://api.github.com/users/tfesenko/orgs","repos_url":"https://api.github.com/users/tfesenko/repos","events_url":"https://api.github.com/users/tfesenko/events{/privacy}","received_events_url":"https://api.github.com/users/tfesenko/received_events","type":"User","site_admin":false},"body":"I would also add a test for a case when the value is an object, for example here `responses` defined twice within the same pathItem:\r\n```yaml\r\nswagger: '2.0'\r\ninfo:\r\n  version: 0.0.0\r\n  title: Simple API\r\npaths:\r\n  /foo/{bar}:\r\n    get:\r\n      responses:\r\n        '200':\r\n          description: OK\r\n      responses:\r\n        '200':\r\n          description: OK\r\n```\r\nIt works as expected - validator shows a warning, but we don't have a test for it.","created_at":"2016-05-19T18:33:06Z","updated_at":"2016-05-19T18:33:06Z","html_url":"https://github.com/RepreZen/SwagEdit/pull/124#discussion_r63931330","pull_request_url":"https://api.github.com/repos/RepreZen/SwagEdit/pulls/124","_links":{"self":{"href":"https://api.github.com/repos/RepreZen/SwagEdit/pulls/comments/63931330"},"html":{"href":"https://github.com/RepreZen/SwagEdit/pull/124#discussion_r63931330"},"pull_request":{"href":"https://api.github.com/repos/RepreZen/SwagEdit/pulls/124"}}},"pull_request":{"url":"https://api.github.com/repos/RepreZen/SwagEdit/pulls/124","id":70701162,"html_url":"https://github.com/RepreZen/SwagEdit/pull/124","diff_url":"https://github.com/RepreZen/SwagEdit/pull/124.diff","patch_url":"https://github.com/RepreZen/SwagEdit/pull/124.patch","issue_url":"https://api.github.com/repos/RepreZen/SwagEdit/issues/124","number":124,"state":"open","locked":false,"title":"[#117] Warn on duplicate properties","user":{"login":"ghillairet","id":148045,"avatar_url":"https://avatars.githubusercontent.com/u/148045?v=3","gravatar_id":"","url":"https://api.github.com/users/ghillairet","html_url":"https://github.com/ghillairet","followers_url":"https://api.github.com/users/ghillairet/followers","following_url":"https://api.github.com/users/ghillairet/following{/other_user}","gists_url":"https://api.github.com/users/ghillairet/gists{/gist_id}","starred_url":"https://api.github.com/users/ghillairet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghillairet/subscriptions","organizations_url":"https://api.github.com/users/ghillairet/orgs","repos_url":"https://api.github.com/users/ghillairet/repos","events_url":"https://api.github.com/users/ghillairet/events{/privacy}","received_events_url":"https://api.github.com/users/ghillairet/received_events","type":"User","site_admin":false},"body":"See #117 ","created_at":"2016-05-19T14:12:23Z","updated_at":"2016-05-19T18:33:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c97df6999fc3dde759446535128f2f49e173ed32","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/RepreZen/SwagEdit/pulls/124/commits","review_comments_url":"https://api.github.com/repos/RepreZen/SwagEdit/pulls/124/comments","review_comment_url":"https://api.github.com/repos/RepreZen/SwagEdit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/RepreZen/SwagEdit/issues/124/comments","statuses_url":"https://api.github.com/repos/RepreZen/SwagEdit/statuses/5b560a469e5de2067c8073fbdd9eaf44c1b5da82","head":{"label":"RepreZen:task/117","ref":"task/117","sha":"5b560a469e5de2067c8073fbdd9eaf44c1b5da82","user":{"login":"RepreZen","id":15205934,"avatar_url":"https://avatars.githubusercontent.com/u/15205934?v=3","gravatar_id":"","url":"https://api.github.com/users/RepreZen","html_url":"https://github.com/RepreZen","followers_url":"https://api.github.com/users/RepreZen/followers","following_url":"https://api.github.com/users/RepreZen/following{/other_user}","gists_url":"https://api.github.com/users/RepreZen/gists{/gist_id}","starred_url":"https://api.github.com/users/RepreZen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RepreZen/subscriptions","organizations_url":"https://api.github.com/users/RepreZen/orgs","repos_url":"https://api.github.com/users/RepreZen/repos","events_url":"https://api.github.com/users/RepreZen/events{/privacy}","received_events_url":"https://api.github.com/users/RepreZen/received_events","type":"Organization","site_admin":false},"repo":{"id":43460338,"name":"SwagEdit","full_name":"RepreZen/SwagEdit","owner":{"login":"RepreZen","id":15205934,"avatar_url":"https://avatars.githubusercontent.com/u/15205934?v=3","gravatar_id":"","url":"https://api.github.com/users/RepreZen","html_url":"https://github.com/RepreZen","followers_url":"https://api.github.com/users/RepreZen/followers","following_url":"https://api.github.com/users/RepreZen/following{/other_user}","gists_url":"https://api.github.com/users/RepreZen/gists{/gist_id}","starred_url":"https://api.github.com/users/RepreZen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RepreZen/subscriptions","organizations_url":"https://api.github.com/users/RepreZen/orgs","repos_url":"https://api.github.com/users/RepreZen/repos","events_url":"https://api.github.com/users/RepreZen/events{/privacy}","received_events_url":"https://api.github.com/users/RepreZen/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/RepreZen/SwagEdit","description":"Eclipse Editor for Swagger API Description Language","fork":false,"url":"https://api.github.com/repos/RepreZen/SwagEdit","forks_url":"https://api.github.com/repos/RepreZen/SwagEdit/forks","keys_url":"https://api.github.com/repos/RepreZen/SwagEdit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RepreZen/SwagEdit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RepreZen/SwagEdit/teams","hooks_url":"https://api.github.com/repos/RepreZen/SwagEdit/hooks","issue_events_url":"https://api.github.com/repos/RepreZen/SwagEdit/issues/events{/number}","events_url":"https://api.github.com/repos/RepreZen/SwagEdit/events","assignees_url":"https://api.github.com/repos/RepreZen/SwagEdit/assignees{/user}","branches_url":"https://api.github.com/repos/RepreZen/SwagEdit/branches{/branch}","tags_url":"https://api.github.com/repos/RepreZen/SwagEdit/tags","blobs_url":"https://api.github.com/repos/RepreZen/SwagEdit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RepreZen/SwagEdit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RepreZen/SwagEdit/git/refs{/sha}","trees_url":"https://api.github.com/repos/RepreZen/SwagEdit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RepreZen/SwagEdit/statuses/{sha}","languages_url":"https://api.github.com/repos/RepreZen/SwagEdit/languages","stargazers_url":"https://api.github.com/repos/RepreZen/SwagEdit/stargazers","contributors_url":"https://api.github.com/repos/RepreZen/SwagEdit/contributors","subscribers_url":"https://api.github.com/repos/RepreZen/SwagEdit/subscribers","subscription_url":"https://api.github.com/repos/RepreZen/SwagEdit/subscription","commits_url":"https://api.github.com/repos/RepreZen/SwagEdit/commits{/sha}","git_commits_url":"https://api.github.com/repos/RepreZen/SwagEdit/git/commits{/sha}","comments_url":"https://api.github.com/repos/RepreZen/SwagEdit/comments{/number}","issue_comment_url":"https://api.github.com/repos/RepreZen/SwagEdit/issues/comments{/number}","contents_url":"https://api.github.com/repos/RepreZen/SwagEdit/contents/{+path}","compare_url":"https://api.github.com/repos/RepreZen/SwagEdit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RepreZen/SwagEdit/merges","archive_url":"https://api.github.com/repos/RepreZen/SwagEdit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RepreZen/SwagEdit/downloads","issues_url":"https://api.github.com/repos/RepreZen/SwagEdit/issues{/number}","pulls_url":"https://api.github.com/repos/RepreZen/SwagEdit/pulls{/number}","milestones_url":"https://api.github.com/repos/RepreZen/SwagEdit/milestones{/number}","notifications_url":"https://api.github.com/repos/RepreZen/SwagEdit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RepreZen/SwagEdit/labels{/name}","releases_url":"https://api.github.com/repos/RepreZen/SwagEdit/releases{/id}","deployments_url":"https://api.github.com/repos/RepreZen/SwagEdit/deployments","created_at":"2015-09-30T21:30:07Z","updated_at":"2016-05-18T16:19:28Z","pushed_at":"2016-05-19T15:46:20Z","git_url":"git://github.com/RepreZen/SwagEdit.git","ssh_url":"git@github.com:RepreZen/SwagEdit.git","clone_url":"https://github.com/RepreZen/SwagEdit.git","svn_url":"https://github.com/RepreZen/SwagEdit","homepage":null,"size":9042,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":46,"forks":1,"open_issues":46,"watchers":2,"default_branch":"master"}},"base":{"label":"RepreZen:master","ref":"master","sha":"6e7e39a8efd1579da9fcaae23c56be31ec747d3f","user":{"login":"RepreZen","id":15205934,"avatar_url":"https://avatars.githubusercontent.com/u/15205934?v=3","gravatar_id":"","url":"https://api.github.com/users/RepreZen","html_url":"https://github.com/RepreZen","followers_url":"https://api.github.com/users/RepreZen/followers","following_url":"https://api.github.com/users/RepreZen/following{/other_user}","gists_url":"https://api.github.com/users/RepreZen/gists{/gist_id}","starred_url":"https://api.github.com/users/RepreZen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RepreZen/subscriptions","organizations_url":"https://api.github.com/users/RepreZen/orgs","repos_url":"https://api.github.com/users/RepreZen/repos","events_url":"https://api.github.com/users/RepreZen/events{/privacy}","received_events_url":"https://api.github.com/users/RepreZen/received_events","type":"Organization","site_admin":false},"repo":{"id":43460338,"name":"SwagEdit","full_name":"RepreZen/SwagEdit","owner":{"login":"RepreZen","id":15205934,"avatar_url":"https://avatars.githubusercontent.com/u/15205934?v=3","gravatar_id":"","url":"https://api.github.com/users/RepreZen","html_url":"https://github.com/RepreZen","followers_url":"https://api.github.com/users/RepreZen/followers","following_url":"https://api.github.com/users/RepreZen/following{/other_user}","gists_url":"https://api.github.com/users/RepreZen/gists{/gist_id}","starred_url":"https://api.github.com/users/RepreZen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RepreZen/subscriptions","organizations_url":"https://api.github.com/users/RepreZen/orgs","repos_url":"https://api.github.com/users/RepreZen/repos","events_url":"https://api.github.com/users/RepreZen/events{/privacy}","received_events_url":"https://api.github.com/users/RepreZen/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/RepreZen/SwagEdit","description":"Eclipse Editor for Swagger API Description Language","fork":false,"url":"https://api.github.com/repos/RepreZen/SwagEdit","forks_url":"https://api.github.com/repos/RepreZen/SwagEdit/forks","keys_url":"https://api.github.com/repos/RepreZen/SwagEdit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RepreZen/SwagEdit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RepreZen/SwagEdit/teams","hooks_url":"https://api.github.com/repos/RepreZen/SwagEdit/hooks","issue_events_url":"https://api.github.com/repos/RepreZen/SwagEdit/issues/events{/number}","events_url":"https://api.github.com/repos/RepreZen/SwagEdit/events","assignees_url":"https://api.github.com/repos/RepreZen/SwagEdit/assignees{/user}","branches_url":"https://api.github.com/repos/RepreZen/SwagEdit/branches{/branch}","tags_url":"https://api.github.com/repos/RepreZen/SwagEdit/tags","blobs_url":"https://api.github.com/repos/RepreZen/SwagEdit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RepreZen/SwagEdit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RepreZen/SwagEdit/git/refs{/sha}","trees_url":"https://api.github.com/repos/RepreZen/SwagEdit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RepreZen/SwagEdit/statuses/{sha}","languages_url":"https://api.github.com/repos/RepreZen/SwagEdit/languages","stargazers_url":"https://api.github.com/repos/RepreZen/SwagEdit/stargazers","contributors_url":"https://api.github.com/repos/RepreZen/SwagEdit/contributors","subscribers_url":"https://api.github.com/repos/RepreZen/SwagEdit/subscribers","subscription_url":"https://api.github.com/repos/RepreZen/SwagEdit/subscription","commits_url":"https://api.github.com/repos/RepreZen/SwagEdit/commits{/sha}","git_commits_url":"https://api.github.com/repos/RepreZen/SwagEdit/git/commits{/sha}","comments_url":"https://api.github.com/repos/RepreZen/SwagEdit/comments{/number}","issue_comment_url":"https://api.github.com/repos/RepreZen/SwagEdit/issues/comments{/number}","contents_url":"https://api.github.com/repos/RepreZen/SwagEdit/contents/{+path}","compare_url":"https://api.github.com/repos/RepreZen/SwagEdit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RepreZen/SwagEdit/merges","archive_url":"https://api.github.com/repos/RepreZen/SwagEdit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RepreZen/SwagEdit/downloads","issues_url":"https://api.github.com/repos/RepreZen/SwagEdit/issues{/number}","pulls_url":"https://api.github.com/repos/RepreZen/SwagEdit/pulls{/number}","milestones_url":"https://api.github.com/repos/RepreZen/SwagEdit/milestones{/number}","notifications_url":"https://api.github.com/repos/RepreZen/SwagEdit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RepreZen/SwagEdit/labels{/name}","releases_url":"https://api.github.com/repos/RepreZen/SwagEdit/releases{/id}","deployments_url":"https://api.github.com/repos/RepreZen/SwagEdit/deployments","created_at":"2015-09-30T21:30:07Z","updated_at":"2016-05-18T16:19:28Z","pushed_at":"2016-05-19T15:46:20Z","git_url":"git://github.com/RepreZen/SwagEdit.git","ssh_url":"git@github.com:RepreZen/SwagEdit.git","clone_url":"https://github.com/RepreZen/SwagEdit.git","svn_url":"https://github.com/RepreZen/SwagEdit","homepage":null,"size":9042,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":46,"forks":1,"open_issues":46,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/RepreZen/SwagEdit/pulls/124"},"html":{"href":"https://github.com/RepreZen/SwagEdit/pull/124"},"issue":{"href":"https://api.github.com/repos/RepreZen/SwagEdit/issues/124"},"comments":{"href":"https://api.github.com/repos/RepreZen/SwagEdit/issues/124/comments"},"review_comments":{"href":"https://api.github.com/repos/RepreZen/SwagEdit/pulls/124/comments"},"review_comment":{"href":"https://api.github.com/repos/RepreZen/SwagEdit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/RepreZen/SwagEdit/pulls/124/commits"},"statuses":{"href":"https://api.github.com/repos/RepreZen/SwagEdit/statuses/5b560a469e5de2067c8073fbdd9eaf44c1b5da82"}}}}