pub fn read_files(input_files_paths: &[impl AsRef<Utf8Path>]) -> Result<Self> {
        let mut docs: IndexMap<Utf8PathBuf, OpenAPI> = IndexMap::new();
        for file_path in input_files_paths {
            Spec::read_file(&mut docs, file_path)?;
        }

        let mut schemas: IndexMap<RefKey, Schema> = IndexMap::new();
        let mut parameters: IndexMap<RefKey, Parameter> = IndexMap::new();
        for (path, doc) in &docs {
            for (name, schema) in &doc.definitions {
                if let ReferenceOr::Item(schema) = schema {
                    let ref_key = RefKey {
                        file_path: path.clone(),
                        name: name.clone(),
                    };
                    schemas.insert(ref_key, schema.clone());
                }
            }

            for (name, param) in &doc.parameters {
                parameters.insert(
                    RefKey {
                        file_path: path.clone(),
                        name: name.clone(),
                    },
                    param.clone(),
                );
            }
        }

        Ok(Self {
            docs,
            schemas,
            parameters,
            input_files_paths: input_files_paths.iter().map(|f| f.as_ref().to_owned()).collect(),
        })
    }
/// Read a list of input files as OpenApi docs with the first being the root doc
///
/// This eagerly collects all the schemas and parametes for the docs
Read a list of input files as OpenApi docs with the first being the root doc
This eagerly collects all the schemas and parametes for the docs
Read a list of input files as OpenApi docs with the first being the root doc This eagerly collects all the schemas and parametes for the docs
pub fn read_files(input_files_paths: &[impl AsRef<Utf8Path>]) -> Result<Self> {
        let mut docs: IndexMap<Utf8PathBuf, OpenAPI> = IndexMap::new();
        for file_path in input_files_paths {
            Spec::read_file(&mut docs, file_path)?;
        }
        let mut schemas: IndexMap<RefKey, Schema> = IndexMap::new();
        let mut parameters: IndexMap<RefKey, Parameter> = IndexMap::new();
        for (path, doc) in &docs {
            for (name, schema) in &doc.definitions {
                if let ReferenceOr::Item(schema) = schema {
                    let ref_key = RefKey {
                        file_path: path.clone(),
                        name: name.clone(),
                    };
                    schemas.insert(ref_key, schema.clone());
                }
            }
            for (name, param) in &doc.parameters {
                parameters.insert(
                    RefKey {
                        file_path: path.clone(),
                        name: name.clone(),
                    },
                    param.clone(),
                );
            }
        }
        Ok(Self {
            docs,
            schemas,
            parameters,
            input_files_paths: input_files_paths.iter().map(|f| f.as_ref().to_owned()).collect(),
        })
    }
pub fn read_files ( input_files_paths : & [ impl AsRef < Utf8Path > ] ) -> Result < Self > { let mut docs : IndexMap < Utf8PathBuf , OpenAPI > = IndexMap :: new ( ) ; for file_path in input_files_paths { Spec :: read_file ( & mut docs , file_path ) ? ; } let mut schemas : IndexMap < RefKey , Schema > = IndexMap :: new ( ) ; let mut parameters : IndexMap < RefKey , Parameter > = IndexMap :: new ( ) ; for ( path , doc ) in & docs { for ( name , schema ) in & doc . definitions { if let ReferenceOr :: Item ( schema ) = schema { let ref_key = RefKey { file_path : path . clone ( ) , name : name . clone ( ) , } ; schemas . insert ( ref_key , schema . clone ( ) ) ; } } for ( name , param ) in & doc . parameters { parameters . insert ( RefKey { file_path : path . clone ( ) , name : name . clone ( ) , } , param . clone ( ) , ) ; } } Ok ( Self { docs , schemas , parameters , input_files_paths : input_files_paths . iter ( ) . map ( | f | f . as_ref ( ) . to_owned ( ) ) . collect ( ) , } ) }
Read a list of input files as OpenApi docs with the first being the root doc
This eagerly collects all the schemas and parametes for the docs
Read a list of input files as OpenApi docs with the first being the root doc This eagerly collects all the schemas and parametes for the docs
input_files_paths
&[impl AsRef<Utf8Path>]