diff --git a/httperror/http_error.go b/httperror/http_error.go index 228ae17..8a0fd5f 100644 --- a/httperror/http_error.go +++ b/httperror/http_error.go @@ -8,12 +8,14 @@ import ( "github.com/labstack/echo/v4" ) +// swagger:model JSONError type JSONError struct { Code string `json:"code"` Message string `json:"message"` Details *Details `json:"details,omitempty"` } +// swagger:model JSONErrorDetails type Details struct { Params *validator.InvalidParams `json:"invalidParams,omitempty"` } diff --git a/validator/validator.go b/validator/validator.go index eaec5db..0b4f4c5 100644 --- a/validator/validator.go +++ b/validator/validator.go @@ -17,6 +17,7 @@ var tagsMessage = map[string]string{ "numeric": "must be a valid numeric value", } +// swagger:model InvalidParamError type InvalidParamError struct { Param string `json:"param"` Value any `json:"value"` @@ -24,6 +25,7 @@ type InvalidParamError struct { Message string `json:"message"` } +// swagger:model InvalidParams type InvalidParams []InvalidParamError type Validator struct {