1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! Parse OpenAPI specs, compare their contracts, and render focused Markdown context.
//!
//! The default `cli` feature includes the binary. Depend on the core alone with
//! `vimanam = { version = "1.6", default-features = false }`.
//! Library routines never write to stdout/stderr: rendering accepts a writer,
//! optional notices go to a caller callback, and parsing logs through `log`.
//!
//! ```no_run
//! # fn main() -> anyhow::Result<()> {
//! let old = vimanam::parse_openapi("immich-v1.105.1.json")?;
//! let new = vimanam::parse_openapi("immich-v1.106.0.json")?;
//! let old_sha = vimanam::diff::json::sha256_hex(&std::fs::read("immich-v1.105.1.json")?);
//! let new_sha = vimanam::diff::json::sha256_hex(&std::fs::read("immich-v1.106.0.json")?);
//! let diff = vimanam::diff::diff(&old, &new);
//! let document = vimanam::diff::json::to_json(&diff, None, &old_sha, &new_sha);
//! for change in &document.changes {
//! println!("{} {:?} {:?}", change.id, change.kind, change.severity);
//! }
//! # Ok(())
//! # }
//! ```
//!
//! For hashes tied to exactly the bytes parsed, use [`parse_openapi_bytes`].
//! Select operations with [`DocConfig::operation_selector`] and schemas with
//! [`DocConfig::schema_names`] or [`DocConfig::schema_fields`], then call
//! [`markdown::generate_markdown`]. See [`DocConfig::unfiltered`] for defaults.
// The argument/application adapter is outside the core library surface.
pub use ;
pub use ;