使用 Swagger 1.5 使用 Map 属性配置 Pojo 不会生成 "additionalProperties"

Configure Pojo with Map attribute doesnt' generate "additionalProperties" using Swagger 1.5

我已经使用 Spring Boot 和 Apache Camel 实现了一些端点,我正在尝试使用 camel-swagger-java 记录它们并稍后使用 swagger-codegen 生成客户端库。问题是我的模型的一个属性是一个 HashMap,我正在尝试以一种 swagger 可以生成 additionalProperty 的方式配置 pojo,但到目前为止还没有运气。

    @JsonInclude(Include.NON_NULL)
    public class TaskDataResultResponse {

        private String testing;

        @JsonInclude(Include.NON_NULL)
        @ApiModelProperty(dataType = "Map[String,String]")
        private Map<String, String> properties;

        @JsonAnyGetter
        public Map<String, String> getProperties() {
            return properties;
        }

        @JsonInclude(Include.NON_NULL)
        @JsonAnySetter
        public void setProperties(String name, String value) {
            properties.put(name, value);
        }

        public String getTesting() {
            return testing;
        }

        public void setTesting(String testing) {
            this.testing = testing;
        }
    }

我尝试了一切:添加 JsonAnySetter 和 Getter 注释,添加 ApiModelProperty swagger 注释,甚至从 HashMap 扩展 class 而不是 HashMap 属性,但似乎没有任何效果:

我在 swagger-core github 回购、堆栈溢出和网络搜索方面读了很多,但到目前为止什么都没有。我知道很多关于如何通过添加这个额外的 属性 配置 swagger 模式文件的东西,但我的目标是从 pojo 自动生成它。

我使用的是最新的 Spring Boot(2.4.3,但我也使用以前的版本进行了测试)和 camel-swagger-java 3.7.3(但也进行了测试2.25.2)

经过大量调查后,我在我的代码中发现了问题:我混淆了注释。删除 ApiModelPropertyJsonAnyGettersetter 注释后,架构文件终于正确生成。

此外,关于这个问题,我找到了一种方法来实现相同的逻辑,但使用哈希图列表,因为我还需要在列表中元素的 swagger 架构。

最后我生成了一个客户端(使用 swagger codegen)并且信息被正确解组,用于 formdatadatagridData 属性.