fix: align CR format with broker CompleteRequest schema
- Add session_id field to CrEvidence (broker expects it) - Change merkle_root to Option<String> (null vs empty string) - Change events to Vec<serde_json::Value> (broker expects list[dict]) - Fixes 422 Unprocessable Entity on CR posting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
5f7f9c0ff7
commit
e7bc2ee2b4
1 changed files with 5 additions and 3 deletions
|
|
@ -17,8 +17,9 @@ pub struct CrRequest {
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
pub struct CrEvidence {
|
pub struct CrEvidence {
|
||||||
pub events: Vec<String>,
|
pub session_id: Option<String>,
|
||||||
pub merkle_root: String,
|
pub events: Vec<serde_json::Value>,
|
||||||
|
pub merkle_root: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
|
|
@ -77,8 +78,9 @@ pub fn post_cr(client: &Client, base: &str, ac_id: &str, outcome: &str) -> CrRes
|
||||||
outcome: outcome.into(),
|
outcome: outcome.into(),
|
||||||
completed_at: now,
|
completed_at: now,
|
||||||
chronicle_evidence: CrEvidence {
|
chronicle_evidence: CrEvidence {
|
||||||
|
session_id: if session_id.is_empty() { None } else { Some(session_id.clone()) },
|
||||||
events: vec![],
|
events: vec![],
|
||||||
merkle_root: String::new(),
|
merkle_root: None,
|
||||||
},
|
},
|
||||||
behavioral_attestation: CrAttestation {
|
behavioral_attestation: CrAttestation {
|
||||||
status: "unavailable".into(),
|
status: "unavailable".into(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue