docs(admin): document the 409 response on a2a agent update - #758
Merged
Conversation
PUT /admin/v1/a2a_agents/{id} rejects duplicate `name` values with a 409
(the unique-name check in a2a_agents_handlers.rs runs on update too), but
the OpenAPI operation only documented 200/400/401/404/413/415/500. Add the
409 response, mirroring the mcp_server update operation.
📝 WalkthroughWalkthroughThe hand-written OpenAPI document adds a ChangesA2A agent OpenAPI documentation
Estimated code review effort: 1 (Trivial) | ~2 minutes 🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…every mutating admin operation Audit follow-up: the openapi tests passed with or without the a2a PUT 409, so the omission this PR fixes was unguarded. Mirror the 413 body-limit parity test for the 409/AdminError response across all 8 resources' POST + PUT operations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the missing
409response to thePUT /admin/v1/a2a_agents/{id}operation in the hand-written admin OpenAPI assembly (crates/aisix-admin/src/openapi.rs), mirroring the wording already used byPUT /admin/v1/mcp_servers/{id}("Duplicate name",AdminErrorschema).Why
The handler can actually return it:
update_a2a_agentruns the unique-name check on update too (assert_unique_name(&all, &agent.name, Some(&id))incrates/aisix-admin/src/a2a_agents_handlers.rs), returningAdminError::Conflict→ 409 when the replacement payload reuses another agent'sname. The operation's own prose description already says "rejects duplicatenamevalues" — only the response table was missing the code. Every other resource's update operation (models, api_keys, provider_keys, mcp_servers, guardrails, cache_policies, observability_exporters) already documents its 409; a2a_agents was the one gap.Spec-only change; no runtime behavior touched.
Audit follow-up
An independent audit of the first commit found one MEDIUM: nothing tested 409 documentation, so the omission this PR fixes was unguarded (the suite passed with or without the fix). Addressed in the second commit with
openapi_documents_admin_duplicate_name_conflicts, a 409/AdminErrorparity test over all 8 resources' POST + PUT operations, mirroring the existing 413 body-limit parity test.Test plan
cargo run -p aisix-admin --bin dump-openapi > /tmp/admin-api.openapi.json— a2a PUT now lists200/400/401/404/409/413/415/500; its 409 object is byte-identical to the mcp_server PUT'scargo test -p aisix-admin openapi— 20 passed, 0 failed (including the new parity test)