Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DescriptionValidator ¶
type DescriptionValidator struct{}
DescriptionValidator ensures the string does not have leading/trailing whitespace and does not exceed 250 characters.
func (DescriptionValidator) Description ¶
func (v DescriptionValidator) Description(ctx context.Context) string
Description provides a plain text description of the validator's behavior.
func (DescriptionValidator) MarkdownDescription ¶
func (v DescriptionValidator) MarkdownDescription(ctx context.Context) string
MarkdownDescription provides a markdown description of the validator's behavior.
func (DescriptionValidator) ValidateString ¶
func (v DescriptionValidator) ValidateString(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse)
ValidateString performs the validation logic.
type DisallowListValidator ¶
type DisallowListValidator struct {
// Forbidden is the list of disallowed string values
Forbidden []string
}
DisallowListValidator ensures a value is not one of a forbidden set
func (DisallowListValidator) Description ¶
func (v DisallowListValidator) Description(ctx context.Context) string
Description returns a human-friendly description of this validator.
func (DisallowListValidator) MarkdownDescription ¶
func (v DisallowListValidator) MarkdownDescription(ctx context.Context) string
MarkdownDescription returns the markdown-formatted description.
func (DisallowListValidator) ValidateString ¶
func (v DisallowListValidator) ValidateString(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse)
ValidateString checks whether the given value matches any forbidden entry.
type DisallowPrefixValidator ¶
type DisallowPrefixValidator struct {
// Prefix is the forbidden starting substring
Prefix string
}
DisallowPrefixValidator holds the prefix that must not be used
func (DisallowPrefixValidator) Description ¶
func (v DisallowPrefixValidator) Description(ctx context.Context) string
Description returns a human-friendly description of this validator.
func (DisallowPrefixValidator) MarkdownDescription ¶
func (v DisallowPrefixValidator) MarkdownDescription(ctx context.Context) string
MarkdownDescription returns the markdown-formatted description.
func (DisallowPrefixValidator) ValidateString ¶
func (v DisallowPrefixValidator) ValidateString(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse)
ValidateString checks whether the given value starts with the forbidden prefix.
type LinkValidator ¶
type LinkValidator struct{}
LinkValidator ensures the string matches the required pattern and length constraints.
func (LinkValidator) Description ¶
func (v LinkValidator) Description(ctx context.Context) string
Description provides a plain text description of the validator's behavior.
func (LinkValidator) MarkdownDescription ¶
func (v LinkValidator) MarkdownDescription(ctx context.Context) string
MarkdownDescription provides a markdown description of the validator's behavior.
func (LinkValidator) ValidateString ¶
func (v LinkValidator) ValidateString(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse)
ValidateString performs the validation logic.
type NameValidator ¶
type NameValidator struct{}
NameValidator ensures the string matches the required pattern and length constraints.
func (NameValidator) Description ¶
func (v NameValidator) Description(ctx context.Context) string
Description provides a plain text description of the validator's behavior.
func (NameValidator) MarkdownDescription ¶
func (v NameValidator) MarkdownDescription(ctx context.Context) string
MarkdownDescription provides a markdown description of the validator's behavior.
func (NameValidator) ValidateString ¶
func (v NameValidator) ValidateString(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse)
ValidateString performs the validation logic.
type PrefixStringValidator ¶
type PrefixStringValidator struct {
// Prefix is the expected beginning of the string
Prefix string
// Regex is the compiled pattern used to validate the string prefix
Regex *regexp.Regexp
// Label is used in error messages to describe what kind of value is expected
Label string
}
PrefixStringValidator checks if a string starts with a given prefix or matches a regex pattern.
func NewPrefixStringValidator ¶
func NewPrefixStringValidator(prefix, label string) PrefixStringValidator
NewPrefixStringValidator returns a new validator with the given prefix or regex.
func (PrefixStringValidator) Description ¶
func (v PrefixStringValidator) Description(_ context.Context) string
Description returns a plain text description of the validator's behavior.
func (PrefixStringValidator) MarkdownDescription ¶
func (v PrefixStringValidator) MarkdownDescription(_ context.Context) string
MarkdownDescription returns a markdown description of the validator's behavior.
func (PrefixStringValidator) ValidateString ¶
func (v PrefixStringValidator) ValidateString(_ context.Context, req validator.StringRequest, resp *validator.StringResponse)
ValidateString performs validation on the input string.
type TagValidator ¶
type TagValidator struct{}
TagValidator ensures the map of tags does not exceed 50 entries.
func (TagValidator) Description ¶
func (v TagValidator) Description(ctx context.Context) string
Description provides a plain text description of the validator's behavior.
func (TagValidator) MarkdownDescription ¶
func (v TagValidator) MarkdownDescription(ctx context.Context) string
MarkdownDescription provides a markdown description of the validator's behavior.
func (TagValidator) ValidateMap ¶
func (v TagValidator) ValidateMap(ctx context.Context, req validator.MapRequest, resp *validator.MapResponse)
ValidateMap checks if the tag map contains more than 50 entries.