Skip to main content

Module coercion

Module coercion 

Source
Expand description

CloudFormation stringifies all scalar values before sending them to resource handlers, so 512 and "512" are equivalent. YAML 1.1 also parses yes/no as booleans. These helpers implement the same loose type semantics so that constraint checks (min/max, enum, pattern, length) work on coerced values.

Enums§

CoerceResult
Result of attempting to coerce a JSON value to match an expected schema type.

Functions§

coerce_port_to_string
Stringify a value for port-style comparison, accepting only string and integer scalars.
coerce_str_to_integer
The string arm of coerce_to_integer, for callers that hold a scalar outside a serde_json::Value (such as the parser’s ParseValue values).
coerce_string_or_integer_to_string
Returns the text authored for a string or integer scalar. Fractional numbers, booleans, nulls, and composite values have no string-or-integer form.
coerce_to_bool
Accepts YAML 1.1 boolean strings in addition to native bools.
coerce_to_integer
coerce_to_number
coerce_to_string
coerce_value
Attempt to coerce a JSON value to match the expected schema type.
scalar_eq
Whether two values are equal under CloudFormation’s loose scalar semantics.
type_compatible
Check if a value is compatible with the expected JSON Schema type using CFN’s loose semantics.