{"action":"created","comment":{"url":"https://api.github.com/repos/lob/litmus/pulls/comments/206245193","pull_request_review_id":141622924,"id":206245193,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNjI0NTE5Mw==","diff_hunk":"@@ -36,6 +37,37 @@ defmodule Litmus.Type.String do\n     end\n   end\n \n+  @spec convert(t, binary, map) :: {:ok, map}\n+  defp convert(%__MODULE__{}, field, params) do\n+    if Map.has_key?(params, field) and\n+         !(is_binary(params[field]) or is_number(params[field]) or is_boolean(params[field])) do\n+      {:error, \"#{field} must be string\"}\n+    else\n+      if is_binary(params[field]) do\n+        {:ok, params}\n+      else\n+        modified_value = Kernel.inspect(params[field])\n+        modified_params = Map.put(params, field, modified_value)\n+        {:ok, modified_params}\n+      end\n+    end","path":"lib/type/string.ex","position":25,"original_position":25,"commit_id":"d5b51b8edb9f8bebd61c2296941e951c51bc3912","original_commit_id":"d5b51b8edb9f8bebd61c2296941e951c51bc3912","user":{"login":"mgartner","id":1128750,"node_id":"MDQ6VXNlcjExMjg3NTA=","avatar_url":"https://avatars3.githubusercontent.com/u/1128750?v=4","gravatar_id":"","url":"https://api.github.com/users/mgartner","html_url":"https://github.com/mgartner","followers_url":"https://api.github.com/users/mgartner/followers","following_url":"https://api.github.com/users/mgartner/following{/other_user}","gists_url":"https://api.github.com/users/mgartner/gists{/gist_id}","starred_url":"https://api.github.com/users/mgartner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgartner/subscriptions","organizations_url":"https://api.github.com/users/mgartner/orgs","repos_url":"https://api.github.com/users/mgartner/repos","events_url":"https://api.github.com/users/mgartner/events{/privacy}","received_events_url":"https://api.github.com/users/mgartner/received_events","type":"User","site_admin":false},"body":"I'd recommend a cond as well, and think about simplifying this logic into the main four cases:\r\n\r\n1. params does not contain the field\r\n2. params does contain the field and its a binary\r\n3. params does contain the field and its a number or boolean\r\n4. else","created_at":"2018-07-30T16:51:59Z","updated_at":"2018-07-30T16:51:59Z","html_url":"https://github.com/lob/litmus/pull/9#discussion_r206245193","pull_request_url":"https://api.github.com/repos/lob/litmus/pulls/9","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/lob/litmus/pulls/comments/206245193"},"html":{"href":"https://github.com/lob/litmus/pull/9#discussion_r206245193"},"pull_request":{"href":"https://api.github.com/repos/lob/litmus/pulls/9"}},"in_reply_to_id":206241825},"pull_request":{"url":"https://api.github.com/repos/lob/litmus/pulls/9","id":204564647,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0NTY0NjQ3","html_url":"https://github.com/lob/litmus/pull/9","diff_url":"https://github.com/lob/litmus/pull/9.diff","patch_url":"https://github.com/lob/litmus/pull/9.patch","issue_url":"https://api.github.com/repos/lob/litmus/issues/9","number":9,"state":"open","locked":false,"title":"feat(string-validation): Convert number and boolean field values to string","user":{"login":"shraddha1704","id":17977604,"node_id":"MDQ6VXNlcjE3OTc3NjA0","avatar_url":"https://avatars0.githubusercontent.com/u/17977604?v=4","gravatar_id":"","url":"https://api.github.com/users/shraddha1704","html_url":"https://github.com/shraddha1704","followers_url":"https://api.github.com/users/shraddha1704/followers","following_url":"https://api.github.com/users/shraddha1704/following{/other_user}","gists_url":"https://api.github.com/users/shraddha1704/gists{/gist_id}","starred_url":"https://api.github.com/users/shraddha1704/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shraddha1704/subscriptions","organizations_url":"https://api.github.com/users/shraddha1704/orgs","repos_url":"https://api.github.com/users/shraddha1704/repos","events_url":"https://api.github.com/users/shraddha1704/events{/privacy}","received_events_url":"https://api.github.com/users/shraddha1704/received_events","type":"User","site_admin":false},"body":"### What\r\n* Convert `Number` and `Boolean` field values to type `String`.\r\n\r\n### Why\r\n* Giving number or boolean values in string schema will not throw an error. It will be converted to string type.","created_at":"2018-07-28T00:11:44Z","updated_at":"2018-07-30T16:51:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d5a1a6e419fc4d0f36db498d489cfcafddaace1f","assignee":{"login":"shraddha1704","id":17977604,"node_id":"MDQ6VXNlcjE3OTc3NjA0","avatar_url":"https://avatars0.githubusercontent.com/u/17977604?v=4","gravatar_id":"","url":"https://api.github.com/users/shraddha1704","html_url":"https://github.com/shraddha1704","followers_url":"https://api.github.com/users/shraddha1704/followers","following_url":"https://api.github.com/users/shraddha1704/following{/other_user}","gists_url":"https://api.github.com/users/shraddha1704/gists{/gist_id}","starred_url":"https://api.github.com/users/shraddha1704/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shraddha1704/subscriptions","organizations_url":"https://api.github.com/users/shraddha1704/orgs","repos_url":"https://api.github.com/users/shraddha1704/repos","events_url":"https://api.github.com/users/shraddha1704/events{/privacy}","received_events_url":"https://api.github.com/users/shraddha1704/received_events","type":"User","site_admin":false},"assignees":[{"login":"shraddha1704","id":17977604,"node_id":"MDQ6VXNlcjE3OTc3NjA0","avatar_url":"https://avatars0.githubusercontent.com/u/17977604?v=4","gravatar_id":"","url":"https://api.github.com/users/shraddha1704","html_url":"https://github.com/shraddha1704","followers_url":"https://api.github.com/users/shraddha1704/followers","following_url":"https://api.github.com/users/shraddha1704/following{/other_user}","gists_url":"https://api.github.com/users/shraddha1704/gists{/gist_id}","starred_url":"https://api.github.com/users/shraddha1704/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shraddha1704/subscriptions","organizations_url":"https://api.github.com/users/shraddha1704/orgs","repos_url":"https://api.github.com/users/shraddha1704/repos","events_url":"https://api.github.com/users/shraddha1704/events{/privacy}","received_events_url":"https://api.github.com/users/shraddha1704/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/lob/litmus/pulls/9/commits","review_comments_url":"https://api.github.com/repos/lob/litmus/pulls/9/comments","review_comment_url":"https://api.github.com/repos/lob/litmus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lob/litmus/issues/9/comments","statuses_url":"https://api.github.com/repos/lob/litmus/statuses/d5b51b8edb9f8bebd61c2296941e951c51bc3912","head":{"label":"lob:string-validation-v3","ref":"string-validation-v3","sha":"d5b51b8edb9f8bebd61c2296941e951c51bc3912","user":{"login":"lob","id":4955790,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ5NTU3OTA=","avatar_url":"https://avatars2.githubusercontent.com/u/4955790?v=4","gravatar_id":"","url":"https://api.github.com/users/lob","html_url":"https://github.com/lob","followers_url":"https://api.github.com/users/lob/followers","following_url":"https://api.github.com/users/lob/following{/other_user}","gists_url":"https://api.github.com/users/lob/gists{/gist_id}","starred_url":"https://api.github.com/users/lob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lob/subscriptions","organizations_url":"https://api.github.com/users/lob/orgs","repos_url":"https://api.github.com/users/lob/repos","events_url":"https://api.github.com/users/lob/events{/privacy}","received_events_url":"https://api.github.com/users/lob/received_events","type":"Organization","site_admin":false},"repo":{"id":141321808,"node_id":"MDEwOlJlcG9zaXRvcnkxNDEzMjE4MDg=","name":"litmus","full_name":"lob/litmus","owner":{"login":"lob","id":4955790,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ5NTU3OTA=","avatar_url":"https://avatars2.githubusercontent.com/u/4955790?v=4","gravatar_id":"","url":"https://api.github.com/users/lob","html_url":"https://github.com/lob","followers_url":"https://api.github.com/users/lob/followers","following_url":"https://api.github.com/users/lob/following{/other_user}","gists_url":"https://api.github.com/users/lob/gists{/gist_id}","starred_url":"https://api.github.com/users/lob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lob/subscriptions","organizations_url":"https://api.github.com/users/lob/orgs","repos_url":"https://api.github.com/users/lob/repos","events_url":"https://api.github.com/users/lob/events{/privacy}","received_events_url":"https://api.github.com/users/lob/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lob/litmus","description":"Data schema validation in Elixir","fork":false,"url":"https://api.github.com/repos/lob/litmus","forks_url":"https://api.github.com/repos/lob/litmus/forks","keys_url":"https://api.github.com/repos/lob/litmus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lob/litmus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lob/litmus/teams","hooks_url":"https://api.github.com/repos/lob/litmus/hooks","issue_events_url":"https://api.github.com/repos/lob/litmus/issues/events{/number}","events_url":"https://api.github.com/repos/lob/litmus/events","assignees_url":"https://api.github.com/repos/lob/litmus/assignees{/user}","branches_url":"https://api.github.com/repos/lob/litmus/branches{/branch}","tags_url":"https://api.github.com/repos/lob/litmus/tags","blobs_url":"https://api.github.com/repos/lob/litmus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lob/litmus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lob/litmus/git/refs{/sha}","trees_url":"https://api.github.com/repos/lob/litmus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lob/litmus/statuses/{sha}","languages_url":"https://api.github.com/repos/lob/litmus/languages","stargazers_url":"https://api.github.com/repos/lob/litmus/stargazers","contributors_url":"https://api.github.com/repos/lob/litmus/contributors","subscribers_url":"https://api.github.com/repos/lob/litmus/subscribers","subscription_url":"https://api.github.com/repos/lob/litmus/subscription","commits_url":"https://api.github.com/repos/lob/litmus/commits{/sha}","git_commits_url":"https://api.github.com/repos/lob/litmus/git/commits{/sha}","comments_url":"https://api.github.com/repos/lob/litmus/comments{/number}","issue_comment_url":"https://api.github.com/repos/lob/litmus/issues/comments{/number}","contents_url":"https://api.github.com/repos/lob/litmus/contents/{+path}","compare_url":"https://api.github.com/repos/lob/litmus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lob/litmus/merges","archive_url":"https://api.github.com/repos/lob/litmus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lob/litmus/downloads","issues_url":"https://api.github.com/repos/lob/litmus/issues{/number}","pulls_url":"https://api.github.com/repos/lob/litmus/pulls{/number}","milestones_url":"https://api.github.com/repos/lob/litmus/milestones{/number}","notifications_url":"https://api.github.com/repos/lob/litmus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lob/litmus/labels{/name}","releases_url":"https://api.github.com/repos/lob/litmus/releases{/id}","deployments_url":"https://api.github.com/repos/lob/litmus/deployments","created_at":"2018-07-17T17:25:23Z","updated_at":"2018-07-27T23:48:54Z","pushed_at":"2018-07-28T00:34:42Z","git_url":"git://github.com/lob/litmus.git","ssh_url":"git@github.com:lob/litmus.git","clone_url":"https://github.com/lob/litmus.git","svn_url":"https://github.com/lob/litmus","homepage":null,"size":1594,"stargazers_count":0,"watchers_count":0,"language":"Elixir","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"lob:master","ref":"master","sha":"45f29c1b6eeaffd9fffa0a2019f3741f54893e88","user":{"login":"lob","id":4955790,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ5NTU3OTA=","avatar_url":"https://avatars2.githubusercontent.com/u/4955790?v=4","gravatar_id":"","url":"https://api.github.com/users/lob","html_url":"https://github.com/lob","followers_url":"https://api.github.com/users/lob/followers","following_url":"https://api.github.com/users/lob/following{/other_user}","gists_url":"https://api.github.com/users/lob/gists{/gist_id}","starred_url":"https://api.github.com/users/lob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lob/subscriptions","organizations_url":"https://api.github.com/users/lob/orgs","repos_url":"https://api.github.com/users/lob/repos","events_url":"https://api.github.com/users/lob/events{/privacy}","received_events_url":"https://api.github.com/users/lob/received_events","type":"Organization","site_admin":false},"repo":{"id":141321808,"node_id":"MDEwOlJlcG9zaXRvcnkxNDEzMjE4MDg=","name":"litmus","full_name":"lob/litmus","owner":{"login":"lob","id":4955790,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ5NTU3OTA=","avatar_url":"https://avatars2.githubusercontent.com/u/4955790?v=4","gravatar_id":"","url":"https://api.github.com/users/lob","html_url":"https://github.com/lob","followers_url":"https://api.github.com/users/lob/followers","following_url":"https://api.github.com/users/lob/following{/other_user}","gists_url":"https://api.github.com/users/lob/gists{/gist_id}","starred_url":"https://api.github.com/users/lob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lob/subscriptions","organizations_url":"https://api.github.com/users/lob/orgs","repos_url":"https://api.github.com/users/lob/repos","events_url":"https://api.github.com/users/lob/events{/privacy}","received_events_url":"https://api.github.com/users/lob/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lob/litmus","description":"Data schema validation in Elixir","fork":false,"url":"https://api.github.com/repos/lob/litmus","forks_url":"https://api.github.com/repos/lob/litmus/forks","keys_url":"https://api.github.com/repos/lob/litmus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lob/litmus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lob/litmus/teams","hooks_url":"https://api.github.com/repos/lob/litmus/hooks","issue_events_url":"https://api.github.com/repos/lob/litmus/issues/events{/number}","events_url":"https://api.github.com/repos/lob/litmus/events","assignees_url":"https://api.github.com/repos/lob/litmus/assignees{/user}","branches_url":"https://api.github.com/repos/lob/litmus/branches{/branch}","tags_url":"https://api.github.com/repos/lob/litmus/tags","blobs_url":"https://api.github.com/repos/lob/litmus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lob/litmus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lob/litmus/git/refs{/sha}","trees_url":"https://api.github.com/repos/lob/litmus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lob/litmus/statuses/{sha}","languages_url":"https://api.github.com/repos/lob/litmus/languages","stargazers_url":"https://api.github.com/repos/lob/litmus/stargazers","contributors_url":"https://api.github.com/repos/lob/litmus/contributors","subscribers_url":"https://api.github.com/repos/lob/litmus/subscribers","subscription_url":"https://api.github.com/repos/lob/litmus/subscription","commits_url":"https://api.github.com/repos/lob/litmus/commits{/sha}","git_commits_url":"https://api.github.com/repos/lob/litmus/git/commits{/sha}","comments_url":"https://api.github.com/repos/lob/litmus/comments{/number}","issue_comment_url":"https://api.github.com/repos/lob/litmus/issues/comments{/number}","contents_url":"https://api.github.com/repos/lob/litmus/contents/{+path}","compare_url":"https://api.github.com/repos/lob/litmus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lob/litmus/merges","archive_url":"https://api.github.com/repos/lob/litmus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lob/litmus/downloads","issues_url":"https://api.github.com/repos/lob/litmus/issues{/number}","pulls_url":"https://api.github.com/repos/lob/litmus/pulls{/number}","milestones_url":"https://api.github.com/repos/lob/litmus/milestones{/number}","notifications_url":"https://api.github.com/repos/lob/litmus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lob/litmus/labels{/name}","releases_url":"https://api.github.com/repos/lob/litmus/releases{/id}","deployments_url":"https://api.github.com/repos/lob/litmus/deployments","created_at":"2018-07-17T17:25:23Z","updated_at":"2018-07-27T23:48:54Z","pushed_at":"2018-07-28T00:34:42Z","git_url":"git://github.com/lob/litmus.git","ssh_url":"git@github.com:lob/litmus.git","clone_url":"https://github.com/lob/litmus.git","svn_url":"https://github.com/lob/litmus","homepage":null,"size":1594,"stargazers_count":0,"watchers_count":0,"language":"Elixir","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lob/litmus/pulls/9"},"html":{"href":"https://github.com/lob/litmus/pull/9"},"issue":{"href":"https://api.github.com/repos/lob/litmus/issues/9"},"comments":{"href":"https://api.github.com/repos/lob/litmus/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/lob/litmus/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/lob/litmus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lob/litmus/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/lob/litmus/statuses/d5b51b8edb9f8bebd61c2296941e951c51bc3912"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"mgartner"}}