{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments/27541480","id":27541480,"diff_hunk":"@@ -37,9 +37,16 @@ type RESTUpdateStrategy interface {\n \t// the object.  For example: remove fields that are not to be persisted,\n \t// sort order-insensitive list fields, etc.\n \tPrepareForUpdate(obj, old runtime.Object)\n-\t// ValidateUpdate is invoked after default fields in the object have been filled in before\n-\t// the object is persisted.\n+\t// ValidateUpdate is invoked after default fields in the object have\n+\t// been filled in, but before the object is persisted.  This method is\n+\t// responsible for ensuring that any disallowed changes are flagged.\n+\t// For example: changing immutable fields.  It does not need to\n+\t// re-validate the whole object - that is what Validate() is for.\n \tValidateUpdate(ctx api.Context, obj, old runtime.Object) fielderrors.ValidationErrorList\n+\t// Validate is invoked after default fields in the object have been\n+\t// filled in and after the update itself has been validated, but before\n+\t// the object is persisted.\n+\tValidate(ctx api.Context, obj runtime.Object) fielderrors.ValidationErrorList","path":"pkg/api/rest/update.go","position":15,"original_position":15,"commit_id":"a1377ef24f01939a6f1acdd8dc3b1a6932b841ed","original_commit_id":"a1377ef24f01939a6f1acdd8dc3b1a6932b841ed","user":{"login":"bgrant0607","id":7725777,"avatar_url":"https://avatars.githubusercontent.com/u/7725777?v=3","gravatar_id":"","url":"https://api.github.com/users/bgrant0607","html_url":"https://github.com/bgrant0607","followers_url":"https://api.github.com/users/bgrant0607/followers","following_url":"https://api.github.com/users/bgrant0607/following{/other_user}","gists_url":"https://api.github.com/users/bgrant0607/gists{/gist_id}","starred_url":"https://api.github.com/users/bgrant0607/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgrant0607/subscriptions","organizations_url":"https://api.github.com/users/bgrant0607/orgs","repos_url":"https://api.github.com/users/bgrant0607/repos","events_url":"https://api.github.com/users/bgrant0607/events{/privacy}","received_events_url":"https://api.github.com/users/bgrant0607/received_events","type":"User","site_admin":false},"body":"It seems like we really want is to separate validation of create and update from validation of object invariants.\r\n\r\nCreate should validate that required fields are provided.\r\n\r\nUpdate should validate that immutable fields are not changed.\r\n\r\nBoth should then invoke a shared function that validates requirements/invariants/rules of the object.","created_at":"2015-04-01T02:54:17Z","updated_at":"2015-04-01T02:54:17Z","html_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/6239#discussion_r27541480","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6239","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments/27541480"},"html":{"href":"https://github.com/GoogleCloudPlatform/kubernetes/pull/6239#discussion_r27541480"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6239"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6239","id":32356712,"html_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/6239","diff_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/6239.diff","patch_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/6239.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/6239","number":6239,"state":"open","locked":false,"title":"Call validate on new object when updating","user":{"login":"thockin","id":5595220,"avatar_url":"https://avatars.githubusercontent.com/u/5595220?v=3","gravatar_id":"","url":"https://api.github.com/users/thockin","html_url":"https://github.com/thockin","followers_url":"https://api.github.com/users/thockin/followers","following_url":"https://api.github.com/users/thockin/following{/other_user}","gists_url":"https://api.github.com/users/thockin/gists{/gist_id}","starred_url":"https://api.github.com/users/thockin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thockin/subscriptions","organizations_url":"https://api.github.com/users/thockin/orgs","repos_url":"https://api.github.com/users/thockin/repos","events_url":"https://api.github.com/users/thockin/events{/privacy}","received_events_url":"https://api.github.com/users/thockin/received_events","type":"User","site_admin":false},"body":"@smarterclayton \r\n\r\nObviously some tests are broken.","created_at":"2015-03-31T19:26:49Z","updated_at":"2015-04-01T02:54:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e32f34fb0b60b72e742b06dff9820b678c25db66","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6239/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6239/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/6239/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/a1377ef24f01939a6f1acdd8dc3b1a6932b841ed","head":{"label":"thockin:validate-update-includes-validate","ref":"validate-update-includes-validate","sha":"a1377ef24f01939a6f1acdd8dc3b1a6932b841ed","user":{"login":"thockin","id":5595220,"avatar_url":"https://avatars.githubusercontent.com/u/5595220?v=3","gravatar_id":"","url":"https://api.github.com/users/thockin","html_url":"https://github.com/thockin","followers_url":"https://api.github.com/users/thockin/followers","following_url":"https://api.github.com/users/thockin/following{/other_user}","gists_url":"https://api.github.com/users/thockin/gists{/gist_id}","starred_url":"https://api.github.com/users/thockin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thockin/subscriptions","organizations_url":"https://api.github.com/users/thockin/orgs","repos_url":"https://api.github.com/users/thockin/repos","events_url":"https://api.github.com/users/thockin/events{/privacy}","received_events_url":"https://api.github.com/users/thockin/received_events","type":"User","site_admin":false},"repo":{"id":21042716,"name":"kubernetes","full_name":"thockin/kubernetes","owner":{"login":"thockin","id":5595220,"avatar_url":"https://avatars.githubusercontent.com/u/5595220?v=3","gravatar_id":"","url":"https://api.github.com/users/thockin","html_url":"https://github.com/thockin","followers_url":"https://api.github.com/users/thockin/followers","following_url":"https://api.github.com/users/thockin/following{/other_user}","gists_url":"https://api.github.com/users/thockin/gists{/gist_id}","starred_url":"https://api.github.com/users/thockin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thockin/subscriptions","organizations_url":"https://api.github.com/users/thockin/orgs","repos_url":"https://api.github.com/users/thockin/repos","events_url":"https://api.github.com/users/thockin/events{/privacy}","received_events_url":"https://api.github.com/users/thockin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thockin/kubernetes","description":"Container Cluster Manager","fork":true,"url":"https://api.github.com/repos/thockin/kubernetes","forks_url":"https://api.github.com/repos/thockin/kubernetes/forks","keys_url":"https://api.github.com/repos/thockin/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thockin/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thockin/kubernetes/teams","hooks_url":"https://api.github.com/repos/thockin/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/thockin/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/thockin/kubernetes/events","assignees_url":"https://api.github.com/repos/thockin/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/thockin/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/thockin/kubernetes/tags","blobs_url":"https://api.github.com/repos/thockin/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thockin/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thockin/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/thockin/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thockin/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/thockin/kubernetes/languages","stargazers_url":"https://api.github.com/repos/thockin/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/thockin/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/thockin/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/thockin/kubernetes/subscription","commits_url":"https://api.github.com/repos/thockin/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/thockin/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/thockin/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/thockin/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/thockin/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/thockin/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thockin/kubernetes/merges","archive_url":"https://api.github.com/repos/thockin/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thockin/kubernetes/downloads","issues_url":"https://api.github.com/repos/thockin/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/thockin/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/thockin/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/thockin/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thockin/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/thockin/kubernetes/releases{/id}","created_at":"2014-06-20T15:30:28Z","updated_at":"2015-02-10T13:42:54Z","pushed_at":"2015-04-01T00:48:06Z","git_url":"git://github.com/thockin/kubernetes.git","ssh_url":"git@github.com:thockin/kubernetes.git","clone_url":"https://github.com/thockin/kubernetes.git","svn_url":"https://github.com/thockin/kubernetes","homepage":null,"size":43211,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"2de37624e83f591bc1a46dd0c1738e64ec523d98","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":20580498,"name":"kubernetes","full_name":"GoogleCloudPlatform/kubernetes","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/kubernetes","description":"Container Cluster Manager from Google","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/releases{/id}","created_at":"2014-06-06T22:56:04Z","updated_at":"2015-04-01T02:02:23Z","pushed_at":"2015-04-01T02:48:42Z","git_url":"git://github.com/GoogleCloudPlatform/kubernetes.git","ssh_url":"git@github.com:GoogleCloudPlatform/kubernetes.git","clone_url":"https://github.com/GoogleCloudPlatform/kubernetes.git","svn_url":"https://github.com/GoogleCloudPlatform/kubernetes","homepage":"http://kubernetes.io","size":123751,"stargazers_count":6829,"watchers_count":6829,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1308,"mirror_url":null,"open_issues_count":847,"forks":1308,"open_issues":847,"watchers":6829,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6239"},"html":{"href":"https://github.com/GoogleCloudPlatform/kubernetes/pull/6239"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/6239"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/6239/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6239/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/6239/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/a1377ef24f01939a6f1acdd8dc3b1a6932b841ed"}}}}