@@ -38,10 +38,9 @@ Like client function generation, documentation generation amounts to inspecting
38This time however, we have to assist **servant**. While it is able to deduce a lot of things about our API, it can't magically come up with descriptions of the various pieces of our APIs that are human-friendly and explain what's going on "at the business-logic level". A good example to study for documentation generation is our webservice with the `/position`, `/hello` and `/marketing` endpoints from earlier:
38This time however, we have to assist **servant**. While it is able to deduce a lot of things about our API, it can't magically come up with descriptions of the various pieces of our APIs that are human-friendly and explain what's going on "at the business-logic level". A good example to study for documentation generation is our webservice with the `/position`, `/hello` and `/marketing` endpoints from earlier:
40``` haskell
40``` haskell
41−type ExampleAPI = ("position" :> Capture "x" Int :> Capture "y" Int :> Get '[JSON] Position
41+type ExampleAPI = "position" :> Capture "x" Int :> Capture "y" Int :> Get '[JSON] Position
42 :<|> "hello" :> QueryParam "name" String :> Get '[JSON] HelloMessage
42 :<|> "hello" :> QueryParam "name" String :> Get '[JSON] HelloMessage
43− :<|> "marketing" :> ReqBody '[JSON] ClientInfo :> Post '[JSON] Email)
43+ :<|> "marketing" :> ReqBody '[JSON] ClientInfo :> Post '[JSON] Email
46exampleAPI :: Proxy ExampleAPI
45exampleAPI :: Proxy ExampleAPI
47exampleAPI = Proxy
46exampleAPI = Proxy
@@ -221,7 +220,7 @@ api :: Proxy DocsAPI
221api = Proxy
220api = Proxy
223server :: Server DocsAPI
222server :: Server DocsAPI
224−server = (Server.server3 :<|> emptyServer) :<|> Tagged serveDocs where
223+server = Server.server3 :<|> Tagged serveDocs where
225 serveDocs _ respond =
224 serveDocs _ respond =
226 respond $ responseLBS ok200 [plain] docsBS
225 respond $ responseLBS ok200 [plain] docsBS
227 plain = ("Content-Type", "text/plain")
226 plain = ("Content-Type", "text/plain")