Help us shape the future of Go! Take the 2026 Go Developer Survey

validator

package
v0.3.0-20261020172017-... Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRejected = errors.New("rejected")

ErrRejected signals that the request must not land: a policy verdict, not a failure. Validators wrap it into the error they return for a rejection, and the validate stage terminates the request with that error's message as the reason. Any other error is a failure to validate, classified and retried or dead-lettered like any other stage failure.

Functions

This section is empty.

Types

type Config

type Config struct {
	// QueueName identifies the queue this request belongs to.
	QueueName string
}

Config carries the routing identity handed to a Factory.

type Factory

type Factory interface {
	// For returns the Validator for the given config. Returning nil indicates
	// no custom validation is needed for this config.
	For(cfg Config) (Validator, error)
}

Factory builds the Validator for a given config. Implementations are provided by integrators and inject whatever they need at construction.

type Validator

type Validator interface {
	// Validate runs custom validation on the request. It returns nil if the
	// request passes, an error wrapping ErrRejected if it must not land, and any
	// other error if it could not be validated.
	Validate(ctx context.Context, request entity.Request) error
}

Validator runs custom validation checks against a request. Implementations are provided by integrators for company-specific checks (e.g. org-policy enforcement, repo-specific rules). The built-in validate controller invokes this after fetching change metadata and before claiming URIs in the change store.

Directories

Path Synopsis
Package fake provides a validator.Validator that always passes.
Package fake provides a validator.Validator that always passes.
Package github provides a validator.Validator that rejects a request whose GitHub pull requests the repository's own rules would not let merge yet: a review is missing or requests changes, a required check failed or is still running, or GitHub otherwise reports merging as blocked.
Package github provides a validator.Validator that rejects a request whose GitHub pull requests the repository's own rules would not let merge yet: a review is missing or requests changes, a required check failed or is still running, or GitHub otherwise reports merging as blocked.
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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