/// Translates information from `coercer` and `path` to list of Swagger's Param objects
Translates information from `coercer` and `path` to list of Swagger's Param objects
Translates information from ` coercer ` and ` path ` to list of Swagger ' s Param objects
fn extract_params(coercer: &Option<json_dsl::Builder>, path: &framework::Path) -> Vec<Param> {
    let mut params = collections::BTreeMap::new();
    if coercer.is_some() {
        let coercer = coercer.as_ref().unwrap();
        for param in coercer.get_required().iter() {
            params.insert(param.name.clone(), build_param_from_coercer(param, true));
        }
        for param in coercer.get_optional().iter() {
            params.insert(param.name.clone(), build_param_from_coercer(param, false));
        }
    }
    for param_name in path.params.iter() {
        let exists = {
            let mut existing_param = params.get_mut(param_name);
            if existing_param.is_some() {
                let param = existing_param.as_mut().unwrap();
                param.place = Place::Path;
                param.required = true;
                true
            } else {
                false
            }
        };
        if !exists {
            let param = Param {
                name: param_name.clone(),
                place: Place::Path,
                description: None,
                required: true,
                ext: ParamExt::NormalParam {
                    type_: ParamType::String,
                    format: None,
                    items: None
                }
            };
            params.insert(param_name.clone(), param);
        }
    }
    params.into_iter().map(|(_key, value)| value).collect::<Vec<Param>>()
}
fn extract_params ( coercer : & Option < json_dsl :: Builder > , path : & framework :: Path ) -> Vec < Param > { let mut params = collections :: BTreeMap :: new ( ) ; if coercer . is_some ( ) { let coercer = coercer . as_ref ( ) . unwrap ( ) ; for param in coercer . get_required ( ) . iter ( ) { params . insert ( param . name . clone ( ) , build_param_from_coercer ( param , true ) ) ; } for param in coercer . get_optional ( ) . iter ( ) { params . insert ( param . name . clone ( ) , build_param_from_coercer ( param , false ) ) ; } } for param_name in path . params . iter ( ) { let exists = { let mut existing_param = params . get_mut ( param_name ) ; if existing_param . is_some ( ) { let param = existing_param . as_mut ( ) . unwrap ( ) ; param . place = Place :: Path ; param . required = true ; true } else { false } } ; if ! exists { let param = Param { name : param_name . clone ( ) , place : Place :: Path , description : None , required : true , ext : ParamExt :: NormalParam { type_ : ParamType :: String , format : None , items : None } } ; params . insert ( param_name . clone ( ) , param ) ; } } params . into_iter ( ) . map ( | ( _key , value ) | value ) . collect :: < Vec < Param > > ( ) }
Translates information from `coercer` and `path` to list of Swagger's Param objects
Translates information from ` coercer ` and ` path ` to list of Swagger ' s Param objects
coercer
&Option<json_dsl::Builder>
path
&framework::Path