rest
rest copied to clipboard
Run-time error on models containing map[string]interface{}
I encounter a runtime error whenever I try to document a model with a map[string]interface{} field:
In Main:
api.Get(apiV1PathPrefix+"/my-route"). HasRequestModel(rest.ModelOf[model.MyRouteRequest]()). HasResponseModel(http.StatusInternalServerError, rest.ModelOf[model.MyRouteRequest]()). HasResponseModel(http.StatusInternalServerError, rest.ModelOf[respond.Error]())
The model:
type MyRouteRequest struct { Id string json:"Id,omitempty" OtherField stringjson:"otherField,omitempty" Text stringjson:"text" binding:"required" Extra map[string]interface{}json:"-" // Field that results in runtime error }