validator

package
v0.3.0-20261125172032-... Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 3 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

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