This commit is contained in:
Timothy Emiola 2022-11-08 13:25:08 +09:00 committed by GitHub
commit 218530ff68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 4 deletions

View File

@ -1067,6 +1067,17 @@ instance HasDocs Raw where
docsFor _proxy (endpoint, action) _ =
single endpoint action
instance (KnownSymbol summ, KnownSymbol desc, HasDocs api)
=> HasDocs (Summary summ :> Description desc :> api) where
docsFor Proxy (endpoint, action) =
docsFor subApiP (endpoint, action')
where subApiP = Proxy :: Proxy api
action' = over notes (|> note) action
note = DocNote title body
title = symbolVal (Proxy :: Proxy summ)
body = lines $ symbolVal (Proxy :: Proxy desc)
instance (KnownSymbol desc, HasDocs api)
=> HasDocs (Description desc :> api) where
@ -1076,17 +1087,20 @@ instance (KnownSymbol desc, HasDocs api)
where subApiP = Proxy :: Proxy api
action' = over notes (|> note) action
note = DocNote (symbolVal (Proxy :: Proxy desc)) []
description = symbolVal (Proxy :: Proxy desc)
note = mkNote $ lines $ description
mkNote (x:xs) = DocNote x xs
mkNote [] = DocNote description []
instance (KnownSymbol desc, HasDocs api)
=> HasDocs (Summary desc :> api) where
instance (KnownSymbol summ, HasDocs api)
=> HasDocs (Summary summ :> api) where
docsFor Proxy (endpoint, action) =
docsFor subApiP (endpoint, action')
where subApiP = Proxy :: Proxy api
action' = over notes (|> note) action
note = DocNote (symbolVal (Proxy :: Proxy desc)) []
note = DocNote (symbolVal (Proxy :: Proxy summ)) []
-- TODO: We use 'AllMimeRender' here because we need to be able to show the
-- example data. However, there's no reason to believe that the instances of