pub fn allowed(v: &Value, fields: &[&str]) -> ValueExpand description
The fields of v an allow-list names, and nothing else: what reaches the published site is
what was named, not what was not excluded.
use majordomus_cli::site::allowed;
let v = serde_json::json!({"id": "context", "body": "prose", "route": "/domains/context/"});
let public = allowed(&v, &["id", "route"]);
assert_eq!(public, serde_json::json!({"id": "context", "route": "/domains/context/"}));
assert_eq!(allowed(&serde_json::json!("not an object"), &["id"]), serde_json::json!({}));