Skip to main content

reconvert_enum_values

Function reconvert_enum_values 

Source
pub fn reconvert_enum_values(
    kwargs: HashMap<String, Value>,
    schema_args: &SchemaArgs,
) -> HashMap<String, Value>
Expand description

Re-map string enum values from CLI args back to their JSON-typed forms.

clap always produces String values; this function converts them to the correct JSON type (number, boolean, null) based on the original schema definition stored in schema_args.enum_maps.

§Arguments

  • kwargs — raw CLI arguments map (string values from clap)
  • schema_args — the SchemaArgs produced by schema_to_clap_args

Returns a new map with enum values converted to their correct JSON types. Non-enum keys and Null values pass through unchanged.