使用 responseContainer Swagger 注释属性标记非平面容器
Marking non-flat containers with responseContainer Swagger annotation attribute
与 swagger-annotations_2.9.1
我正在使用以下
@Path("/{triggerId}/conditions")
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Get a map with all conditions id an specific trigger.",
responseClass = "Collection<Map<String, String>>",
notes = "This is a helper for the UI to get all id of the conditions with specific type. It returns a
collection of {conditionId: \"value\", className: \"value\" }")
public void getTriggerConditions(@Suspended final AsyncResponse response, ...)
然而,在 2.10
中 responseClass
属性不再存在,我想应该使用 responseContainer
和 response
来代替。但是如何标记非平面容器(地图集列表等)
实际上,我不确定如何仅使用 responseContainer
和 response
来注释简单的 Map<Foo, Bar>
responseContainer = "Map",
response = Foo.class,
那么 Bar.class
呢?
2.9.1 和 2.10 不是 版本的 swagger-core 而是用于编译代码的 Scala 版本(因为旧版本的 swagger-core 是用斯卡拉)。
None 这些版本支持地图作为容器,因为当时 Swagger 规范根本不支持。
如果您确实希望将操作记录为返回地图,则必须升级到 1.5.X 版本。撰写此评论时的当前版本是 1.5.0-M2。
与 swagger-annotations_2.9.1
我正在使用以下
@Path("/{triggerId}/conditions")
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Get a map with all conditions id an specific trigger.",
responseClass = "Collection<Map<String, String>>",
notes = "This is a helper for the UI to get all id of the conditions with specific type. It returns a
collection of {conditionId: \"value\", className: \"value\" }")
public void getTriggerConditions(@Suspended final AsyncResponse response, ...)
然而,在 2.10
中 responseClass
属性不再存在,我想应该使用 responseContainer
和 response
来代替。但是如何标记非平面容器(地图集列表等)
实际上,我不确定如何仅使用 responseContainer
和 response
Map<Foo, Bar>
responseContainer = "Map",
response = Foo.class,
那么 Bar.class
呢?
2.9.1 和 2.10 不是 版本的 swagger-core 而是用于编译代码的 Scala 版本(因为旧版本的 swagger-core 是用斯卡拉)。
None 这些版本支持地图作为容器,因为当时 Swagger 规范根本不支持。
如果您确实希望将操作记录为返回地图,则必须升级到 1.5.X 版本。撰写此评论时的当前版本是 1.5.0-M2。