Documentation
¶
Index ¶
- func ASCIIOnly() validator.String
- func ExactlyOneOf(attributeNames ...string) validator.Object
- func IllegalCharactersInString(forbiddenChars []rune, description string) validator.String
- func JSONSchemaValidator() validator.String
- func RegexMatches(regexp *regexp.Regexp, message string) validator.String
- func RequiredWith(fieldName string, fieldValue string) validator.String
- func StringLengthAtMost(maxLength int) validator.String
- func StringListAllowedValues(values ...string) validator.List
- func StringSetAllowedValues(allowedValues ...string) validator.Set
- type MutuallyExclusiveAttributesValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ASCIIOnly ¶
ASCIIOnly returns a string validator which ensures that the string contains only ASCII characters (0-127).
func ExactlyOneOf ¶
ExactlyOneOf returns a validator that ensures exactly one of the specified attributes is set. This validator works on nested attributes within a block.
func IllegalCharactersInString ¶
IllegalCharactersInString returns a string validator which ensures that the string does not contain any of the specified forbidden characters.
func JSONSchemaValidator ¶
JSONSchemaValidator returns a validator which ensures that a string attribute is a valid JSON and doesn't exceed the maximum allowed nesting depth
func RegexMatches ¶
RegexMatches returns a validator.String that ensures any configured value matches the provided regular expression pattern. Null and unknown values are skipped. An optional message can be provided to customize the error output.
func RequiredWith ¶
RequiredWith returns a string validator which ensures that the field is set when another field matches a specific value.
func StringLengthAtMost ¶
StringLengthAtMost returns a string validator which ensures that the string does not exceed the specified maximum length.
func StringListAllowedValues ¶
StringListAllowedValues returns a validator that ensures each string in a list matches one of the allowed values.
func StringSetAllowedValues ¶
StringSetAllowedValues returns a Set validator which ensures that any configured string set value matches one of the allowed values exactly.
Types ¶
type MutuallyExclusiveAttributesValidator ¶
type MutuallyExclusiveAttributesValidator struct {
AttributeNames []string
}
MutuallyExclusiveAttributesValidator checks if only one of the specified attributes is set
func (MutuallyExclusiveAttributesValidator) Description ¶
func (v MutuallyExclusiveAttributesValidator) Description(ctx context.Context) string
Description returns the validator's description.
func (MutuallyExclusiveAttributesValidator) MarkdownDescription ¶
func (v MutuallyExclusiveAttributesValidator) MarkdownDescription(ctx context.Context) string
MarkdownDescription returns the validator's description in Markdown format.
func (MutuallyExclusiveAttributesValidator) ValidateObject ¶
func (v MutuallyExclusiveAttributesValidator) ValidateObject(ctx context.Context, req validator.ObjectRequest, resp *validator.ObjectResponse)
ValidateObject implements validator logic