In my golang project, I have a structure that contains this field:
type hook struct {
Data interface{} `json:"data"`
}
How to represent this Data field in Open API Spec?
It is not a good idea to use the absolutely free form type in the specification, I think, but if you want to do so, use the {}
form of definition:
data: {}
Also you can add a null
value to the allowed:
data:
nullable: true
See the "Any Type" section of the types documentation: https://swagger.io/docs/specification/data-models/data-types/