@@ -326,14 +326,23 @@ instance ToJSON Data where
326326 , "lenses" .= ls
327327 ]
328328
329−data API = API Name (Map Name [Rendered])
329+data Action = Action Name Rendered
330330
331−instance ToJSON API where
332− toJSON (API n ms) = object
333− [ "name" .= Syn n
334− , "methods" .= ms
331+instance ToJSON Action where
332+ toJSON (Action n d) = object
333+ [ "name" .= Syn n
334+ , "decl" .= d
335335 ]
336336
337+data API = API Name Rendered [Action]
338+
339+instance ToJSON API where
340+ toJSON (API n d as) = object
341+ [ "name" .= Syn n
342+ , "decl" .= d
343+ , "actions" .= as
344+ ]
345+
337346data Method = Method
338347 { _mId :: Text
339348 , _mPath :: Text
@@ -364,20 +373,20 @@ instance FromJSON Method where
364373deriveToJSON (js "_m") ''Method
365374
366375data Resource
367− = Parent (Map Local Resource)
368− | Sub (Map Local Method)
376+ = Top (Map Local Resource)
377+ | Sub (Map Local Method)
369378
370379instance FromJSON Resource where
371380 parseJSON = withObject "resource" $ \o ->
372− Parent <$> o .: "resources"
373− <|> Sub <$> o .: "methods"
381+ Top <$> o .: "resources"
382+ <|> Sub <$> o .: "methods"
374383
375384data Service s r = Service
376385 { _svcLibrary :: Text
377386 , _svcTitle :: Text
378387 , _svcName :: Text
379388 , _svcCanonicalName :: Maybe Text
380− , _svcDescription :: Text
389+ , _svcDescription :: Help
381390 , _svcRevision :: Maybe Text
382391 , _svcVersion :: Text
383392 , _svcOwnerName :: Text
@@ -392,7 +401,7 @@ data Service s r = Service
392401 , _svcAuth :: Maybe Object
393402 , _svcParameters :: Map Local Param
394403 , _svcSchemas :: Map Id s
395− , _svcResources :: r
404+ , _svcApi :: r
396405 } deriving (Generic)
397406
398407instance FromJSON s => FromJSON (Service s Resource) where
@@ -424,7 +433,6 @@ instance ToJSON (Service Data API) where
424433 Object x = genericToJSON (js "_svc") s
425434 Object y = object
426435 [ "exposedModules" .= exposedModules s
427− , "api" .= svcAbbrev s
428436 ]
429437
430438svcAbbrev :: Service s r -> Text
@@ -458,13 +466,14 @@ data Library = Library
458466
459467instance ToJSON Library where
460468 toJSON Library{..} = object
461− [ "libraryName" .= _libName
462− , "libraryTitle" .= _libTitle
463− , "libraryVersion" .= _libraryVersion _libVersions
464− , "coreVersion" .= _coreVersion _libVersions
465− , "clientVersion" .= _clientVersion _libVersions
466− , "exposedModules" .= concatMap exposedModules (NE.toList _libServices)
467− , "otherModules" .= concatMap otherModules (NE.toList _libServices)
469+ [ "libraryName" .= _libName
470+ , "libraryTitle" .= _libTitle
471+ , "libraryVersion" .= _libraryVersion _libVersions
472+ , "libraryDescriptions" .= map (Desc 4 . _svcDescription) (NE.toList _libServices)
473+ , "coreVersion" .= _coreVersion _libVersions
474+ , "clientVersion" .= _clientVersion _libVersions
475+ , "exposedModules" .= concatMap exposedModules (NE.toList _libServices)
476+ , "otherModules" .= concatMap otherModules (NE.toList _libServices)
468477 ]
469478
470479merge :: Versions -> [Service Data API] -> [Library]