Open morremeyer opened 2 months ago
For fields that need to be set in the API, e.g. the Month field in URIMonth and QueryMonth, thebinding:"required" tag should be set.
Month
URIMonth
QueryMonth
binding:"required"
Errors on binding should be handled with e.g. a middleware, see https://github.com/gin-gonic/gin/issues/430#issuecomment-141774133 for inspiration.
With this, the parseMonthQuery could probably be removed, too.
parseMonthQuery
There should be only one struct for API responses with the fields data, error and links ideally, so that all responses can be handled in the same way.
data
error
links
For fields that need to be set in the API, e.g. the
Month
field inURIMonth
andQueryMonth
, thebinding:"required"
tag should be set.Errors on binding should be handled with e.g. a middleware, see https://github.com/gin-gonic/gin/issues/430#issuecomment-141774133 for inspiration.
With this, the
parseMonthQuery
could probably be removed, too.There should be only one struct for API responses with the fields
data
,error
andlinks
ideally, so that all responses can be handled in the same way.