Skip to content

Commit de76056

Browse files
authored
Fix some small openAPI issues (#3299)
## Problem The current **openAPI** spec validation is failing when calling `openapi-spec-validator out/openapi/*` ```bash openapi-spec-validator out/openapi/* out/openapi/config.json: Validation Error: Path parameter 'action' for 'post' operation in '/api/v2/action' was not resolved 8 ``` ## Solution The **PUT** and **PATCH** for **/api/v2/config** as well as the POST for **/api/v2/action** receives the value as the body content and does not receive an specific param.
2 parents 3f4eda7 + 7f7908e commit de76056

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

rust/agama-server/src/server/web.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,10 @@ async fn get_config(State(state): State<ServerState>) -> ServerResult<Json<Confi
210210
put,
211211
path = "/config",
212212
context_path = "/api/v2",
213+
request_body(content = Value, description = "Configuration to apply."),
213214
responses(
214215
(status = 200, description = "The configuration was replaced. Other operations can be running in background."),
215216
(status = 400, description = "Not possible to replace the configuration.")
216-
),
217-
params(
218-
("config" = Value, description = "Configuration to apply.")
219217
)
220218
)]
221219
async fn put_config(State(state): State<ServerState>, Json(json): Json<Value>) -> ServerResult<()> {
@@ -232,12 +230,10 @@ async fn put_config(State(state): State<ServerState>, Json(json): Json<Value>) -
232230
patch,
233231
path = "/config",
234232
context_path = "/api/v2",
233+
request_body(content = Patch, description = "Changes in the configuration."),
235234
responses(
236235
(status = 200, description = "The configuration was patched. Other operations can be running in background."),
237236
(status = 400, description = "Not possible to patch the configuration.")
238-
),
239-
params(
240-
("patch" = Patch, description = "Changes in the configuration.")
241237
)
242238
)]
243239
async fn patch_config(
@@ -410,13 +406,11 @@ async fn get_license(
410406
post,
411407
path = "/action",
412408
context_path = "/api/v2",
409+
request_body(content = Action, description = "Description of the action to run."),
413410
responses(
414411
(status = 200, description = "Action successfully ran."),
415412
(status = 400, description = "Not possible to run the action.", body = Object),
416413
(status = 422, description = "Action blocked by backend state", body = Object)
417-
),
418-
params(
419-
("action" = Action, description = "Description of the action to run."),
420414
)
421415
)]
422416
async fn run_action(

rust/package/agama.changes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
-------------------------------------------------------------------
2+
Fri Mar 20 07:54:46 UTC 2026 - Knut Anderssen <kanderssen@suse.com>
3+
4+
- Fix incorrect openAPI parameters (gh#agama-project/agama#3299).
5+
- Do not define params for POST '/api/v2/action'
6+
- Do not define params for PUT and PATCH '/api/v2/config
7+
18
-------------------------------------------------------------------
29
Thu Mar 19 21:11:29 UTC 2026 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>
310

0 commit comments

Comments
 (0)