@@ -52,8 +52,10 @@ spec :: Spec
52spec = describe "Servant.Docs" $ do
52spec = describe "Servant.Docs" $ do
54 describe "markdown" $ do
54 describe "markdown" $ do
55− let md = markdown (docs (Proxy :: Proxy TestApi1))
55+ let md1 = markdown (docs (Proxy :: Proxy TestApi1))
56− tests md
56+ tests1 md1
57+ let md2 = markdown (docs (Proxy :: Proxy TestApi2))
58 describe "markdown with extra info" $ do
60 describe "markdown with extra info" $ do
@@ -65,7 +67,7 @@ spec = describe "Servant.Docs" $ do
65 (Proxy :: Proxy (ReqBody '[JSON] String :> Post '[JSON] Datatype1))
67 (Proxy :: Proxy (ReqBody '[JSON] String :> Post '[JSON] Datatype1))
66 (defAction & notes <>~ [DocNote "Post data" ["Posts some Json data"]])
68 (defAction & notes <>~ [DocNote "Post data" ["Posts some Json data"]])
67 md = markdown (docsWith defaultDocOptions [] extra (Proxy :: Proxy TestApi1))
69 md = markdown (docsWith defaultDocOptions [] extra (Proxy :: Proxy TestApi1))
68− tests md
70+ tests1 md
69 it "contains the extra info provided" $ do
71 it "contains the extra info provided" $ do
70 md `shouldContain` "Get an Integer"
72 md `shouldContain` "Get an Integer"
71 md `shouldContain` "Post data"
73 md `shouldContain` "Post data"
@@ -93,7 +95,7 @@ spec = describe "Servant.Docs" $ do
96− tests md = do
98+ tests1 md = do
97 it "mentions supported content-types" $ do
99 it "mentions supported content-types" $ do
98 md `shouldContain` "application/json"
100 md `shouldContain` "application/json"
99 md `shouldContain` "text/plain;charset=utf-8"
101 md `shouldContain` "text/plain;charset=utf-8"
@@ -116,6 +118,11 @@ spec = describe "Servant.Docs" $ do
116 it "does not generate any docs mentioning the 'empty-api' path" $
118 it "does not generate any docs mentioning the 'empty-api' path" $
117 md `shouldNotContain` "empty-api"
119 md `shouldNotContain` "empty-api"
122+ it "mentions the content-types from both copies of the route" $ do
123+ md `shouldContain` "application/json"
124+ md `shouldContain` "text/plain;charset=utf-8"
@@ -142,6 +149,10 @@ type TestApi1 = Get '[JSON, PlainText] (Headers '[Header "Location" String] Int)
142 :<|> Header "X-Test" Int :> Put '[JSON] Int
149 :<|> Header "X-Test" Int :> Put '[JSON] Int
143 :<|> "empty-api" :> EmptyAPI
150 :<|> "empty-api" :> EmptyAPI
152+type TestApi2 = "duplicate-endpoint" :> Get '[JSON] Datatype1
153+ :<|> "duplicate-endpoint" :> Get '[PlainText] Int
145data TT = TT1 | TT2 deriving (Show, Eq)
156data TT = TT1 | TT2 deriving (Show, Eq)
146data UT = UT1 | UT2 deriving (Show, Eq)
157data UT = UT1 | UT2 deriving (Show, Eq)