GracefulSerialization.Helpers (VLLM v0.3.0)

Copy Markdown View Source

Helper wrappers for graceful_serialization.

Summary

Functions

Return a dict containing a generator and a regular value.

Return a dict containing a compiled regex pattern.

Return a list containing a compiled regex pattern.

Return a list with multiple compiled patterns at different positions.

Return a deeply nested structure with a compiled pattern.

Return a pattern compiled with flags to show flag preservation.

Return a tuple containing a compiled pattern.

Return a list of validation configurations with compiled regex patterns.

Functions

dict_with_generator(opts \\ [])

@spec dict_with_generator(keyword()) :: {:ok, term()} | {:error, term()}

Return a dict containing a generator and a regular value.

dict_with_pattern(opts \\ [])

@spec dict_with_pattern(keyword()) :: {:ok, term()} | {:error, term()}

Return a dict containing a compiled regex pattern.

list_with_pattern(opts \\ [])

@spec list_with_pattern(keyword()) :: {:ok, term()} | {:error, term()}

Return a list containing a compiled regex pattern.

multiple_patterns(opts \\ [])

@spec multiple_patterns(keyword()) :: {:ok, term()} | {:error, term()}

Return a list with multiple compiled patterns at different positions.

nested_structure(opts \\ [])

@spec nested_structure(keyword()) :: {:ok, term()} | {:error, term()}

Return a deeply nested structure with a compiled pattern.

pattern_with_flags(opts \\ [])

@spec pattern_with_flags(keyword()) :: {:ok, term()} | {:error, term()}

Return a pattern compiled with flags to show flag preservation.

tuple_with_pattern(opts \\ [])

@spec tuple_with_pattern(keyword()) :: {:ok, term()} | {:error, term()}

Return a tuple containing a compiled pattern.

validation_configs(opts \\ [])

@spec validation_configs(keyword()) :: {:ok, term()} | {:error, term()}

Return a list of validation configurations with compiled regex patterns.

This is a real-world pattern: storing compiled patterns alongside metadata for form validation, input parsing, API request validation, etc.

Expected behavior: The outer list and inner dicts should be preserved, with only the 'pattern' field becoming a ref (re.Pattern is non-serializable).