Swagger: set type definition of @ApiModelProperty#datatype for java.util.Map

Viewed 634

I'm generating my swagger spec using springfox.

I have this Object property, I want to represent this with the type of Map<String, String> when I use openapi-generator.

@ApiModelProperty(
  dataType = "java.util.Map"
)
private Object dummy;

When the spec is generated, the output is:

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

with the spec above, the generated property will be Map<String, Object>.

What I want to achieve is to have an output like this:

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

Is this possible? I'm trying to look on how to set the type of Map#value but I can't seem to find one.

Thanks!

0 Answers
Related