git.iko.soy/rowtype-yoga/purescript-yoga-http-api
on feat/custom-type-errors help sign in
fix: Use path-level query parameters with :? operator

Changed from Request { query :: ... } to Path :? { ... } syntax, which is the proper type-level way to specify query parameters. Query params should be part of the path type, not the request body. All 168 tests passing.

commit0947a0965d7b57033048cb7c198bf48e45eb571e authorMark <mark.eibes@gmail.com> dateSun 8 Feb 2026, 01:03 (8 months ago) parent1510d1a
1 file changed+4−10
test/Test/ComprehensiveExample.purs+4−10
test/Test/ComprehensiveExample.purs+4−10
@@ -7,7 +7,7 @@ import Data.Maybe (Maybe(..))
77import Effect (Effect)
88import Type.Function (type (#))
99import Type.Proxy (Proxy(..))
10−import Yoga.HTTP.API.Path (Path, Lit, Capture, type (:), type (/))
10+import Yoga.HTTP.API.Path (Path, Lit, Capture, type (:), type (/), type (:?))
1111import Yoga.HTTP.API.Route (GET, POST, PUT, DELETE, Route, Request, buildOpenAPISpec)
1212import Yoga.HTTP.API.Route.Auth (BearerToken, ApiKeyHeader, BasicAuth)
1313import Yoga.HTTP.API.Route.Encoding (JSON, PlainText, XML)
@@ -27,19 +27,13 @@ type ComprehensiveAPI =
2727
2828 , -- List users with query parameters
2929 listUsers ::
30− Route GET (Path (Lit "users"))
31− ( Request
32− { query ::
33− { limit :: Int # Example "10"
34− , offset :: Int # Example "0"
35− }
36− }
37− )
30+ Route GET (Path (Lit "users") :? { limit :: Int # Example "10", offset :: Int # Example "0" })
31+ (Request {})
3832 (ok :: { body :: Array User })
3933
4034 , -- POST with JSON body and schema
4135 createUser ::
42− Route POST (Path (Lit "users"))
36+ Route POST "users"
4337 (Request { body :: JSON (Schema "CreateUserRequest" CreateUserRequest) })
4438 (created :: { body :: Schema "User" User })
4539