fn fill_required(map: &mut Map<String, Value>, known_required: Vec<HashSet<&str>>) {
    if let Some(first_set) = known_required.first() {
        let common_required = first_set
            .iter()
            .filter(|&k| known_required.iter().all(|s| s.contains(k)))
            .map(|x| json!(x))
            .collect::<Vec<Value>>();
        if !common_required.is_empty() {
            map.insert("required".into(), Value::Array(common_required));
        }
    }
}
/// Fill required properties
/// There will be only properties that are common to all objects
Fill required properties
There will be only properties that are common to all objects
Fill required properties There will be only properties that are common to all objects
fn fill_required(map: &mut Map<String, Value>, known_required: Vec<HashSet<&str>>) {
    if let Some(first_set) = known_required.first() {
        let common_required = first_set
            .iter()
            .filter(|&k| known_required.iter().all(|s| s.contains(k)))
            .map(|x| json!(x))
            .collect::<Vec<Value>>();
        if !common_required.is_empty() {
            map.insert("required".into(), Value::Array(common_required));
        }
    }
}
fn fill_required ( map : & mut Map < String , Value > , known_required : Vec < HashSet < & str > > ) { if let Some ( first_set ) = known_required . first ( ) { let common_required = first_set . iter ( ) . filter ( | & k | known_required . iter ( ) . all ( | s | s . contains ( k ) ) ) . map ( | x | json ! ( x ) ) . collect :: < Vec < Value > > ( ) ; if ! common_required . is_empty ( ) { map . insert ( " " . into ( ) , Value :: Array ( common_required ) ) ; } } }
Fill required properties
There will be only properties that are common to all objects
Fill required properties There will be only properties that are common to all objects
map
&mut Map<String, Value>
known_required
Vec<HashSet<&str>>