{"action":"created","issue":{"url":"https://api.github.com/repos/go-playground/validator/issues/337","repository_url":"https://api.github.com/repos/go-playground/validator","labels_url":"https://api.github.com/repos/go-playground/validator/issues/337/labels{/name}","comments_url":"https://api.github.com/repos/go-playground/validator/issues/337/comments","events_url":"https://api.github.com/repos/go-playground/validator/issues/337/events","html_url":"https://github.com/go-playground/validator/issues/337","id":288551244,"node_id":"MDU6SXNzdWUyODg1NTEyNDQ=","number":337,"title":"FieldError Field function returns struct name instead of JSON tag","user":{"login":"kerak19","id":17686157,"node_id":"MDQ6VXNlcjE3Njg2MTU3","avatar_url":"https://avatars3.githubusercontent.com/u/17686157?v=4","gravatar_id":"","url":"https://api.github.com/users/kerak19","html_url":"https://github.com/kerak19","followers_url":"https://api.github.com/users/kerak19/followers","following_url":"https://api.github.com/users/kerak19/following{/other_user}","gists_url":"https://api.github.com/users/kerak19/gists{/gist_id}","starred_url":"https://api.github.com/users/kerak19/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kerak19/subscriptions","organizations_url":"https://api.github.com/users/kerak19/orgs","repos_url":"https://api.github.com/users/kerak19/repos","events_url":"https://api.github.com/users/kerak19/events{/privacy}","received_events_url":"https://api.github.com/users/kerak19/received_events","type":"User","site_admin":false},"labels":[{"id":176505235,"node_id":"MDU6TGFiZWwxNzY1MDUyMzU=","url":"https://api.github.com/repos/go-playground/validator/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":{"login":"joeybloggs","id":8068371,"node_id":"MDQ6VXNlcjgwNjgzNzE=","avatar_url":"https://avatars0.githubusercontent.com/u/8068371?v=4","gravatar_id":"","url":"https://api.github.com/users/joeybloggs","html_url":"https://github.com/joeybloggs","followers_url":"https://api.github.com/users/joeybloggs/followers","following_url":"https://api.github.com/users/joeybloggs/following{/other_user}","gists_url":"https://api.github.com/users/joeybloggs/gists{/gist_id}","starred_url":"https://api.github.com/users/joeybloggs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joeybloggs/subscriptions","organizations_url":"https://api.github.com/users/joeybloggs/orgs","repos_url":"https://api.github.com/users/joeybloggs/repos","events_url":"https://api.github.com/users/joeybloggs/events{/privacy}","received_events_url":"https://api.github.com/users/joeybloggs/received_events","type":"User","site_admin":false},"assignees":[{"login":"joeybloggs","id":8068371,"node_id":"MDQ6VXNlcjgwNjgzNzE=","avatar_url":"https://avatars0.githubusercontent.com/u/8068371?v=4","gravatar_id":"","url":"https://api.github.com/users/joeybloggs","html_url":"https://github.com/joeybloggs","followers_url":"https://api.github.com/users/joeybloggs/followers","following_url":"https://api.github.com/users/joeybloggs/following{/other_user}","gists_url":"https://api.github.com/users/joeybloggs/gists{/gist_id}","starred_url":"https://api.github.com/users/joeybloggs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joeybloggs/subscriptions","organizations_url":"https://api.github.com/users/joeybloggs/orgs","repos_url":"https://api.github.com/users/joeybloggs/repos","events_url":"https://api.github.com/users/joeybloggs/events{/privacy}","received_events_url":"https://api.github.com/users/joeybloggs/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2018-01-15T10:45:47Z","updated_at":"2018-06-20T03:54:38Z","closed_at":null,"author_association":"NONE","body":"I do have this struct:\r\n\r\n```\r\ndata := struct {\r\n    Email    string `validate:\"required,email\" \"json:\"email\"`\r\n    Password string `validate:\"required,min=8\" \"json:\"password\"`\r\n}{}\r\n```\r\n\r\nThen i'm using `validate.Struct(data)` and i'm ranging over `ValidationErrors`.\r\nEvery `Field()` on `error` in `ValidationErrors` returns struct field instead of JSON tag.\r\nFor example, `data.Email` has json tag `\"email\"`, but it retuns `\"Email\"` instead.\r\nWhy is that? Documentation clearly says it should return JSON tag.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/go-playground/validator/issues/comments/398616431","html_url":"https://github.com/go-playground/validator/issues/337#issuecomment-398616431","issue_url":"https://api.github.com/repos/go-playground/validator/issues/337","id":398616431,"node_id":"MDEyOklzc3VlQ29tbWVudDM5ODYxNjQzMQ==","user":{"login":"pnicolcev-tulipretail","id":33558528,"node_id":"MDQ6VXNlcjMzNTU4NTI4","avatar_url":"https://avatars2.githubusercontent.com/u/33558528?v=4","gravatar_id":"","url":"https://api.github.com/users/pnicolcev-tulipretail","html_url":"https://github.com/pnicolcev-tulipretail","followers_url":"https://api.github.com/users/pnicolcev-tulipretail/followers","following_url":"https://api.github.com/users/pnicolcev-tulipretail/following{/other_user}","gists_url":"https://api.github.com/users/pnicolcev-tulipretail/gists{/gist_id}","starred_url":"https://api.github.com/users/pnicolcev-tulipretail/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pnicolcev-tulipretail/subscriptions","organizations_url":"https://api.github.com/users/pnicolcev-tulipretail/orgs","repos_url":"https://api.github.com/users/pnicolcev-tulipretail/repos","events_url":"https://api.github.com/users/pnicolcev-tulipretail/events{/privacy}","received_events_url":"https://api.github.com/users/pnicolcev-tulipretail/received_events","type":"User","site_admin":false},"created_at":"2018-06-20T03:54:38Z","updated_at":"2018-06-20T03:54:38Z","author_association":"NONE","body":"The documentation definitely makes it look like it will pick something like the JSON tag name. I think it would be very useful to add a sentence to the documentation saying something like \"You must implement RegisterTagNameFunc if you want to use a tag rather than the struct field name.\""}}
{"actor":{"display_login":"pnicolcev-tulipretail"}}