4

I have a problem generating a swagger.json file with swagger annotations. The problem is with the generation of map with array.

Ex:

I have an @ApiModel with a field:

@JsonProperty
private Map<String, String[]> example;

When it generates it looks like this:

"example" : {
               "type" : "object",
                "additionalProperties" : {
                "$ref" : "#/definitions/Array"
             }
            }

"Array" : {
            "type" : "object"
        },

When I create my client class with swagger-codegen based on the generated json, it resolve to:

private Map<String, Array> example = new HashMap<String, Array>();

But Array doesn`t exist.

Based on what I`ve seen, the json should look like this:

  "definitions": {
    "example": {
      "type": "object",
      "additionalProperties": {
        "type": "array",
        "items": {
          "type": "string"
        }
      }
    }
  }
}

Is there anyway to make it works ?

I use: Dropwizard, Jersey2, Swagger, JAX-RS

Mike
  • 2,354
  • 3
  • 23
  • 37

0 Answers0