///|
/// Bounds used while converting untrusted JSON values to or from Avro data.
pub struct JsonLimits {
max_depth : Int
max_collection_items : Int
max_string_bytes : Int
} derive(Debug, Eq)
///|
pub fn JsonLimits::new(
max_depth? : Int = 64,
max_collection_items? : Int = 1_000_000,
max_string_bytes? : Int = 64 * 1024 * 1024,
) -> JsonLimits {
{
max_depth: if max_depth < 1 {
1
} else {
max_depth
},
max_collection_items: if max_collection_items < 0 {
0
} else {
max_collection_items
},
max_string_bytes: if max_string_bytes < 0 {
0
} else {
max_string_bytes
},
}
}
///|
pub fn JsonLimits::max_depth(self : JsonLimits) -> Int {
self.max_depth
}
///|
pub fn JsonLimits::max_collection_items(self : JsonLimits) -> Int {
self.max_collection_items
}
///|
pub fn JsonLimits::max_string_bytes(self : JsonLimits) -> Int {
self.max_string_bytes
}
///|
/// Errors reported by schema-driven Avro JSON conversion.
pub(all) suberror JsonError {
TypeMismatch(expected~ : String, actual~ : String)
InvalidNumber(expected~ : String, value~ : Double)
InvalidEnum(symbol~ : String)
InvalidUnion(message~ : String)
InvalidFixed(expected~ : Int, actual~ : Int)
InvalidByteString(message~ : String)
MissingField(field~ : String)
UnexpectedField(field~ : String)
LimitExceeded(limit~ : String)
UnresolvedName(String)
InvalidJson(String)
} derive(Debug, Eq)