Skip to main content

type_compatible

Function type_compatible 

Source
pub fn type_compatible(val: &Value, expected: &str) -> bool
Expand description

Check if a value is compatible with the expected JSON Schema type using CFN’s loose semantics.

  • "string": anything except object/array/null
  • "integer": anything parseable as a whole number (not bool)
  • "number": anything parseable as a number (not bool)
  • "boolean": native bool or YAML 1.1 boolean strings (true/false/yes/no/on/off/y/n/1/0 with standard casings)
  • "object", "array", "null": strict native type only