Add top-level api annotations

This commit is contained in:
Correl Roush 2022-03-23 20:44:58 -04:00
parent 89e3322670
commit 7f8a853d3c
3 changed files with 15 additions and 2 deletions

View file

@ -21,6 +21,7 @@ description: Please see the README on GitHub at <https://github.com/gith
dependencies:
- base >= 4.7 && < 5
- aeson
- lens
- openapi3
- servant-openapi3
- servant-server

View file

@ -10,6 +10,7 @@ module Lib
)
where
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
import Data.Maybe
@ -67,8 +68,10 @@ instance ToJSON Card
instance ToSchema Card
type SearchCards = "search" :> Get '[JSON] [Card]
type TutorAPI =
"search" :> Get '[JSON] [Card]
SearchCards
type DocsAPI =
"api" :> "openapi.json" :> Get '[JSON] OpenApi
@ -91,7 +94,13 @@ api :: Proxy API
api = Proxy
openapi :: OpenApi
openapi = toOpenApi tutorAPI
openapi =
toOpenApi tutorAPI
& info . title .~ "Tutor API"
& info . version .~ "1.0"
& info . description ?~ "An API for searching a Magic: The Gathering card collection."
& info . license ?~ ("MIT" & url ?~ URL "http://mit.com")
& applyTagsFor (subOperations (Proxy :: Proxy SearchCards) tutorAPI) ["Search" & description ?~ "Searching Cards"]
tutorServer :: Server TutorAPI
tutorServer = return cards

View file

@ -31,6 +31,7 @@ library
build-depends:
aeson
, base >=4.7 && <5
, lens
, openapi3
, servant-openapi3
, servant-server
@ -51,6 +52,7 @@ executable tutor-exe
build-depends:
aeson
, base
, lens
, openapi3
, servant-openapi3
, servant-server
@ -76,6 +78,7 @@ test-suite tutor-test
, hspec
, hspec-wai
, hspec-wai-json
, lens
, openapi3
, servant-openapi3
, servant-server