modulepackage
0.2.0-beta.9
Repository: https://github.com/goccha/problems.git
Documentation: pkg.go.dev
# README
Problems
Problem Details for HTTP APIs RFC7807
RFC9457 HTTP JSON Problem Details
Simple Usage
problem := problems.New(problems.Instance("/users")).NotFound("user not found")
Bad Request (RFC7807)
if err := validate.Struct(s); err != nil {
problems.New(problems.Path(req), problems.InvalidParams(err)).BadRequest("Invalid Parameters").JSON(ctx, req.Writer)
return
}
Bad Request (RFC9457)
if err := validate.Struct(s); err != nil {
problems.New(problems.Path(req), problems.ValidationErrors(err)).BadRequest("Invalid Parameters").JSON(ctx, req.Writer)
return
}
Conversion to error
err := problems.New().Unauthorized("password mismatch").Wrap()
problems.Of(context.TODO, "/login", err).JSON(ctx, req.Writer)
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
InvalidParams Create RFC7807-style validation error messages.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ValidationErrors Create RFC9457-style validation error messages.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Constants
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Interfaces
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author