swagger-core
swagger-core copied to clipboard
No documentation for how to get AdditionalProperties to show up with @Schema
So, Im trying to generate swagger for a Map.
the Scala Map class has a property on it for Empty, which is showing up by default, so Im trying to find a way to annotate the field to ignore that.
@Schema(`type` = "object", implementation = classOf[Map[String, Any]])
Generates:
"attributes": {
"required": [
"empty"
],
"type": "object",
"properties": {
"empty": {
"type": "boolean"
},
"traversableAgain": {
"type": "boolean"
}
},
"additionalProperties": {
"type": "object"
}
},
I can use:
@Schema(`type` = "object", implementation = classOf[Object])
which generates:
"attributes": {
"type": "object"
},
However, there doesnt seem to be a way to set additionalProperties = true on the just the object?
Have anyone found the way? (We are having the same problem.)
However, there doesnt seem to be a way to set additionalProperties = true on the just the object?
FYI, additionalProperties: true
is the default value for objects. That is,
type: object
is equivalent to
type: object
additionalProperties: true
@hkosova Although it's equivalent, some generators need additionalProperties
to generate nicely typed models. I thought @Schema(additionalProperties = Schema.AdditionalPropertiesValue.TRUE)
would generated additionalProperties: true
but that doesn't seem to be the case. Is there a workaround here?