(json_str: &str)
| 611 | |
| 612 | #[allow(dead_code)] |
| 613 | pub fn load_json(json_str: &str) -> Result<Repository, FPError> { |
| 614 | let repo = serde_json::from_str::<Repository>(json_str) |
| 615 | .map_err(|e| FPError::JsonError(json_str.to_owned(), e)); |
| 616 | if let Ok(repo) = &repo { |
| 617 | for t in repo.toggles.values() { |
| 618 | validate_toggle(t)? |
| 619 | } |
| 620 | } |
| 621 | repo |
| 622 | } |
| 623 | |
| 624 | fn concat_reason(reason1: String, reason2: Option<String>) -> String { |
| 625 | if let Some(reason2) = reason2 { |