1
1
mirror of https://github.com/github/semantic.git synced 2025-01-05 14:11:33 +03:00

Output term, category, sourceSpan

This commit is contained in:
joshvera 2017-01-23 17:46:29 -05:00
parent e58799c42d
commit b3bbff3f45

View File

@ -59,7 +59,10 @@ data JSONSummary = JSONSummary { info :: ParentInfo, changeType :: Text }
instance ToJSON JSONSummary where
-- TODO fix JSON instance
toJSON JSONSummary{..} = object [ "changeType" .= changeType ]
toJSON JSONSummary{..} = object . ([ "changeType" .= changeType ] <>) $ case info of
ParentInfo{..} -> [ "category" .= (show parentCategory :: Text), "term" .= parentTermName, "sourceSpan" .= parentSourceSpan ]
ExpressionInfo{..} -> [ "category" .= (show exprCategory :: Text), "term" .= exprTermName, "sourceSpan" .= exprSourceSpan ]
None -> []
toJSON ErrorSummary{..} = object [ "error" .= error, "span" .= errorSpan ]
isErrorSummary :: JSONSummary -> Bool