I am new to Golang and APIs.
We have service file which contains
getBookHistory(context Context, book string)([]*model.lookuprecord, error){
//some code
}
in my rest.go (handler)
// GetBookHistoryLookup godoc
// @Summary Shows historic detailed Info.
// @Description get history details from the table in the database.
// @Param book path string true "book"
// @Produce json
// @Success 200 {object} iModel.LookupRecord
// @Router /history/{book} [get]
func(h handler) GetBookHistoryLookup(c echo.Context){
//some code
}
I am using github.com/swaggo/swag/cmd/swag lib.
It produces a swaggerUI but the response is null for this get service. I can see the return type is array and need to change to the line
// @Success 200 {object} iModel.LookupRecord
Thanks
// @Success 200 {object} iModel.LookupRecord
to be replaced with
// @Success 200 {object} []iModel.LookupRecord