【问题标题】:Setting Additional Properties using swagger annotations使用 swagger 注释设置附加属性
【发布时间】:2015-08-19 04:35:04
【问题描述】:

我正在尝试映射下面的属性字段,

@(ApiModelProperty @field)(dataType = "map") attributes: Map[String,String]

{
 "type": "object",
 "additionalProperties": {
   "type": "string"
 }
}

所以在我自动生成的 java 客户端代码中,我将拥有 Map<String,String>

Swagger 的任何版本的 java/scala API 都可以吗?

【问题讨论】:

  • 你使用的是什么版本的 swagger-core?
  • 我正在使用 swagger-core v1.5
  • 关于这个问题的任何更新?

标签: swagger


【解决方案1】:

我可以使用dataType = "Map[String,Foo]"(逗号后没有空格)来做到这一点。所以你可能是这样的:

@(ApiModelProperty @field)(dataType = "Map[String,String]") 
attributes: Map[String,String]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-07-20
    • 1970-01-01
    • 1970-01-01
    • 2020-04-04
    • 2017-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多