Skip to content

Commit

Permalink
Merge pull request #87 from vortex14/swagger
Browse files Browse the repository at this point in the history
added err text for gin validation
  • Loading branch information
vortex14 authored Sep 5, 2023
2 parents 8b855e7 + 657338f commit 33d6a50
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions extensions/servers/gin/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ func (s *TyphoonGinServer) onRequestHandler(ginCtx *Gin.Context) {
paramsQuery := action.GetParams()
if paramsQuery != nil {
if err := ginCtx.BindQuery(paramsQuery); err != nil {
ginCtx.JSON(422, forms.ErrorResponse{Error: "unavailable query string"})
ginCtx.JSON(422, forms.ErrorResponse{Error: err.Error()})
return
}
}

if action.IsValidRequestBody() {
if err := ginCtx.ShouldBindJSON(action.GetRequestModel()); err != nil {
s.LOG.Error(Errors.ActionErrRequestModel.Error())
ginCtx.JSON(422, forms.ErrorResponse{Error: "unprocessable entity"})
ginCtx.JSON(422, forms.ErrorResponse{Error: err.Error()})
return
}
}
Expand Down

0 comments on commit 33d6a50

Please sign in to comment.