1use std::fmt;
2use std::fs;
3use std::io;
4use std::mem;
5use std::path::{Path, PathBuf};
6use std::time;
7
8use openapiv3::OpenAPI;
9use serde::{de, Deserialize, Serialize};
10use serde_json as json;
11
12pub use config::MergeConfig;
13pub use ext::OpenAPIExt;
14pub use input::Description;
15pub use input::Dispute;
16pub use input::Input;
17pub use input::InputSource;
18pub use input::OperationSelection;
19pub use input::PathModification;
20pub use merge::Merge;
21
22mod config;
23mod ext;
24mod input;
25mod merge;
26
27fn load_json_file<T>(path: impl AsRef<Path>) -> io::Result<T>
28where
29 T: de::DeserializeOwned,
30{
31 let text = fs::read_to_string(path)?;
32 json::from_str(&text).map_err(io::Error::other)
33}
34
35fn save_json_file<T>(path: impl AsRef<Path>, value: &T) -> io::Result<()>
36where
37 T: Serialize,
38{
39 let text = json::to_string_pretty(value).map_err(io::Error::other)?;
40 fs::write(path, text)
41}
42
43fn default<T: Default>() -> T {
44 T::default()
45}