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.
commit6f106628873fc6a6f83580a4937e7c5ed79d9c7a authorDaniel Larsson <daniel.j.larsson@gmail.com> dateThu 1 Jan 2015, 23:42 (12 years ago) parent87b7c8e
2 files changed+54
.gitignore+17 src/Servant/Docs.hs+37
.gitignorenew file+17
@@ -0,0 +1,17 @@
1+dist
2+cabal-dev
3+*.o
4+*.hi
5+*.chi
6+*.chs.h
7+*.dyn_o
8+*.dyn_hi
9+.virtualenv
10+.hpc
11+.hsenv
12+.cabal-sandbox/
13+cabal.sandbox.config
14+cabal.config
15+*.prof
16+*.aux
17+*.hp
src/Servant/Docs.hs+37
@@ -556,6 +556,43 @@ instance (KnownSymbol sym, ToParam (QueryFlag sym), HasDocs sublayout)
556556 paramP = Proxy :: Proxy (QueryFlag sym)
557557 action' = over params (|> toParam paramP) action
558558
559+
560+instance (KnownSymbol sym, {- ToParam (MatrixParam sym a), -} HasDocs sublayout)
561+ => HasDocs (MatrixParam sym a :> sublayout) where
562+
563+ docsFor Proxy (endpoint, action) =
564+ docsFor sublayoutP (endpoint', action)
565+
566+ where sublayoutP = Proxy :: Proxy sublayout
567+
568+ endpoint' = over path (\p -> p++";"++symbolVal symP) endpoint
569+ symP = Proxy :: Proxy sym
570+
571+
572+instance (KnownSymbol sym, {- ToParam (MatrixParams sym a), -} HasDocs sublayout)
573+ => HasDocs (MatrixParams sym a :> sublayout) where
574+
575+ docsFor Proxy (endpoint, action) =
576+ docsFor sublayoutP (endpoint', action)
577+
578+ where sublayoutP = Proxy :: Proxy sublayout
579+
580+ endpoint' = over path (\p -> p++";"++symbolVal symP) endpoint
581+ symP = Proxy :: Proxy sym
582+
583+
584+instance (KnownSymbol sym, {- ToParam (MatrixFlag sym), -} HasDocs sublayout)
585+ => HasDocs (MatrixFlag sym :> sublayout) where
586+
587+ docsFor Proxy (endpoint, action) =
588+ docsFor sublayoutP (endpoint', action)
589+
590+ where sublayoutP = Proxy :: Proxy sublayout
591+
592+ endpoint' = over path (\p -> p++";"++symbolVal symP) endpoint
593+ symP = Proxy :: Proxy sym
594+
595+
559596instance HasDocs Raw where
560597 docsFor _proxy (endpoint, action) =
561598 single endpoint action