1
public Item addProperties(
        @Parameter(description = "identifier of the item")
        @PathVariable("id") String id,
        @Parameter(description = "map of property names and values ", 
                content = @Content(schema = @Schema(type = "object", implementation = Map.class)))
        @RequestBody Map<String, Object> properties) 

对于上面的代码,只有 Parameterid正在生成并且它完全缺少 requestBody。我根据https://swagger.io/docs/specification/data-models/dictionaries/添加了 type="object" 。

4

1 回答 1

3

RequestBody 类型必须是一个类。所以任何 Map 的实现都可以工作(即 HashMap)

@RequestBody HashMap<String, Object> properties
于 2020-02-12T11:38:54.403 回答