Skip to main content

aspero_json/
lib.rs

1//! aspero's JSON contract: the shapes agents and apps read, shared by the
2//! CLI and any other front end so they can't drift.
3//!
4//! Fields are omitted when unknown rather than `null`; the lean default set
5//! is enough to identify and cite, and `full` adds everything known. Every
6//! result echoes what it answers (`input`, a claim's `key`), so results can
7//! arrive in any order.
8
9mod claim;
10mod lookup;
11mod scan;
12mod verify;
13mod work;
14
15pub use claim::{ClaimInput, InputClaim};
16pub use lookup::{Status, disagreements, input as input_lookup, invalid, item as lookup_item};
17pub use scan::mention;
18pub use verify::{invalid_claim, verification};
19pub use work::{candidate, set_abstract, usage, usage_one, work};
20
21use serde_json::Value;
22
23/// `base` with `extra`'s fields added (both JSON objects).
24pub fn merged(mut base: Value, extra: Value) -> Value {
25    if let (Value::Object(b), Value::Object(e)) = (&mut base, extra) {
26        b.extend(e);
27    }
28    base
29}