{"action":"opened","number":317,"pull_request":{"url":"https://api.github.com/repos/Kashoo/synctos/pulls/317","id":190086507,"html_url":"https://github.com/Kashoo/synctos/pull/317","diff_url":"https://github.com/Kashoo/synctos/pull/317.diff","patch_url":"https://github.com/Kashoo/synctos/pull/317.patch","issue_url":"https://api.github.com/repos/Kashoo/synctos/issues/317","number":317,"state":"open","locked":false,"title":"Issue 316: Regular expression pattern constraint for attachment references","user":{"login":"OldSneerJaw","id":5003870,"avatar_url":"https://avatars1.githubusercontent.com/u/5003870?v=4","gravatar_id":"","url":"https://api.github.com/users/OldSneerJaw","html_url":"https://github.com/OldSneerJaw","followers_url":"https://api.github.com/users/OldSneerJaw/followers","following_url":"https://api.github.com/users/OldSneerJaw/following{/other_user}","gists_url":"https://api.github.com/users/OldSneerJaw/gists{/gist_id}","starred_url":"https://api.github.com/users/OldSneerJaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OldSneerJaw/subscriptions","organizations_url":"https://api.github.com/users/OldSneerJaw/orgs","repos_url":"https://api.github.com/users/OldSneerJaw/repos","events_url":"https://api.github.com/users/OldSneerJaw/events{/privacy}","received_events_url":"https://api.github.com/users/OldSneerJaw/received_events","type":"User","site_admin":false},"body":"# Description\r\n\r\nWhen included in a document definition, the `attachmentReference` validation type's `regexPattern` constraint verifies that the value conforms to the specified regular expression pattern. It overrides the value of the document-wide `attachmentConstraints.filenameRegexPattern` constraint for that attachment reference.\r\n\r\n# Testing\r\n\r\n1. Generate a sync function from `attachment-reference-doc-definitions.js`:\r\n\r\n```bash\r\n./make-sync-function -j test/resources/attachment-reference-doc-definitions.js build/test-sync-function.txt\r\n```\r\n\r\n2. Copy and paste the sync function into a Sync Gateway configuration file.\r\n3. Attempt to create a test document with an attachment reference that violates the regex pattern (it should be rejected with 403 Forbidden):\r\n\r\n```\r\nPUT /test/attachment-ref-test-1 HTTP/1.1\r\nHost: localhost:4985\r\nContent-Type: application/json\r\n\r\n{\r\n    \"type\": \"attachmentReferencesDoc\",\r\n    \"staticRegexPatternValidationProp\": \"12345.pdf\"\r\n}\r\n```\r\n\r\n4. Create a test document with an attachment reference that satisfies the regex pattern (it should succeed with 201 Created):\r\n\r\n```\r\nPUT /test/attachment-ref-test-1 HTTP/1.1\r\nHost: localhost:4985\r\nContent-Type: application/json\r\n\r\n{\r\n    \"type\": \"attachmentReferencesDoc\",\r\n    \"staticRegexPatternValidationProp\": \"abc.txt\"\r\n}\r\n```\r\n\r\n# Related Issue\r\n\r\n* GitHub issue link: #316","created_at":"2018-05-23T19:52:39Z","updated_at":"2018-05-23T19:52:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Kashoo/synctos/pulls/317/commits","review_comments_url":"https://api.github.com/repos/Kashoo/synctos/pulls/317/comments","review_comment_url":"https://api.github.com/repos/Kashoo/synctos/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Kashoo/synctos/issues/317/comments","statuses_url":"https://api.github.com/repos/Kashoo/synctos/statuses/9a3e6c120a6306cbe9740f62cad951eb7b58e261","head":{"label":"Kashoo:issue-316-attachment-ref-regex","ref":"issue-316-attachment-ref-regex","sha":"9a3e6c120a6306cbe9740f62cad951eb7b58e261","user":{"login":"Kashoo","id":989660,"avatar_url":"https://avatars1.githubusercontent.com/u/989660?v=4","gravatar_id":"","url":"https://api.github.com/users/Kashoo","html_url":"https://github.com/Kashoo","followers_url":"https://api.github.com/users/Kashoo/followers","following_url":"https://api.github.com/users/Kashoo/following{/other_user}","gists_url":"https://api.github.com/users/Kashoo/gists{/gist_id}","starred_url":"https://api.github.com/users/Kashoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kashoo/subscriptions","organizations_url":"https://api.github.com/users/Kashoo/orgs","repos_url":"https://api.github.com/users/Kashoo/repos","events_url":"https://api.github.com/users/Kashoo/events{/privacy}","received_events_url":"https://api.github.com/users/Kashoo/received_events","type":"Organization","site_admin":false},"repo":{"id":60386101,"name":"synctos","full_name":"Kashoo/synctos","owner":{"login":"Kashoo","id":989660,"avatar_url":"https://avatars1.githubusercontent.com/u/989660?v=4","gravatar_id":"","url":"https://api.github.com/users/Kashoo","html_url":"https://github.com/Kashoo","followers_url":"https://api.github.com/users/Kashoo/followers","following_url":"https://api.github.com/users/Kashoo/following{/other_user}","gists_url":"https://api.github.com/users/Kashoo/gists{/gist_id}","starred_url":"https://api.github.com/users/Kashoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kashoo/subscriptions","organizations_url":"https://api.github.com/users/Kashoo/orgs","repos_url":"https://api.github.com/users/Kashoo/repos","events_url":"https://api.github.com/users/Kashoo/events{/privacy}","received_events_url":"https://api.github.com/users/Kashoo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Kashoo/synctos","description":"The Syncmaker. A tool to build comprehensive sync functions for Couchbase Sync Gateway.","fork":false,"url":"https://api.github.com/repos/Kashoo/synctos","forks_url":"https://api.github.com/repos/Kashoo/synctos/forks","keys_url":"https://api.github.com/repos/Kashoo/synctos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Kashoo/synctos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Kashoo/synctos/teams","hooks_url":"https://api.github.com/repos/Kashoo/synctos/hooks","issue_events_url":"https://api.github.com/repos/Kashoo/synctos/issues/events{/number}","events_url":"https://api.github.com/repos/Kashoo/synctos/events","assignees_url":"https://api.github.com/repos/Kashoo/synctos/assignees{/user}","branches_url":"https://api.github.com/repos/Kashoo/synctos/branches{/branch}","tags_url":"https://api.github.com/repos/Kashoo/synctos/tags","blobs_url":"https://api.github.com/repos/Kashoo/synctos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Kashoo/synctos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Kashoo/synctos/git/refs{/sha}","trees_url":"https://api.github.com/repos/Kashoo/synctos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Kashoo/synctos/statuses/{sha}","languages_url":"https://api.github.com/repos/Kashoo/synctos/languages","stargazers_url":"https://api.github.com/repos/Kashoo/synctos/stargazers","contributors_url":"https://api.github.com/repos/Kashoo/synctos/contributors","subscribers_url":"https://api.github.com/repos/Kashoo/synctos/subscribers","subscription_url":"https://api.github.com/repos/Kashoo/synctos/subscription","commits_url":"https://api.github.com/repos/Kashoo/synctos/commits{/sha}","git_commits_url":"https://api.github.com/repos/Kashoo/synctos/git/commits{/sha}","comments_url":"https://api.github.com/repos/Kashoo/synctos/comments{/number}","issue_comment_url":"https://api.github.com/repos/Kashoo/synctos/issues/comments{/number}","contents_url":"https://api.github.com/repos/Kashoo/synctos/contents/{+path}","compare_url":"https://api.github.com/repos/Kashoo/synctos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Kashoo/synctos/merges","archive_url":"https://api.github.com/repos/Kashoo/synctos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Kashoo/synctos/downloads","issues_url":"https://api.github.com/repos/Kashoo/synctos/issues{/number}","pulls_url":"https://api.github.com/repos/Kashoo/synctos/pulls{/number}","milestones_url":"https://api.github.com/repos/Kashoo/synctos/milestones{/number}","notifications_url":"https://api.github.com/repos/Kashoo/synctos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Kashoo/synctos/labels{/name}","releases_url":"https://api.github.com/repos/Kashoo/synctos/releases{/id}","deployments_url":"https://api.github.com/repos/Kashoo/synctos/deployments","created_at":"2016-06-04T00:47:39Z","updated_at":"2018-05-23T16:05:41Z","pushed_at":"2018-05-23T19:40:38Z","git_url":"git://github.com/Kashoo/synctos.git","ssh_url":"git@github.com:Kashoo/synctos.git","clone_url":"https://github.com/Kashoo/synctos.git","svn_url":"https://github.com/Kashoo/synctos","homepage":"https://www.npmjs.com/package/synctos","size":1420,"stargazers_count":34,"watchers_count":34,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":3,"open_issues":6,"watchers":34,"default_branch":"master"}},"base":{"label":"Kashoo:master","ref":"master","sha":"1178ebf0fcbc97d389f61ee1ba7cc81f8abc1095","user":{"login":"Kashoo","id":989660,"avatar_url":"https://avatars1.githubusercontent.com/u/989660?v=4","gravatar_id":"","url":"https://api.github.com/users/Kashoo","html_url":"https://github.com/Kashoo","followers_url":"https://api.github.com/users/Kashoo/followers","following_url":"https://api.github.com/users/Kashoo/following{/other_user}","gists_url":"https://api.github.com/users/Kashoo/gists{/gist_id}","starred_url":"https://api.github.com/users/Kashoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kashoo/subscriptions","organizations_url":"https://api.github.com/users/Kashoo/orgs","repos_url":"https://api.github.com/users/Kashoo/repos","events_url":"https://api.github.com/users/Kashoo/events{/privacy}","received_events_url":"https://api.github.com/users/Kashoo/received_events","type":"Organization","site_admin":false},"repo":{"id":60386101,"name":"synctos","full_name":"Kashoo/synctos","owner":{"login":"Kashoo","id":989660,"avatar_url":"https://avatars1.githubusercontent.com/u/989660?v=4","gravatar_id":"","url":"https://api.github.com/users/Kashoo","html_url":"https://github.com/Kashoo","followers_url":"https://api.github.com/users/Kashoo/followers","following_url":"https://api.github.com/users/Kashoo/following{/other_user}","gists_url":"https://api.github.com/users/Kashoo/gists{/gist_id}","starred_url":"https://api.github.com/users/Kashoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kashoo/subscriptions","organizations_url":"https://api.github.com/users/Kashoo/orgs","repos_url":"https://api.github.com/users/Kashoo/repos","events_url":"https://api.github.com/users/Kashoo/events{/privacy}","received_events_url":"https://api.github.com/users/Kashoo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Kashoo/synctos","description":"The Syncmaker. A tool to build comprehensive sync functions for Couchbase Sync Gateway.","fork":false,"url":"https://api.github.com/repos/Kashoo/synctos","forks_url":"https://api.github.com/repos/Kashoo/synctos/forks","keys_url":"https://api.github.com/repos/Kashoo/synctos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Kashoo/synctos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Kashoo/synctos/teams","hooks_url":"https://api.github.com/repos/Kashoo/synctos/hooks","issue_events_url":"https://api.github.com/repos/Kashoo/synctos/issues/events{/number}","events_url":"https://api.github.com/repos/Kashoo/synctos/events","assignees_url":"https://api.github.com/repos/Kashoo/synctos/assignees{/user}","branches_url":"https://api.github.com/repos/Kashoo/synctos/branches{/branch}","tags_url":"https://api.github.com/repos/Kashoo/synctos/tags","blobs_url":"https://api.github.com/repos/Kashoo/synctos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Kashoo/synctos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Kashoo/synctos/git/refs{/sha}","trees_url":"https://api.github.com/repos/Kashoo/synctos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Kashoo/synctos/statuses/{sha}","languages_url":"https://api.github.com/repos/Kashoo/synctos/languages","stargazers_url":"https://api.github.com/repos/Kashoo/synctos/stargazers","contributors_url":"https://api.github.com/repos/Kashoo/synctos/contributors","subscribers_url":"https://api.github.com/repos/Kashoo/synctos/subscribers","subscription_url":"https://api.github.com/repos/Kashoo/synctos/subscription","commits_url":"https://api.github.com/repos/Kashoo/synctos/commits{/sha}","git_commits_url":"https://api.github.com/repos/Kashoo/synctos/git/commits{/sha}","comments_url":"https://api.github.com/repos/Kashoo/synctos/comments{/number}","issue_comment_url":"https://api.github.com/repos/Kashoo/synctos/issues/comments{/number}","contents_url":"https://api.github.com/repos/Kashoo/synctos/contents/{+path}","compare_url":"https://api.github.com/repos/Kashoo/synctos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Kashoo/synctos/merges","archive_url":"https://api.github.com/repos/Kashoo/synctos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Kashoo/synctos/downloads","issues_url":"https://api.github.com/repos/Kashoo/synctos/issues{/number}","pulls_url":"https://api.github.com/repos/Kashoo/synctos/pulls{/number}","milestones_url":"https://api.github.com/repos/Kashoo/synctos/milestones{/number}","notifications_url":"https://api.github.com/repos/Kashoo/synctos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Kashoo/synctos/labels{/name}","releases_url":"https://api.github.com/repos/Kashoo/synctos/releases{/id}","deployments_url":"https://api.github.com/repos/Kashoo/synctos/deployments","created_at":"2016-06-04T00:47:39Z","updated_at":"2018-05-23T16:05:41Z","pushed_at":"2018-05-23T19:40:38Z","git_url":"git://github.com/Kashoo/synctos.git","ssh_url":"git@github.com:Kashoo/synctos.git","clone_url":"https://github.com/Kashoo/synctos.git","svn_url":"https://github.com/Kashoo/synctos","homepage":"https://www.npmjs.com/package/synctos","size":1420,"stargazers_count":34,"watchers_count":34,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":3,"open_issues":6,"watchers":34,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Kashoo/synctos/pulls/317"},"html":{"href":"https://github.com/Kashoo/synctos/pull/317"},"issue":{"href":"https://api.github.com/repos/Kashoo/synctos/issues/317"},"comments":{"href":"https://api.github.com/repos/Kashoo/synctos/issues/317/comments"},"review_comments":{"href":"https://api.github.com/repos/Kashoo/synctos/pulls/317/comments"},"review_comment":{"href":"https://api.github.com/repos/Kashoo/synctos/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Kashoo/synctos/pulls/317/commits"},"statuses":{"href":"https://api.github.com/repos/Kashoo/synctos/statuses/9a3e6c120a6306cbe9740f62cad951eb7b58e261"}},"author_association":"COLLABORATOR","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":1,"additions":132,"deletions":27,"changed_files":11}}
{"actor":{"display_login":"OldSneerJaw"}}