I have the following code in my main.go
app.Post("/user", util.ValidateJson[model.User], func(c *fiber.Ctx) error {
user := new(model.User)
_ = c.BodyParser(&user)
return c.Status(fiber.StatusCreated).JSON(model.Response{
Data: model.ToMap(*user)})
})
and a response struct
type Response struct {
Data fiber.Map `json:"data"`
Errors []*ErrorList `json:"errors"`
}
The issue I have is with the response returning the empty error list, which I want to avoid.
{
"data": {
"age": 1,
"name": "ben"
},
"errors": null
}