Skip to main content

Module validation

Module validation 

Source
Expand description

Input validation helpers.

Functionsยง

validate_alt_text
Validate alt text length.
validate_carousel_children
Validate carousel child count is between MIN_CAROUSEL_ITEMS and MAX_CAROUSEL_ITEMS inclusive.
validate_country_codes
Validate country codes: each must be exactly 2 alphabetic ASCII characters.
validate_gif_attachment
Validate a GIF attachment: gif_id must be non-empty and provider must be a known variant (enforced at the type level by GifProvider).
validate_limit
Validate that an optional limit does not exceed MAX_POSTS_PER_REQUEST.
validate_link_count
Validate that the combined unique link count from text and link_attachment_url does not exceed MAX_LINKS.
validate_media_url
Validate a media URL: must be non-empty and start with http:// or https://.
validate_pagination_options
Validate pagination options: limit must not exceed MAX_POSTS_PER_REQUEST, and before and after cannot both be set.
validate_pending_replies_options
Validate pending replies options: limit and before/after exclusivity.
validate_poll_attachment
Validate poll attachment options.
validate_posts_options
Validate posts options: limit, since <= until ordering, and before/after exclusivity.
validate_replies_options
Validate replies options: limit and before/after exclusivity.
validate_search_options
Validate search options: limit, since timestamp, since <= until ordering, and before/after exclusivity.
validate_text_attachment
Validate a text attachment: plaintext length and styling ranges.
validate_text_entities
Validate text entities: at most MAX_TEXT_ENTITIES, each must be SPOILER type, and offsets must be non-negative (enforced by usize).
validate_text_length
Validate that text does not exceed MAX_TEXT_LENGTH characters.
validate_topic_tag
Validate a topic tag: must be 1-50 characters and not contain periods (.) or ampersands (&).