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