stringvalidator

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConflictsIfMatchesPathValue added in v0.17.0

func ConflictsIfMatchesPathValue(targetValue basetypes.StringValue, expressions ...path.Expression) validator.String

func IsBase64Encoded

func IsBase64Encoded() validator.String

IsBase64Encoded checks if a string is base64 encdoed.

If the string contains a Content-Type prefex, the prefix is ignored and the subsequent substring is evaluated.

func IsParseableJSON

func IsParseableJSON() validator.String

IsParseableJSON checks that a set of path.Expression, including the attribute the validator is applied to, must have a true value.

Relative path.Expression will be resolved using the attribute being validated.

func IsRequiredIfMatchesPathValue

func IsRequiredIfMatchesPathValue(targetValue basetypes.StringValue, expressions ...path.Expression) validator.String

IsRequiredIfMatchesPathValue validates if the provided string value equals the value at the provided path expression(s). If matched, the current arguemnt is required.

If a list of expressions is provided, all expressions are checked until a match is found, or the list of expressions is exhausted.

func IsRequiredIfRegexMatchesPathValue

func IsRequiredIfRegexMatchesPathValue(regexp *regexp.Regexp, message string, expressions ...path.Expression) validator.String

IsRequiredIfRegexMatchesPathValue validates if the provided regex matches the value at the provided path expression(s). If matched, the current argument is required.

If a list of expressions is provided, all expressions are checked until a match is found, or the list of expressions is exhausted.

func RegexMatchesPathValue

func RegexMatchesPathValue(regexp *regexp.Regexp, message string, expressions ...path.Expression) validator.String

RegexMatchesPathValue validates if the provided regex matches the value at the provided path expression(s). If a list of expressions is provided, all expressions are checked until a match is found, or the list of expressions is exhausted.

func ShouldBeDefinedValueIfPathMatchesValue added in v0.17.0

func ShouldBeDefinedValueIfPathMatchesValue(attributeValue basetypes.StringValue, targetPathValue basetypes.StringValue, expressions ...path.Expression) validator.String

Types

type StringParseableJSONValidator

type StringParseableJSONValidator struct{}

StringParseableJSONValidator validates that string is parseable JSON.

func (StringParseableJSONValidator) Description

Description describes the validation in plain text formatting.

func (StringParseableJSONValidator) MarkdownDescription

func (v StringParseableJSONValidator) MarkdownDescription(ctx context.Context) string

MarkdownDescription describes the validation in Markdown formatting.

func (StringParseableJSONValidator) ValidateString

Validate performs the validation.

Jump to

Keyboard shortcuts

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