fn generate_props(
    props: &[crate::engine::config::Property],
    id: bool,
    object: bool,
) -> HashMap<String, Property> {
    let mut hm = HashMap::new();

    // if the ID field was specified, add it
    if id {
        hm.insert(
            "id".to_string(),
            Property::new("id".to_string(), PropertyKind::Scalar, "ID".to_string())
                .with_required(object),
        );
    }

    // insert properties into hashmap
    props.iter().filter(|p| !p.hidden()).for_each(|p| {
        match &p.resolver() {
            None => {
                hm.insert(
                    p.name().to_string(),
                    Property::new(
                        p.name().to_string(),
                        PropertyKind::Scalar,
                        p.type_name().to_string(),
                    )
                    .with_required(p.required() && object)
                    .with_list(p.list())
                    .with_validator(p.validator().cloned()),
                );
            }
            Some(r) => {
                hm.insert(
                    p.name().to_string(),
                    Property::new(
                        p.name().to_string(),
                        PropertyKind::DynamicScalar,
                        p.type_name().to_string(),
                    )
                    .with_required(p.required() && object)
                    .with_list(p.list())
                    .with_resolver(r)
                    .with_validator(p.validator().cloned()),
                );
            }
        };
    });

    hm
}
/// Takes a vector of WG Properties and returns a map of Property structs that
/// represent the property fields in a graphql schema component
Takes a vector of WG Properties and returns a map of Property structs that
represent the property fields in a graphql schema component
Takes a vector of WG Properties and returns a map of Property structs that represent the property fields in a graphql schema component
fn generate_props(
    props: &[crate::engine::config::Property],
    id: bool,
    object: bool,
) -> HashMap<String, Property> {
    let mut hm = HashMap::new();
    // if the ID field was specified, add it
    if id {
        hm.insert(
            "id".to_string(),
            Property::new("id".to_string(), PropertyKind::Scalar, "ID".to_string())
                .with_required(object),
        );
    }
    // insert properties into hashmap
    props.iter().filter(|p| !p.hidden()).for_each(|p| {
        match &p.resolver() {
            None => {
                hm.insert(
                    p.name().to_string(),
                    Property::new(
                        p.name().to_string(),
                        PropertyKind::Scalar,
                        p.type_name().to_string(),
                    )
                    .with_required(p.required() && object)
                    .with_list(p.list())
                    .with_validator(p.validator().cloned()),
                );
            }
            Some(r) => {
                hm.insert(
                    p.name().to_string(),
                    Property::new(
                        p.name().to_string(),
                        PropertyKind::DynamicScalar,
                        p.type_name().to_string(),
                    )
                    .with_required(p.required() && object)
                    .with_list(p.list())
                    .with_resolver(r)
                    .with_validator(p.validator().cloned()),
                );
            }
        };
    });
    hm
}
fn generate_props ( props : & [ crate :: engine :: config :: Property ] , id : bool , object : bool , ) -> HashMap < String , Property > { let mut hm = HashMap :: new ( ) ; // if the ID field was specified, add it if id { hm . insert ( " " . to_string ( ) , Property :: new ( " " . to_string ( ) , PropertyKind :: Scalar , " " . to_string ( ) ) . with_required ( object ) , ) ; } // insert properties into hashmap props . iter ( ) . filter ( | p | ! p . hidden ( ) ) . for_each ( | p | { match & p . resolver ( ) { None => { hm . insert ( p . name ( ) . to_string ( ) , Property :: new ( p . name ( ) . to_string ( ) , PropertyKind :: Scalar , p . type_name ( ) . to_string ( ) , ) . with_required ( p . required ( ) && object ) . with_list ( p . list ( ) ) . with_validator ( p . validator ( ) . cloned ( ) ) , ) ; } Some ( r ) => { hm . insert ( p . name ( ) . to_string ( ) , Property :: new ( p . name ( ) . to_string ( ) , PropertyKind :: DynamicScalar , p . type_name ( ) . to_string ( ) , ) . with_required ( p . required ( ) && object ) . with_list ( p . list ( ) ) . with_resolver ( r ) . with_validator ( p . validator ( ) . cloned ( ) ) , ) ; } } ; } ) ; hm }
Takes a vector of WG Properties and returns a map of Property structs that
represent the property fields in a graphql schema component
Takes a vector of WG Properties and returns a map of Property structs that represent the property fields in a graphql schema component
props
&[crate::engine::config::Property]
id
bool
object
bool
props
&[crate::engine::config::Property]
id
bool
object
bool