Skip to content

Commit

Permalink
add more common error code
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmood committed Dec 9, 2023
1 parent 4b8e56e commit abb666d
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .got/snapshots/TestOpenAPI/openapi.got-snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ map[string]interface {}{
"Code": map[string]interface {}{
"description": "github.com/ysmood/goapi/lib/openapi.Code",
"enum": []interface {}{
"conflict",
"forbidden",
"internal_error",
"invalid_param",
"not_found",
"timeout",
"too_large",
"too_many_requests",
"unauthorized",
},
"title": "Code",
},
Expand Down
40 changes: 32 additions & 8 deletions lib/openapi/code_enumer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions lib/openapi/enum.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,20 @@ const (
CodeNotFound Code = iota
// CodeInvalidParam ...
CodeInvalidParam
// CodeForbidden ...
CodeForbidden
// CodeInternalError ...
CodeInternalError
// CodeUnauthorized ...
CodeUnauthorized
// CodeTimeout ...
CodeTimeout
// CodeTooManyRequests ...
CodeTooManyRequests
// CodeConflict ...
CodeConflict
// CodeTooLarge ...
CodeTooLarge
)

// Method for http request
Expand Down

0 comments on commit abb666d

Please sign in to comment.