Convert a proto sandbox policy into the canonical policy JSON representation. The shape mirrors the YAML schema used by [`serialize_sandbox_policy`], so automation can use the same documented field names in either format.
(policy: &SandboxPolicy)
| 981 | /// The shape mirrors the YAML schema used by [`serialize_sandbox_policy`], so |
| 982 | /// automation can use the same documented field names in either format. |
| 983 | pub fn sandbox_policy_to_json_value(policy: &SandboxPolicy) -> Result<serde_json::Value> { |
| 984 | let json_repr = from_proto(policy); |
| 985 | serde_json::to_value(&json_repr) |
| 986 | .into_diagnostic() |
| 987 | .wrap_err("failed to serialize policy to JSON") |
| 988 | } |
| 989 | |
| 990 | /// Serialize a proto sandbox policy to a pretty-printed JSON string. |
| 991 | pub fn serialize_sandbox_policy_json(policy: &SandboxPolicy) -> Result<String> { |