I'm using Scalatra and Swagger to create my REST API. When it comes to GET requests, it is easy to clearly define the parameters (required/optional and enumerate the possible values). However, when you are using a POST request, the only parameter that you can declare is the bodyParam[YourCaseObject]("body").
Say you are passing a user object in the request body:
{ "userid" : "1", "username": "john" } which is extracted by
case class User(val userid : String, val username, val optional1 : String = "", val optional2 : Int = -1)
My question is how can you state which fields are optional/required, enumerate their values (e.g. optional1 can be ["a","b","c"]), and provide an appropriate user response when one of the required fields is missing. I've tried using the @ApiProperty annotation, but its result is not shown in the Swagger Web UI.