validate

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: Apache-2.0, MIT Imports: 4 Imported by: 0

Documentation

Overview

Package validate decodes and validates request bodies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidationError

func IsValidationError(err error) bool

IsValidationError reports whether err contains validation failures.

func Request

func Request(r io.Reader, dst any) error

Request decodes the JSON body and runs validation when supported.

Types

type FieldError

type FieldError struct {
	Field   string `json:"field"`
	Message string `json:"message"`
}

FieldError locates one failed rule on the request payload.

func FieldErrors

func FieldErrors(err error) []FieldError

FieldErrors converts an error into field-level response entries.

Jump to

Keyboard shortcuts

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