{"action":"created","comment":{"url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/comments/32614870","id":32614870,"diff_hunk":"@@ -36,13 +37,22 @@ def load_schemas(schemas_path, schema_names):\n             validator = validator_for(schema)\n             validator.check_schema(schema)\n             loaded_schemas[schema_name] = schema\n-    return loaded_schemas\n \n-_SCHEMAS = load_schemas(JSON_SCHEMAS_PATH, SCHEMA_NAMES)\n+            optional_schema = {}","path":"app/validation.py","position":24,"original_position":24,"commit_id":"f95c7fdd0c42193aa0dfae9e3861edc0d4c51d53","original_commit_id":"f95c7fdd0c42193aa0dfae9e3861edc0d4c51d53","user":{"login":"allait","id":246664,"avatar_url":"https://avatars.githubusercontent.com/u/246664?v=3","gravatar_id":"","url":"https://api.github.com/users/allait","html_url":"https://github.com/allait","followers_url":"https://api.github.com/users/allait/followers","following_url":"https://api.github.com/users/allait/following{/other_user}","gists_url":"https://api.github.com/users/allait/gists{/gist_id}","starred_url":"https://api.github.com/users/allait/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allait/subscriptions","organizations_url":"https://api.github.com/users/allait/orgs","repos_url":"https://api.github.com/users/allait/repos","events_url":"https://api.github.com/users/allait/events{/privacy}","received_events_url":"https://api.github.com/users/allait/received_events","type":"User","site_admin":false},"body":"Another way to do this:\r\n```python\r\noptional_schema = schema.copy()\r\noptional_schema.pop('required', None)\r\n```","created_at":"2015-06-17T10:54:31Z","updated_at":"2015-06-17T10:54:31Z","html_url":"https://github.com/alphagov/digitalmarketplace-api/pull/146#discussion_r32614870","pull_request_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/146","_links":{"self":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/comments/32614870"},"html":{"href":"https://github.com/alphagov/digitalmarketplace-api/pull/146#discussion_r32614870"},"pull_request":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/146"}}},"pull_request":{"url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/146","id":37887334,"html_url":"https://github.com/alphagov/digitalmarketplace-api/pull/146","diff_url":"https://github.com/alphagov/digitalmarketplace-api/pull/146.diff","patch_url":"https://github.com/alphagov/digitalmarketplace-api/pull/146.patch","issue_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/issues/146","number":146,"state":"open","locked":false,"title":"[#96551096] SCS validation in API","user":{"login":"TheDoubleK","id":6525554,"avatar_url":"https://avatars.githubusercontent.com/u/6525554?v=3","gravatar_id":"","url":"https://api.github.com/users/TheDoubleK","html_url":"https://github.com/TheDoubleK","followers_url":"https://api.github.com/users/TheDoubleK/followers","following_url":"https://api.github.com/users/TheDoubleK/following{/other_user}","gists_url":"https://api.github.com/users/TheDoubleK/gists{/gist_id}","starred_url":"https://api.github.com/users/TheDoubleK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheDoubleK/subscriptions","organizations_url":"https://api.github.com/users/TheDoubleK/orgs","repos_url":"https://api.github.com/users/TheDoubleK/repos","events_url":"https://api.github.com/users/TheDoubleK/events{/privacy}","received_events_url":"https://api.github.com/users/TheDoubleK/received_events","type":"User","site_admin":false},"body":"This partially fulfils: https://www.pivotaltracker.com/story/show/96551096\r\n\r\nThis adds a new validation method that returns a list of all validation errors when validating against a JSON schema, with the option to enforce 'required' fields or not.\r\n\r\nIt isn't yet wired in to any endpoint, but in future validation messages on editing/saving pages of questions about a service should use this method to get the list of fields with errors (if any), to display in the frontend app.\r\n\r\nThis also pulls in the libraries required for the `uri` and `date-time` JSON schema formats to be validated properly (previously any string was accepted).","created_at":"2015-06-17T10:43:33Z","updated_at":"2015-06-17T10:54:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"887807668f1199e51b98817a480950452673a152","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/146/commits","review_comments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/146/comments","review_comment_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/issues/146/comments","statuses_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/statuses/f95c7fdd0c42193aa0dfae9e3861edc0d4c51d53","head":{"label":"alphagov:scs_validation_in_api","ref":"scs_validation_in_api","sha":"f95c7fdd0c42193aa0dfae9e3861edc0d4c51d53","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":26963583,"name":"digitalmarketplace-api","full_name":"alphagov/digitalmarketplace-api","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/digitalmarketplace-api","description":"Digital Marketplace API.","fork":false,"url":"https://api.github.com/repos/alphagov/digitalmarketplace-api","forks_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/forks","keys_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/teams","hooks_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/hooks","issue_events_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/events","assignees_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/tags","blobs_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/languages","stargazers_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/stargazers","contributors_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/contributors","subscribers_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/subscribers","subscription_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/subscription","commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/merges","archive_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/downloads","issues_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/releases{/id}","created_at":"2014-11-21T14:41:36Z","updated_at":"2015-05-09T02:28:36Z","pushed_at":"2015-06-17T10:53:24Z","git_url":"git://github.com/alphagov/digitalmarketplace-api.git","ssh_url":"git@github.com:alphagov/digitalmarketplace-api.git","clone_url":"https://github.com/alphagov/digitalmarketplace-api.git","svn_url":"https://github.com/alphagov/digitalmarketplace-api","homepage":null,"size":3344,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":4,"default_branch":"master"}},"base":{"label":"alphagov:master","ref":"master","sha":"ca91687d202f7f2b2fca79c28de7246bb79e3376","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":26963583,"name":"digitalmarketplace-api","full_name":"alphagov/digitalmarketplace-api","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/digitalmarketplace-api","description":"Digital Marketplace API.","fork":false,"url":"https://api.github.com/repos/alphagov/digitalmarketplace-api","forks_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/forks","keys_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/teams","hooks_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/hooks","issue_events_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/events","assignees_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/tags","blobs_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/languages","stargazers_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/stargazers","contributors_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/contributors","subscribers_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/subscribers","subscription_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/subscription","commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/merges","archive_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/downloads","issues_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/digitalmarketplace-api/releases{/id}","created_at":"2014-11-21T14:41:36Z","updated_at":"2015-05-09T02:28:36Z","pushed_at":"2015-06-17T10:53:24Z","git_url":"git://github.com/alphagov/digitalmarketplace-api.git","ssh_url":"git@github.com:alphagov/digitalmarketplace-api.git","clone_url":"https://github.com/alphagov/digitalmarketplace-api.git","svn_url":"https://github.com/alphagov/digitalmarketplace-api","homepage":null,"size":3344,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/146"},"html":{"href":"https://github.com/alphagov/digitalmarketplace-api/pull/146"},"issue":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-api/issues/146"},"comments":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-api/issues/146/comments"},"review_comments":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/146/comments"},"review_comment":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-api/pulls/146/commits"},"statuses":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-api/statuses/f95c7fdd0c42193aa0dfae9e3861edc0d4c51d53"}}}}