Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindAndValidate ¶
BindAndValidate parses the request body and validates it using go-playground/validator. Returns a pointer to the struct (populated), or writes an error response and returns nil.
func ProblemDetailsJSON ¶
ProblemDetailsJSON writes a problem+json error response with a status code inferred from the error (if present). The title is set to the error message (if error), and detail can be a string, error, or structured object. Optionally, a status code can be provided as the last argument (int) to override the fallback status.
Types ¶
type ProblemDetails ¶
type ProblemDetails struct {
Type string `json:"type,omitempty"` // A URI reference that identifies the problem type
Title string `json:"title"` // Short, human-readable summary
Status int `json:"status"` // HTTP status code
Detail string `json:"detail,omitempty"` // Human-readable explanation
Instance string `json:"instance,omitempty"` // URI reference
Errors any `json:"errors,omitempty"` // Optional: additional error details
}
ProblemDetails follows RFC 9457 Problem Details for HTTP APIs.
Click to show internal directories.
Click to hide internal directories.