Add type=value to JSON response for Email, PhoneNumber and Url

Summary: For consistency.

Reviewed By: jtliao

Differential Revision: D20524369

fbshipit-source-id: 44031667adccab9bca7b3b6d42c80878bb96ccae
This commit is contained in:
Julien Odent 2020-03-18 16:57:04 -07:00 committed by Facebook GitHub Bot
parent 5d6750208a
commit 7166286a6f
3 changed files with 9 additions and 2 deletions

View File

@ -31,4 +31,7 @@ instance Resolve EmailData where
resolve _ _ x = Just (x, False) resolve _ _ x = Just (x, False)
instance ToJSON EmailData where instance ToJSON EmailData where
toJSON EmailData {value} = object [ "value" .= value ] toJSON EmailData {value} = object
[ "value" .= value
, "type" .= ("value" :: Text)
]

View File

@ -50,4 +50,7 @@ data PhoneNumberValue = PhoneNumberValue { value :: Text }
deriving (Eq, Ord, Show) deriving (Eq, Ord, Show)
instance ToJSON PhoneNumberValue where instance ToJSON PhoneNumberValue where
toJSON (PhoneNumberValue value) = object [ "value" .= value ] toJSON (PhoneNumberValue value) = object
[ "value" .= value
, "type" .= ("value" :: Text)
]

View File

@ -38,4 +38,5 @@ instance ToJSON UrlData where
toJSON (UrlData value domain) = object toJSON (UrlData value domain) = object
[ "value" .= value [ "value" .= value
, "domain" .= domain , "domain" .= domain
, "type" .= ("value" :: Text)
] ]