@@ -862,7 +862,7 @@ instance HasDocs EmptyAPI where
862862-- | @"books" :> 'Capture' "isbn" Text@ will appear as
863863-- @/books/:isbn@ in the docs.
864864instance (KnownSymbol sym, ToCapture (Capture sym a), HasDocs api)
865− => HasDocs (Capture' mods sym a :> api) where
865+ => HasDocs (Capture' '[] sym a :> api) where
866866
867867 docsFor Proxy (endpoint, action) =
868868 docsFor subApiP (endpoint', action')
@@ -874,6 +874,28 @@ instance (KnownSymbol sym, ToCapture (Capture sym a), HasDocs api)
874874 endpoint' = over path (\p -> p ++ [":" ++ symbolVal symP]) endpoint
875875 symP = Proxy :: Proxy sym
876876
877+instance (KnownSymbol descr, KnownSymbol sym, HasDocs api)
878+ => HasDocs (Capture' (Description descr ': mods) sym a :> api) where
879+
880+ docsFor Proxy (endpoint, action) =
881+ docsFor subApiP (endpoint', action')
882+
883+ where subApiP = Proxy :: Proxy api
884+
885+ docCapture = DocCapture (symbolVal symP) (symbolVal descrP)
886+ action' = over captures (|> docCapture) action
887+ endpoint' = over path (\p -> p ++ [":" ++ symbolVal symP]) endpoint
888+ descrP = Proxy :: Proxy descr
889+ symP = Proxy :: Proxy sym
890+
891+instance {-# OVERLAPPABLE #-} HasDocs (Capture' mods sym a :> api)
892+ => HasDocs (Capture' (mod ': mods) sym a :> api) where
893+
894+ docsFor Proxy =
895+ docsFor apiP
896+
897+ where apiP = Proxy :: Proxy (Capture' mods sym a :> api)
898+
877899
878900-- | @"books" :> 'CaptureAll' "isbn" Text@ will appear as
879901-- @/books/:isbn@ in the docs.