{"action":"opened","issue":{"url":"https://api.github.com/repos/goadesign/goa/issues/1940","repository_url":"https://api.github.com/repos/goadesign/goa","labels_url":"https://api.github.com/repos/goadesign/goa/issues/1940/labels{/name}","comments_url":"https://api.github.com/repos/goadesign/goa/issues/1940/comments","events_url":"https://api.github.com/repos/goadesign/goa/issues/1940/events","html_url":"https://github.com/goadesign/goa/issues/1940","id":395954323,"node_id":"MDU6SXNzdWUzOTU5NTQzMjM=","number":1940,"title":"V2: snake case payload field name doesn't work","user":{"login":"akm","id":18912,"node_id":"MDQ6VXNlcjE4OTEy","avatar_url":"https://avatars2.githubusercontent.com/u/18912?v=4","gravatar_id":"","url":"https://api.github.com/users/akm","html_url":"https://github.com/akm","followers_url":"https://api.github.com/users/akm/followers","following_url":"https://api.github.com/users/akm/following{/other_user}","gists_url":"https://api.github.com/users/akm/gists{/gist_id}","starred_url":"https://api.github.com/users/akm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akm/subscriptions","organizations_url":"https://api.github.com/users/akm/orgs","repos_url":"https://api.github.com/users/akm/repos","events_url":"https://api.github.com/users/akm/events{/privacy}","received_events_url":"https://api.github.com/users/akm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-01-04T14:58:18Z","updated_at":"2019-01-04T14:58:18Z","closed_at":null,"author_association":"NONE","body":"App generated by goa v2, which expects payload including fields with snake case name doesn't work well.\r\n\r\n## Expected Behavior\r\n\r\nAccepts fields with snake case name\r\n\r\n## Actual Behavior\r\n\r\nIgnores the values of snake case fields.\r\n\r\n## Steps to Reproduce the Problem (including complete and simple design if relevant)\r\n\r\nI made a project to reproduce this problem:\r\nhttps://github.com/akm/goa_v2_post_payload_including_snake_case_fields\r\n\r\nYou can run the test by the following command:\r\n```\r\n$ git clone https://github.com/akm/goa_v2_post_payload_including_snake_case_fields.git $GOPATH/src/github.com/akm/goa_v2_post_payload_including_snake_case_fields\r\n$ cd $GOPATH/src/github.com/akm/goa_v2_post_payload_including_snake_case_fields\r\n$ go test\r\n```\r\n\r\n### Without snake case names\r\n\r\nUsing [design.go without snake case names](https://github.com/akm/goa_v2_post_payload_including_snake_case_fields/blob/before_change_field_names/design/desgin.go), the test shows \r\n```\r\n$ git checkout before_change_field_names\r\n$ go test\r\nLOG: user.go:24: user.create\r\nPASS\r\nok  \tgithub.com/akm/goa_v2_post_payload_including_snake_case_fields\t0.025s\r\n```\r\n\r\n### With snake case names\r\n\r\nUsing [design.go with snake case names](https://github.com/akm/goa_v2_post_payload_including_snake_case_fields/blob/4acac5f581efab441fb49f2834c25cf19e25d1fa/design/desgin.go), the test shows \r\n\r\n```\r\n$ git checkout master\r\n$ go test\r\n--- FAIL: TestUserCreate (0.00s)\r\n\tuser_test.go:61: Status code must be 201 but was 400. Response body: {\"name\":\"missing_field\",\"id\":\"kutxn_KF\",\"message\":\"\\\"first_name\\\" is missing from body\",\"temporary\":false,\"timeout\":false,\"fault\":false}\r\n\t\t\r\nFAIL\r\nexit status 1\r\n```\r\n\r\n## Specifications\r\n\r\n  - goa Version: v2.0.0-wip 75f4ecdc0d34475de8c68f9f9b237d189eb0305c\r\n  - Platform (Linux/Windows etc.): Mac OS X 10.14.2（18C54）\r\n\r\n## Memo\r\n\r\nI read the generated source code, it seems that [body of NewCreateUserPayload  in gen/http/user/server/types.go](https://github.com/akm/goa_v2_post_payload_including_snake_case_fields/blob/master/gen/http/user/server/types.go#L33-L36) must have json tag. The test passes with [fixing generated source code](https://github.com/akm/goa_v2_post_payload_including_snake_case_fields/commit/3f51c2d2a1bb50a87eda4b571249d4d8b85e2dfd), but I can't fix the generator.\r\n"}}
{"actor":{"display_login":"akm"}}