Documentation ¶
Overview ¶
Package validate implements the functions, types, and interfaces for the module.
Package validate implements the functions, types, and interfaces for the module.
Package validate implements the functions, types, and interfaces for the module.
Package validate implements the functions, types, and interfaces for the module.
Package validate implements the functions, types, and interfaces for the module.
Package validate implements the functions, types, and interfaces for the module.
Index ¶
- func NewProtoValidate(opts ...ProtoValidatorOption) (*protovalidate.Validator, error)
- func ProtoValidate(message proto.Message) error
- func Server(ss ...OptionSetting) (middleware.Middleware, error)
- type CompilationError
- type OnValidationErrCallback
- type Option
- type OptionSetting
- type ProtoValidator
- type ProtoValidatorOption
- func WithAllowUnknownFields(allow bool) ProtoValidatorOption
- func WithDescriptors(descriptors ...protoreflect.MessageDescriptor) ProtoValidatorOption
- func WithDisableLazy(disable bool) ProtoValidatorOption
- func WithExtensionTypeResolver(extensionTypeResolver protoregistry.ExtensionTypeResolver) ProtoValidatorOption
- func WithMessages(messages ...proto.Message) ProtoValidatorOption
- func WithStandardConstraintInterceptor(interceptor StandardConstraintInterceptor) ProtoValidatorOption
- func WithUTC(use bool) ProtoValidatorOption
- type RuntimeError
- type StandardConstraintInterceptor
- type StandardConstraintResolver
- type ValidationError
- type Validator
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewProtoValidate ¶
func NewProtoValidate(opts ...ProtoValidatorOption) (*protovalidate.Validator, error)
NewProtoValidate creates a new ProtoValidator.
func ProtoValidate ¶
ProtoValidate validates a protobuf message.
func Server ¶ added in v0.0.12
func Server(ss ...OptionSetting) (middleware.Middleware, error)
Server is a validator middleware.
Types ¶
type CompilationError ¶
type CompilationError = protovalidate.CompilationError
CompilationError is an error that occurs during compilation.
type OnValidationErrCallback ¶ added in v0.0.12
type OptionSetting ¶ added in v0.1.0
type OptionSetting = func(*Option)
func WithFailFast ¶
func WithFailFast(failFast bool) OptionSetting
WithFailFast tells v1Validator to immediately stop doing further validation after first validation error. This option is ignored if message is only supporting v1Validator.v1ValidatorLegacy interface.
func WithOnValidationErrCallback ¶ added in v0.0.12
func WithOnValidationErrCallback(onValidationErrCallback OnValidationErrCallback) OptionSetting
WithOnValidationErrCallback registers function that will be invoked on validation error(s).
func WithV2ProtoValidatorOptions ¶ added in v0.0.12
func WithV2ProtoValidatorOptions(opts ...ProtoValidatorOption) OptionSetting
WithV2ProtoValidatorOptions registers options for Validator with version 2.
type ProtoValidator ¶
type ProtoValidator = protovalidate.Validator
ProtoValidator is a v1Validator for protobuf messages.
type ProtoValidatorOption ¶
type ProtoValidatorOption = protovalidate.ValidatorOption
ProtoValidatorOption is an option for the ProtoValidator.
func WithAllowUnknownFields ¶
func WithAllowUnknownFields(allow bool) ProtoValidatorOption
WithAllowUnknownFields allows unknown fields.
func WithDescriptors ¶
func WithDescriptors(descriptors ...protoreflect.MessageDescriptor) ProtoValidatorOption
WithDescriptors sets the descriptors to validate.
func WithDisableLazy ¶
func WithDisableLazy(disable bool) ProtoValidatorOption
WithDisableLazy disables lazy validation.
func WithExtensionTypeResolver ¶
func WithExtensionTypeResolver(extensionTypeResolver protoregistry.ExtensionTypeResolver) ProtoValidatorOption
WithExtensionTypeResolver sets the extension type resolver.
func WithMessages ¶
func WithMessages(messages ...proto.Message) ProtoValidatorOption
WithMessages sets the messages to validate.
func WithStandardConstraintInterceptor ¶
func WithStandardConstraintInterceptor(interceptor StandardConstraintInterceptor) ProtoValidatorOption
WithStandardConstraintInterceptor adds a standard constraint interceptor.
type RuntimeError ¶
type RuntimeError = protovalidate.RuntimeError
RuntimeError is an error that occurs during runtime.
type StandardConstraintInterceptor ¶
type StandardConstraintInterceptor = protovalidate.StandardConstraintInterceptor
StandardConstraintInterceptor is a constraint interceptor for the ProtoValidator.
type StandardConstraintResolver ¶
type StandardConstraintResolver = protovalidate.StandardConstraintResolver
StandardConstraintResolver is a constraint resolver for the ProtoValidator.
type ValidationError ¶
type ValidationError = protovalidate.ValidationError
ValidationError is an error that occurs during validation.
type Validator ¶
func NewValidateV1 ¶ added in v0.0.12
func NewValidateV1(failFast bool, callback OnValidationErrCallback) Validator
func NewValidateV2 ¶ added in v0.0.12
func NewValidateV2(opts ...ProtoValidatorOption) (Validator, error)
NewValidateV2 creates a new v2Validator.