pub fn coerce_argument_values<'a, R>(
    ctx: &ExecutionContext<'_, R>,
    object_type: &'a s::ObjectType,
    field: &q::Field,
) -> Result<HashMap<&'a q::Name, q::Value>, Vec<QueryExecutionError>>
where
    R: Resolver,
{
    let mut coerced_values = HashMap::new();
    let mut errors = vec![];

    let resolver = |name: &Name| sast::get_named_type(&ctx.schema.document, name);

    for argument_def in sast::get_argument_definitions(object_type, &field.name)
        .into_iter()
        .flatten()
    {
        let value = qast::get_argument_value(&field.arguments, &argument_def.name).cloned();
        match coercion::coerce_input_value(value, &argument_def, &resolver, &ctx.variable_values) {
            Ok(Some(value)) => {
                coerced_values.insert(&argument_def.name, value);
            }
            Ok(None) => {}
            Err(e) => errors.push(e),
        }
    }

    if errors.is_empty() {
        Ok(coerced_values)
    } else {
        Err(errors)
    }
}
/// Coerces argument values into GraphQL values.
Coerces argument values into GraphQL values.
Coerces argument values into GraphQL values .
pub fn coerce_argument_values<'a, R>(
    ctx: &ExecutionContext<'_, R>,
    object_type: &'a s::ObjectType,
    field: &q::Field,
) -> Result<HashMap<&'a q::Name, q::Value>, Vec<QueryExecutionError>>
where
    R: Resolver,
{
    let mut coerced_values = HashMap::new();
    let mut errors = vec![];
    let resolver = |name: &Name| sast::get_named_type(&ctx.schema.document, name);
    for argument_def in sast::get_argument_definitions(object_type, &field.name)
        .into_iter()
        .flatten()
    {
        let value = qast::get_argument_value(&field.arguments, &argument_def.name).cloned();
        match coercion::coerce_input_value(value, &argument_def, &resolver, &ctx.variable_values) {
            Ok(Some(value)) => {
                coerced_values.insert(&argument_def.name, value);
            }
            Ok(None) => {}
            Err(e) => errors.push(e),
        }
    }
    if errors.is_empty() {
        Ok(coerced_values)
    } else {
        Err(errors)
    }
}
pub fn coerce_argument_values < ' a , R > ( ctx : & ExecutionContext < ' _ , R > , object_type : & ' a s :: ObjectType , field : & q :: Field , ) -> Result < HashMap < & ' a q :: Name , q :: Value > , Vec < QueryExecutionError > > where R : Resolver , { let mut coerced_values = HashMap :: new ( ) ; let mut errors = vec ! [ ] ; let resolver = | name : & Name | sast :: get_named_type ( & ctx . schema . document , name ) ; for argument_def in sast :: get_argument_definitions ( object_type , & field . name ) . into_iter ( ) . flatten ( ) { let value = qast :: get_argument_value ( & field . arguments , & argument_def . name ) . cloned ( ) ; match coercion :: coerce_input_value ( value , & argument_def , & resolver , & ctx . variable_values ) { Ok ( Some ( value ) ) => { coerced_values . insert ( & argument_def . name , value ) ; } Ok ( None ) => { } Err ( e ) => errors . push ( e ) , } } if errors . is_empty ( ) { Ok ( coerced_values ) } else { Err ( errors ) } }
Coerces argument values into GraphQL values.
Coerces argument values into GraphQL values .
ctx
&ExecutionContext<'_, R>
object_type
&'a s::ObjectType
field
&q::Field
ctx
&ExecutionContext<'_, R>
object_type
&'a s::ObjectType
field
&q::Field