mirror of
https://github.com/github/semantic.git
synced 2025-01-07 07:58:12 +03:00
Output term, category, sourceSpan
This commit is contained in:
parent
e58799c42d
commit
b3bbff3f45
@ -59,7 +59,10 @@ data JSONSummary = JSONSummary { info :: ParentInfo, changeType :: Text }
|
|||||||
|
|
||||||
instance ToJSON JSONSummary where
|
instance ToJSON JSONSummary where
|
||||||
-- TODO fix JSON instance
|
-- 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 ]
|
toJSON ErrorSummary{..} = object [ "error" .= error, "span" .= errorSpan ]
|
||||||
|
|
||||||
isErrorSummary :: JSONSummary -> Bool
|
isErrorSummary :: JSONSummary -> Bool
|
||||||
|
Loading…
Reference in New Issue
Block a user