bynk.http.path_param_not_stringy
Error A path parameter's type is not constructible from a string.
A path parameter is read from a segment of the URL, which is text, so its type must be one the router can build from a string: String, a refined String, or an opaque type over String. An Int, an enum or a record is refused here, though a query field may be one. Take the segment as a refined String that states its shape.
Example
on GET("/items/:id") (id: Int) -> Effect[HttpResult[String]] by v: Visitor { … } // ✗ a path segment is a string
type ItemId = String where Matches("^[0-9]+$")on GET("/items/:id") (id: ItemId) -> Effect[HttpResult[String]] by v: Visitor { … } // ✓In the Book
See also
- The grammar rule it governs:
http_handler. - Every code in its category, HTTP, on the diagnostic index.
bynk explain bynk.http.path_param_not_stringyshows the same from the installed toolchain, without a network.