inputvalidation

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2025 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPValidationError

func HTTPValidationError(w http.ResponseWriter, errors validator.ValidationErrors)

HTTPValidationError is a function that writes a slice of validation errors to the response writer in a JSON format.

func JSONTagNameFunc

func JSONTagNameFunc(fld reflect.StructField) string

JSONTagNameFunc is a function that returns the JSON tag name for a field to be used with validate.RegisterTagNameFunc for validators created with the go-playground/validator package.

Types

type FormattedValidationError

type FormattedValidationError struct {
	Message string            `json:"message"`
	Errors  []ValidationError `json:"errors"`
}

FormattedValidationError is a struct that represents a formatted validation error that can be returned in responses to clients.

func FormatValidationErrors

func FormatValidationErrors(errors validator.ValidationErrors) *FormattedValidationError

FormatValidationErrors is a function that takes a slice of validation errors and returns a slice of more readable validation errors that can be returned to clients.

type ValidationError

type ValidationError struct {
	Location string `json:"location"`
	Message  string `json:"message"`
	Type     string `json:"type"`
}

ValidationError is a struct that represents a validation error that can be returned in responses to clients.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL