我有以下案例类
@ApiModel("StationResponse") case class StationResponse (id: Option[String],
@ApiModelProperty(dataType = "double", required = false)
longitude: Option[Double])
经度字段被建模为“Object”而不是“double”
我尝试用@ApiModelProperty 覆盖数据类型,但没有成功。感谢您的评论。
我正在使用 Swagger 1.3.12 和 Scala 2.11.6
最佳答案
我通过添加 @field 注释和 ApiModelProperty 解决了这个问题,如下所示:
@ApiModel("StationResponse")
case class StationResponse (id: Option[String],
@(ApiModelProperty@field)(dataType = "double", required = false)
longitude: Option[Double])
关于scala - Swagger 将 Option[Int] 建模为 Object,而 Option[String] 被正确建模为字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31949108/