rule

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package rule provides parsing and validation of workflow input validation rules.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateValue

func ValidateValue(value string, rules []ValidationRule) []string

ValidateValue validates a value against a set of rules. Returns a slice of error messages for any failed validations.

Types

type RuleType

type RuleType int

RuleType represents the type of validation rule.

const (
	RuleRegex RuleType = iota
	RuleRange
	RuleRequired
	RulePrefix
	RuleSuffix
	RuleLength
)

type ValidationRule

type ValidationRule struct {
	Type    RuleType
	Pattern string
	Min     int
	Max     int
}

ValidationRule represents a single validation rule parsed from YAML comments.

func ParseValidationComment

func ParseValidationComment(comment string) (*ValidationRule, error)

ParseValidationComment parses a single comment line for validation rules. Returns nil if the comment doesn't contain a validation rule.

func ParseValidationComments

func ParseValidationComments(comments []string) ([]ValidationRule, error)

ParseValidationComments parses multiple comment lines and returns all valid rules.

Jump to

Keyboard shortcuts

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