{"action":"created","comment":{"url":"https://api.github.com/repos/Azure/autorest/pulls/comments/91145620","pull_request_review_id":11655220,"id":91145620,"diff_hunk":"@@ -810,27 +812,37 @@ public static string Validate(this IEnumerable<Parameter> parameters, HttpMethod\n                     var map = prop.Type as MapType;\n                     var composite = prop.Type as CompositeType;\n \n+\n+                    // if this type was flattened use the name of the type instead of\n+                    // the property name as it's been embedded as an anonymous field\n+                    var propName = prop.Name;\n+                    if (prop.WasFlattened())\n+                        propName = prop.Type.Name;\n+\n                     if (primary != null || sequence != null || map != null)\n-                        x.AddRange(prop.ValidateType($\"{name}.{prop.Name}\", method, true));\n+                    {\n+                        x.AddRange(prop.ValidateType($\"{name}.{propName}\", method, true));\n+                    }\n                     else if (composite != null)\n                     {\n                         if (ancestors.Contains(composite.Name))\n                         {\n-                            x.AddNullValidation($\"{name}.{prop.Name}\", p.IsRequired);\n+                            x.AddNullValidation($\"{name}.{propName}\", p.IsRequired);\n                         }\n                         else\n                         {\n                             ancestors.Add(composite.Name);\n-                            x.AddRange(prop.ValidateCompositeType($\"{name}.{prop.Name}\", method, ancestors, true));\n+                            x.AddRange(prop.ValidateCompositeType($\"{name}.{propName}\", method, ancestors, true));\n                             ancestors.Remove(composite.Name);\n-                        }  \n+                        }\n                     }   \n                 }\n             }\n \n             x.AddRange(from prop in ((CompositeType)p.Type).Properties\n                        where prop.IsReadOnly\n-                       select GetConstraint($\"{name}.{prop.Name}\", ReadOnlyConstraint, \"true\"));\n+                       select GetConstraint(string.Format(\"{0}.{1}\", name, prop.WasFlattened() ? prop.Type.Name : prop.Name),","path":"src/generator/AutoRest.Go/Extensions.cs","position":50,"original_position":50,"commit_id":"0af7b218858a83d8ed6baf6e67b6494449104724","original_commit_id":"0af7b218858a83d8ed6baf6e67b6494449104724","user":{"login":"mcardosos","id":18688426,"avatar_url":"https://avatars.githubusercontent.com/u/18688426?v=3","gravatar_id":"","url":"https://api.github.com/users/mcardosos","html_url":"https://github.com/mcardosos","followers_url":"https://api.github.com/users/mcardosos/followers","following_url":"https://api.github.com/users/mcardosos/following{/other_user}","gists_url":"https://api.github.com/users/mcardosos/gists{/gist_id}","starred_url":"https://api.github.com/users/mcardosos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcardosos/subscriptions","organizations_url":"https://api.github.com/users/mcardosos/orgs","repos_url":"https://api.github.com/users/mcardosos/repos","events_url":"https://api.github.com/users/mcardosos/events{/privacy}","received_events_url":"https://api.github.com/users/mcardosos/received_events","type":"User","site_admin":false},"body":"Can we replace `prop.WasFlattened() ? prop.Type.Name : prop.Name` with `propName`?","created_at":"2016-12-06T18:53:42Z","updated_at":"2016-12-06T18:53:42Z","html_url":"https://github.com/Azure/autorest/pull/1649#discussion_r91145620","pull_request_url":"https://api.github.com/repos/Azure/autorest/pulls/1649","_links":{"self":{"href":"https://api.github.com/repos/Azure/autorest/pulls/comments/91145620"},"html":{"href":"https://github.com/Azure/autorest/pull/1649#discussion_r91145620"},"pull_request":{"href":"https://api.github.com/repos/Azure/autorest/pulls/1649"}}},"pull_request":{"url":"https://api.github.com/repos/Azure/autorest/pulls/1649","id":95984653,"html_url":"https://github.com/Azure/autorest/pull/1649","diff_url":"https://github.com/Azure/autorest/pull/1649.diff","patch_url":"https://github.com/Azure/autorest/pull/1649.patch","issue_url":"https://api.github.com/repos/Azure/autorest/issues/1649","number":1649,"state":"open","locked":false,"title":"Fix parameter validation codegen for flattened types.","user":{"login":"jhendrixMSFT","id":10090263,"avatar_url":"https://avatars.githubusercontent.com/u/10090263?v=3","gravatar_id":"","url":"https://api.github.com/users/jhendrixMSFT","html_url":"https://github.com/jhendrixMSFT","followers_url":"https://api.github.com/users/jhendrixMSFT/followers","following_url":"https://api.github.com/users/jhendrixMSFT/following{/other_user}","gists_url":"https://api.github.com/users/jhendrixMSFT/gists{/gist_id}","starred_url":"https://api.github.com/users/jhendrixMSFT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhendrixMSFT/subscriptions","organizations_url":"https://api.github.com/users/jhendrixMSFT/orgs","repos_url":"https://api.github.com/users/jhendrixMSFT/repos","events_url":"https://api.github.com/users/jhendrixMSFT/events{/privacy}","received_events_url":"https://api.github.com/users/jhendrixMSFT/received_events","type":"User","site_admin":false},"body":"The codegen for parameter validation wasn't updated to account for type\r\nflattening which introduced regressions in the SDK.  Track if a type was\r\nflattened and if it was generate the appropriate validation code.","created_at":"2016-11-30T22:12:34Z","updated_at":"2016-12-06T18:53:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"563f24b23bc8c883cb7e60f0bc163ec38d9905df","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Azure/autorest/pulls/1649/commits","review_comments_url":"https://api.github.com/repos/Azure/autorest/pulls/1649/comments","review_comment_url":"https://api.github.com/repos/Azure/autorest/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Azure/autorest/issues/1649/comments","statuses_url":"https://api.github.com/repos/Azure/autorest/statuses/0af7b218858a83d8ed6baf6e67b6494449104724","head":{"label":"jhendrixMSFT:bugfixes","ref":"bugfixes","sha":"0af7b218858a83d8ed6baf6e67b6494449104724","user":{"login":"jhendrixMSFT","id":10090263,"avatar_url":"https://avatars.githubusercontent.com/u/10090263?v=3","gravatar_id":"","url":"https://api.github.com/users/jhendrixMSFT","html_url":"https://github.com/jhendrixMSFT","followers_url":"https://api.github.com/users/jhendrixMSFT/followers","following_url":"https://api.github.com/users/jhendrixMSFT/following{/other_user}","gists_url":"https://api.github.com/users/jhendrixMSFT/gists{/gist_id}","starred_url":"https://api.github.com/users/jhendrixMSFT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhendrixMSFT/subscriptions","organizations_url":"https://api.github.com/users/jhendrixMSFT/orgs","repos_url":"https://api.github.com/users/jhendrixMSFT/repos","events_url":"https://api.github.com/users/jhendrixMSFT/events{/privacy}","received_events_url":"https://api.github.com/users/jhendrixMSFT/received_events","type":"User","site_admin":false},"repo":{"id":68136148,"name":"autorest","full_name":"jhendrixMSFT/autorest","owner":{"login":"jhendrixMSFT","id":10090263,"avatar_url":"https://avatars.githubusercontent.com/u/10090263?v=3","gravatar_id":"","url":"https://api.github.com/users/jhendrixMSFT","html_url":"https://github.com/jhendrixMSFT","followers_url":"https://api.github.com/users/jhendrixMSFT/followers","following_url":"https://api.github.com/users/jhendrixMSFT/following{/other_user}","gists_url":"https://api.github.com/users/jhendrixMSFT/gists{/gist_id}","starred_url":"https://api.github.com/users/jhendrixMSFT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhendrixMSFT/subscriptions","organizations_url":"https://api.github.com/users/jhendrixMSFT/orgs","repos_url":"https://api.github.com/users/jhendrixMSFT/repos","events_url":"https://api.github.com/users/jhendrixMSFT/events{/privacy}","received_events_url":"https://api.github.com/users/jhendrixMSFT/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jhendrixMSFT/autorest","description":"Swagger (OpenAPI) Specification code generator featuring C# and Razor templates. Supports C#, Java, Node.js, TypeScript, Python and Ruby.","fork":true,"url":"https://api.github.com/repos/jhendrixMSFT/autorest","forks_url":"https://api.github.com/repos/jhendrixMSFT/autorest/forks","keys_url":"https://api.github.com/repos/jhendrixMSFT/autorest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jhendrixMSFT/autorest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jhendrixMSFT/autorest/teams","hooks_url":"https://api.github.com/repos/jhendrixMSFT/autorest/hooks","issue_events_url":"https://api.github.com/repos/jhendrixMSFT/autorest/issues/events{/number}","events_url":"https://api.github.com/repos/jhendrixMSFT/autorest/events","assignees_url":"https://api.github.com/repos/jhendrixMSFT/autorest/assignees{/user}","branches_url":"https://api.github.com/repos/jhendrixMSFT/autorest/branches{/branch}","tags_url":"https://api.github.com/repos/jhendrixMSFT/autorest/tags","blobs_url":"https://api.github.com/repos/jhendrixMSFT/autorest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jhendrixMSFT/autorest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jhendrixMSFT/autorest/git/refs{/sha}","trees_url":"https://api.github.com/repos/jhendrixMSFT/autorest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jhendrixMSFT/autorest/statuses/{sha}","languages_url":"https://api.github.com/repos/jhendrixMSFT/autorest/languages","stargazers_url":"https://api.github.com/repos/jhendrixMSFT/autorest/stargazers","contributors_url":"https://api.github.com/repos/jhendrixMSFT/autorest/contributors","subscribers_url":"https://api.github.com/repos/jhendrixMSFT/autorest/subscribers","subscription_url":"https://api.github.com/repos/jhendrixMSFT/autorest/subscription","commits_url":"https://api.github.com/repos/jhendrixMSFT/autorest/commits{/sha}","git_commits_url":"https://api.github.com/repos/jhendrixMSFT/autorest/git/commits{/sha}","comments_url":"https://api.github.com/repos/jhendrixMSFT/autorest/comments{/number}","issue_comment_url":"https://api.github.com/repos/jhendrixMSFT/autorest/issues/comments{/number}","contents_url":"https://api.github.com/repos/jhendrixMSFT/autorest/contents/{+path}","compare_url":"https://api.github.com/repos/jhendrixMSFT/autorest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jhendrixMSFT/autorest/merges","archive_url":"https://api.github.com/repos/jhendrixMSFT/autorest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jhendrixMSFT/autorest/downloads","issues_url":"https://api.github.com/repos/jhendrixMSFT/autorest/issues{/number}","pulls_url":"https://api.github.com/repos/jhendrixMSFT/autorest/pulls{/number}","milestones_url":"https://api.github.com/repos/jhendrixMSFT/autorest/milestones{/number}","notifications_url":"https://api.github.com/repos/jhendrixMSFT/autorest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jhendrixMSFT/autorest/labels{/name}","releases_url":"https://api.github.com/repos/jhendrixMSFT/autorest/releases{/id}","deployments_url":"https://api.github.com/repos/jhendrixMSFT/autorest/deployments","created_at":"2016-09-13T18:31:49Z","updated_at":"2016-09-13T18:31:58Z","pushed_at":"2016-12-06T17:35:51Z","git_url":"git://github.com/jhendrixMSFT/autorest.git","ssh_url":"git@github.com:jhendrixMSFT/autorest.git","clone_url":"https://github.com/jhendrixMSFT/autorest.git","svn_url":"https://github.com/jhendrixMSFT/autorest","homepage":"","size":56179,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Azure:legacy","ref":"legacy","sha":"3f91c30390f91098517785aba573a6d6d5608a0f","user":{"login":"Azure","id":6844498,"avatar_url":"https://avatars.githubusercontent.com/u/6844498?v=3","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"repo":{"id":31089461,"name":"autorest","full_name":"Azure/autorest","owner":{"login":"Azure","id":6844498,"avatar_url":"https://avatars.githubusercontent.com/u/6844498?v=3","gravatar_id":"","url":"https://api.github.com/users/Azure","html_url":"https://github.com/Azure","followers_url":"https://api.github.com/users/Azure/followers","following_url":"https://api.github.com/users/Azure/following{/other_user}","gists_url":"https://api.github.com/users/Azure/gists{/gist_id}","starred_url":"https://api.github.com/users/Azure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azure/subscriptions","organizations_url":"https://api.github.com/users/Azure/orgs","repos_url":"https://api.github.com/users/Azure/repos","events_url":"https://api.github.com/users/Azure/events{/privacy}","received_events_url":"https://api.github.com/users/Azure/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Azure/autorest","description":"Swagger (OpenAPI) Specification code generator featuring C# and Razor templates. Supports C#, Java, Node.js, TypeScript, Python and Ruby.","fork":false,"url":"https://api.github.com/repos/Azure/autorest","forks_url":"https://api.github.com/repos/Azure/autorest/forks","keys_url":"https://api.github.com/repos/Azure/autorest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Azure/autorest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Azure/autorest/teams","hooks_url":"https://api.github.com/repos/Azure/autorest/hooks","issue_events_url":"https://api.github.com/repos/Azure/autorest/issues/events{/number}","events_url":"https://api.github.com/repos/Azure/autorest/events","assignees_url":"https://api.github.com/repos/Azure/autorest/assignees{/user}","branches_url":"https://api.github.com/repos/Azure/autorest/branches{/branch}","tags_url":"https://api.github.com/repos/Azure/autorest/tags","blobs_url":"https://api.github.com/repos/Azure/autorest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Azure/autorest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Azure/autorest/git/refs{/sha}","trees_url":"https://api.github.com/repos/Azure/autorest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Azure/autorest/statuses/{sha}","languages_url":"https://api.github.com/repos/Azure/autorest/languages","stargazers_url":"https://api.github.com/repos/Azure/autorest/stargazers","contributors_url":"https://api.github.com/repos/Azure/autorest/contributors","subscribers_url":"https://api.github.com/repos/Azure/autorest/subscribers","subscription_url":"https://api.github.com/repos/Azure/autorest/subscription","commits_url":"https://api.github.com/repos/Azure/autorest/commits{/sha}","git_commits_url":"https://api.github.com/repos/Azure/autorest/git/commits{/sha}","comments_url":"https://api.github.com/repos/Azure/autorest/comments{/number}","issue_comment_url":"https://api.github.com/repos/Azure/autorest/issues/comments{/number}","contents_url":"https://api.github.com/repos/Azure/autorest/contents/{+path}","compare_url":"https://api.github.com/repos/Azure/autorest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Azure/autorest/merges","archive_url":"https://api.github.com/repos/Azure/autorest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Azure/autorest/downloads","issues_url":"https://api.github.com/repos/Azure/autorest/issues{/number}","pulls_url":"https://api.github.com/repos/Azure/autorest/pulls{/number}","milestones_url":"https://api.github.com/repos/Azure/autorest/milestones{/number}","notifications_url":"https://api.github.com/repos/Azure/autorest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Azure/autorest/labels{/name}","releases_url":"https://api.github.com/repos/Azure/autorest/releases{/id}","deployments_url":"https://api.github.com/repos/Azure/autorest/deployments","created_at":"2015-02-20T23:02:54Z","updated_at":"2016-12-04T11:06:27Z","pushed_at":"2016-12-06T18:04:33Z","git_url":"git://github.com/Azure/autorest.git","ssh_url":"git@github.com:Azure/autorest.git","clone_url":"https://github.com/Azure/autorest.git","svn_url":"https://github.com/Azure/autorest","homepage":"","size":64410,"stargazers_count":579,"watchers_count":579,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":195,"mirror_url":null,"open_issues_count":140,"forks":195,"open_issues":140,"watchers":579,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Azure/autorest/pulls/1649"},"html":{"href":"https://github.com/Azure/autorest/pull/1649"},"issue":{"href":"https://api.github.com/repos/Azure/autorest/issues/1649"},"comments":{"href":"https://api.github.com/repos/Azure/autorest/issues/1649/comments"},"review_comments":{"href":"https://api.github.com/repos/Azure/autorest/pulls/1649/comments"},"review_comment":{"href":"https://api.github.com/repos/Azure/autorest/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Azure/autorest/pulls/1649/commits"},"statuses":{"href":"https://api.github.com/repos/Azure/autorest/statuses/0af7b218858a83d8ed6baf6e67b6494449104724"}}}}
{"actor":{"display_login":"mcardosos"}}