     }
   }
 
+  /// Get the value type of a number if possible.
+  ///
+  /// `NSNumber` does not provide an easy way for checking the internal value type. Therefore we first have to check if
+  /// it's a boolean, and if not try to match the CF type to something Swift-y.
+  ///
+  /// - Parameter number: The value to describe
+  /// - Returns: `ValueType` case (may be `any` if no match is found)
   private static func valueType(for number: NSNumber) -> String {
     if CFGetTypeID(number) == CFBooleanGetTypeID() {
       return ValueType.bool

      return [Key.type: ValueType.int]
    } else if dataType == Double.self {
      return [Key.type: ValueType.double]
    } else if dataType == Date.self {
      return [Key.type: ValueType.date]
    } else if dataType == Data.self {
      return [Key.type: ValueType.data]
    } else if let data = data as? NSNumber {
      return [Key.type: valueType(for: data)]

  /// for complex types (such as arrays and dictionaries), describing the type information of sub-elements (such as an
  /// array's element, or each of a dictionary's properties).
  ///
  /// Note: this is used for the JSON, Plist and YAML Stencil contexts
  ///
  /// - Parameter data: The value to describe
  /// - Returns: Dictionary with type information about the value (for Stencil context)
  static func generate(for data: Any) -> [String: Any] {
    let dataType = type(of: data)

    // We want to use toll-free briding using `data is X`, to for example easily check if something is a `String` (or
    // `String`-like). In other cases we actually want to avoid it, and use `dataType == X.self`. TFB to `NSNumber` for
    // example leads to confusion for ambiguous values (0, 1, true, false, ...). 
    if data is String {
      return [Key.type: ValueType.string]
    } else if dataType == Bool.self {
