on master help sign in
Initial support for matrix parameters. Not complete, not sure how to document them yet, since documentation is focused on endpoints, not individual path fragments.
62f8a7fDaniel Larsson
src/Servant/Docs.hs+37
@@ -583,6 +583,43 @@ instance (KnownSymbol sym, ToParam (QueryFlag sym), HasDocs sublayout)
583 paramP = Proxy :: Proxy (QueryFlag sym)
583 paramP = Proxy :: Proxy (QueryFlag sym)
584 action' = over params (|> toParam paramP) action
584 action' = over params (|> toParam paramP) action
585
585
586+
587+instance (KnownSymbol sym, {- ToParam (MatrixParam sym a), -} HasDocs sublayout)
588+ => HasDocs (MatrixParam sym a :> sublayout) where
589+
590+ docsFor Proxy (endpoint, action) =
591+ docsFor sublayoutP (endpoint', action)
592+
593+ where sublayoutP = Proxy :: Proxy sublayout
594+
595+ endpoint' = over path (\p -> p++";"++symbolVal symP) endpoint
596+ symP = Proxy :: Proxy sym
597+
598+
599+instance (KnownSymbol sym, {- ToParam (MatrixParams sym a), -} HasDocs sublayout)
600+ => HasDocs (MatrixParams sym a :> sublayout) where
601+
602+ docsFor Proxy (endpoint, action) =
603+ docsFor sublayoutP (endpoint', action)
604+
605+ where sublayoutP = Proxy :: Proxy sublayout
606+
607+ endpoint' = over path (\p -> p++";"++symbolVal symP) endpoint
608+ symP = Proxy :: Proxy sym
609+
610+
611+instance (KnownSymbol sym, {- ToParam (MatrixFlag sym), -} HasDocs sublayout)
612+ => HasDocs (MatrixFlag sym :> sublayout) where
613+
614+ docsFor Proxy (endpoint, action) =
615+ docsFor sublayoutP (endpoint', action)
616+
617+ where sublayoutP = Proxy :: Proxy sublayout
618+
619+ endpoint' = over path (\p -> p++";"++symbolVal symP) endpoint
620+ symP = Proxy :: Proxy sym
621+
622+
586instance HasDocs Raw where
623instance HasDocs Raw where
587 docsFor _proxy (endpoint, action) =
624 docsFor _proxy (endpoint, action) =
588 single endpoint action
625 single endpoint action