@@ -66,8 +66,10 @@ spec = describe "Servant.Docs" $ do
66 golden "comprehensive API" "golden/comprehensive.md" (markdown comprehensiveDocs)
66 golden "comprehensive API" "golden/comprehensive.md" (markdown comprehensiveDocs)
68 describe "markdown" $ do
68 describe "markdown" $ do
69− let md = markdown (docs (Proxy :: Proxy TestApi1))
69+ let md1 = markdown (docs (Proxy :: Proxy TestApi1))
70− tests md
70+ tests1 md1
71+ let md2 = markdown (docs (Proxy :: Proxy TestApi2))
72 describe "markdown with extra info" $ do
74 describe "markdown with extra info" $ do
@@ -79,7 +81,7 @@ spec = describe "Servant.Docs" $ do
79 (Proxy :: Proxy (ReqBody '[JSON] String :> Post '[JSON] Datatype1))
81 (Proxy :: Proxy (ReqBody '[JSON] String :> Post '[JSON] Datatype1))
80 (defAction & notes <>~ [DocNote "Post data" ["Posts some Json data"]])
82 (defAction & notes <>~ [DocNote "Post data" ["Posts some Json data"]])
81 md = markdown (docsWith defaultDocOptions [] extra (Proxy :: Proxy TestApi1))
83 md = markdown (docsWith defaultDocOptions [] extra (Proxy :: Proxy TestApi1))
82− tests md
84+ tests1 md
83 it "contains the extra info provided" $ do
85 it "contains the extra info provided" $ do
84 md `shouldContain` "Get an Integer"
86 md `shouldContain` "Get an Integer"
85 md `shouldContain` "Post data"
87 md `shouldContain` "Post data"
@@ -107,7 +109,7 @@ spec = describe "Servant.Docs" $ do
110− tests md = do
112+ tests1 md = do
111 it "mentions supported content-types" $ do
113 it "mentions supported content-types" $ do
112 md `shouldContain` "application/json"
114 md `shouldContain` "application/json"
113 md `shouldContain` "text/plain;charset=utf-8"
115 md `shouldContain` "text/plain;charset=utf-8"
@@ -130,6 +132,11 @@ spec = describe "Servant.Docs" $ do
130 it "does not generate any docs mentioning the 'empty-api' path" $
132 it "does not generate any docs mentioning the 'empty-api' path" $
131 md `shouldNotContain` "empty-api"
133 md `shouldNotContain` "empty-api"
136+ it "mentions the content-types from both copies of the route" $ do
137+ md `shouldContain` "application/json"
138+ md `shouldContain` "text/plain;charset=utf-8"
@@ -156,6 +163,10 @@ type TestApi1 = Get '[JSON, PlainText] (Headers '[Header "Location" String] Int)
156 :<|> Header "X-Test" Int :> Put '[JSON] Int
163 :<|> Header "X-Test" Int :> Put '[JSON] Int
157 :<|> "empty-api" :> EmptyAPI
164 :<|> "empty-api" :> EmptyAPI
166+type TestApi2 = "duplicate-endpoint" :> Get '[JSON] Datatype1
167+ :<|> "duplicate-endpoint" :> Get '[PlainText] Int
159data TT = TT1 | TT2 deriving (Show, Eq)
170data TT = TT1 | TT2 deriving (Show, Eq)
160data UT = UT1 | UT2 deriving (Show, Eq)
171data UT = UT1 | UT2 deriving (Show, Eq)