Skip to content

Commit

Permalink
feat: added description and comment
Browse files Browse the repository at this point in the history
  • Loading branch information
sauraww committed Jan 3, 2025
1 parent 9270000 commit 8a27413
Show file tree
Hide file tree
Showing 65 changed files with 993 additions and 120 deletions.
27 changes: 24 additions & 3 deletions crates/context_aware_config/src/api/config/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,31 @@ fn construct_new_payload(
},
)?;

return Ok(web::Json(PutReq {
context: context,
let description = match res.get("description") {
Some(Value::String(s)) => Some(s.clone()),
Some(_) => {
log::error!("construct new payload: Description is not a valid string");
return Err(bad_argument!("Description must be a string"));
}
None => None,
};

// Handle change_reason
let change_reason = res
.get("change_reason")
.and_then(|val| val.as_str())
.map(|s| s.to_string())
.ok_or_else(|| {
log::error!("construct new payload: Change reason not present or invalid");
bad_argument!("Change reason is required and must be a string")
})?;

Ok(web::Json(PutReq {
context,
r#override: override_,
}));
description,
change_reason,
}))
}

#[allow(clippy::too_many_arguments)]
Expand Down
Loading

0 comments on commit 8a27413

Please sign in to comment.