@@ -6,12 +6,11 @@ import Data.Array as Array
66import Data.Maybe (Maybe(..))
77import Effect (Effect)
88import Type.Function (type (#))
9−import Type.Proxy (Proxy(..))
10−import Yoga.HTTP.API.Path (Path, Lit, Capture, type (:), type (/), type (:?))
9+import Yoga.HTTP.API.Path (type (:), type (/), type (:?))
1110import Yoga.HTTP.API.Route (GET, POST, PUT, DELETE, Route, Request, buildOpenAPISpec)
1211import Yoga.HTTP.API.Route.Auth (BearerToken, ApiKeyHeader, BasicAuth)
1312import Yoga.HTTP.API.Route.Encoding (JSON, PlainText, XML)
14−import Yoga.HTTP.API.Route.OpenAPIMetadata (Description, Example, Examples, ExampleValue, ExampleWithSummary, Schema, Minimum, Maximum, Pattern, MinLength, MaxLength)
13+import Yoga.HTTP.API.Route.OpenAPIMetadata (Description, Example, ExampleValue, Examples, Schema)
1514import Yoga.JSON (writeJSON)
1615import Test.OpenAPIValidation (validate)
1716import ViTest (ViTest, describe, test)
@@ -55,31 +54,31 @@ type ComprehensiveAPI =
5554
5655 , -- Multiple content types - XML
5756 exportUser ::
58− Route GET ("users" / "id" : Int / Lit "export")
57+ Route GET ("users" / "id" : Int / "export")
5958 (Request {})
6059 (ok :: { body :: XML User })
6160
6261 , -- Plain text response
6362 healthCheck ::
64− Route GET (Path (Lit "health"))
63+ Route GET "health"
6564 (Request {})
6665 (ok :: { body :: PlainText String })
6766
6867 , -- API Key authentication
6968 getStats ::
70− Route GET (Path (Lit "stats"))
69+ Route GET "stats"
7170 (Request { headers :: { xApiKey :: ApiKeyHeader } })
7271 (ok :: { body :: Stats })
7372
7473 , -- Basic auth
7574 login ::
76− Route POST (Path (Lit "login"))
75+ Route POST "login"
7776 (Request { headers :: { authorization :: BasicAuth } })
7877 (ok :: { body :: { token :: String # Description "JWT access token" } })
7978
8079 , -- Path with examples
8180 getUserPosts ::
82− Route GET ("users" / "userId" : (Int # Examples (alice :: ExampleValue "1", bob :: ExampleValue "2")) / Lit "posts")
81+ Route GET ("users" / "userId" : (Int # Examples (alice :: ExampleValue "1", bob :: ExampleValue "2")) / "posts")
8382 (Request {})
8483 (ok :: { body :: Array Post })
8584 }