Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 0 additions & 73 deletions doc/questions.md

This file was deleted.

6 changes: 1 addition & 5 deletions rust/agama-cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ use anyhow::{anyhow, Context};
use clap::Subcommand;
use console::style;
use fluent_uri::Uri;
use serde_json::json;
use tempfile::Builder;
use tokio::time::sleep;

Expand Down Expand Up @@ -175,10 +174,7 @@ async fn patch_config(
http_client: &BaseHTTPClient,
model: &api::Config,
) -> Result<(), anyhow::Error> {
let model_json = json!(model);
let patch = api::Patch {
update: Some(model_json),
};
let patch = api::Patch::with_update(model)?;
http_client.patch_void("/v2/config", &patch).await?;
Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions rust/agama-lib/src/questions/http_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use std::time::Duration;

use agama_utils::api::{
patch::{self, Patch},
patch::Patch,
question::{
Answer, AnswerRule, Config as QuestionsConfig, Policy, Question, QuestionSpec,
UpdateQuestion,
Expand All @@ -39,7 +39,7 @@ pub enum QuestionsHTTPClientError {
#[error("Unknown question with ID {0}")]
UnknownQuestion(u32),
#[error(transparent)]
Patch(#[from] patch::Error),
Json(#[from] serde_json::Error),
}

pub struct HTTPClient {
Expand Down
9 changes: 2 additions & 7 deletions rust/agama-utils/src/api/patch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,17 @@ use crate::api::config::Config;
use serde::{Deserialize, Serialize};
use serde_json::Value;

#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error(transparent)]
Json(#[from] serde_json::Error),
}

/// Patch for the config.
#[derive(Deserialize, Serialize, utoipa::ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct Patch {
/// Update for the current config.
#[schema(value_type = Option<Config>)]
pub update: Option<Value>,
}

impl Patch {
pub fn with_update(config: &Config) -> Result<Self, Error> {
pub fn with_update(config: &Config) -> Result<Self, serde_json::Error> {
Ok(Self {
update: Some(serde_json::to_value(config)?),
})
Expand Down
5 changes: 5 additions & 0 deletions rust/package/agama.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Apr 9 06:53:34 UTC 2026 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

- Fix OpenAPI specification for PATCH /config (gh#agama-project/agama#3368).

-------------------------------------------------------------------
Tue Apr 7 16:55:22 UTC 2026 - Ladislav Slezák <lslezak@suse.com>

Expand Down
Loading