I'm using swagger-akka-http to built Swagger docs for my Akka HTTP service.
My service has a POST method accepting a List
of Characteristic
.
@ApiOperation(value = "Fetch offerings by characteristics", httpMethod = "POST")
@ApiImplicitParams(Array(
new ApiImplicitParam(name = "characteristics", required = true,
dataTypeClass = classOf[List[Characteristic]], paramType = "body")
))
@ApiResponses(Array(
new ApiResponse(code = 200, response = classOf[Offering], responseContainer = "List")
))
def fetchOfferings: Route = post {
entity(as[List[Characteristic]]) { characteristics =>
// some logic
}
}
dataTypeClass = classOf[List[Characteristic]]
in ApiImplicitParams
is not working as expected. There is the following result in the generated Swagger YAML:
parameters:
- in: "body"
name: "body"
description: "Characteristics"
required: true
schema:
type: "array"
items:
type: "object"
How can I doccument a collection of objects in the request body?