Why? Cannot convert value of type 'JSONArray' to expected argument type 'DataToValidate'

Viewed 22

Have this method call:

let result = try validate(JSONArray([true]), schema: schema)

here is the declaration:

public func validate(_ value: DataToValidate, schema: JSONObject) throws -> ValidationResult {
  return try validator(for: schema).validate(instance: value)
}

public enum DataToValidate {
    case object(JSONObject)
    case array(JSONArray)
    case string(String)
}

Why, what is wrong? enum can be JSONArray.

0 Answers
Related