From 7166286a6fd4b990d749fdc64c483d20826c170e Mon Sep 17 00:00:00 2001 From: Julien Odent Date: Wed, 18 Mar 2020 16:57:04 -0700 Subject: [PATCH] Add type=value to JSON response for Email, PhoneNumber and Url Summary: For consistency. Reviewed By: jtliao Differential Revision: D20524369 fbshipit-source-id: 44031667adccab9bca7b3b6d42c80878bb96ccae --- Duckling/Email/Types.hs | 5 ++++- Duckling/PhoneNumber/Types.hs | 5 ++++- Duckling/Url/Types.hs | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Duckling/Email/Types.hs b/Duckling/Email/Types.hs index f2ac30e1..3ff74a6b 100644 --- a/Duckling/Email/Types.hs +++ b/Duckling/Email/Types.hs @@ -31,4 +31,7 @@ instance Resolve EmailData where resolve _ _ x = Just (x, False) instance ToJSON EmailData where - toJSON EmailData {value} = object [ "value" .= value ] + toJSON EmailData {value} = object + [ "value" .= value + , "type" .= ("value" :: Text) + ] diff --git a/Duckling/PhoneNumber/Types.hs b/Duckling/PhoneNumber/Types.hs index 02dad981..3986ed66 100644 --- a/Duckling/PhoneNumber/Types.hs +++ b/Duckling/PhoneNumber/Types.hs @@ -50,4 +50,7 @@ data PhoneNumberValue = PhoneNumberValue { value :: Text } deriving (Eq, Ord, Show) instance ToJSON PhoneNumberValue where - toJSON (PhoneNumberValue value) = object [ "value" .= value ] + toJSON (PhoneNumberValue value) = object + [ "value" .= value + , "type" .= ("value" :: Text) + ] diff --git a/Duckling/Url/Types.hs b/Duckling/Url/Types.hs index c67078a7..cb3eb201 100644 --- a/Duckling/Url/Types.hs +++ b/Duckling/Url/Types.hs @@ -38,4 +38,5 @@ instance ToJSON UrlData where toJSON (UrlData value domain) = object [ "value" .= value , "domain" .= domain + , "type" .= ("value" :: Text) ]