If I have a tapir endpoint, that wants case class User(name: Option[String])
as input, is there a way to add validation logic to it, that would reject input like {"userName": "foo"}
rather than just ignoring “userName” silently and handing me User(None)
as input?
This can probably be done with a custom circe codec (which I’d use if I have no other option), but I don’t know how to do that either …
Ideally, I’d also like to validate query parameters this way too: if I have
in(query[Option[String]]("name")
, and the query is ?userName=foo
, I’d want it to fail rather than just giving me name=None
Any pointers are appreciated!