Skip to content

docs: expose allowed_agents in API key OpenAPI schemas - #735

Merged
kayx23 merged 2 commits into
mainfrom
docs-a2a-apikey-openapi
Jul 7, 2026
Merged

docs: expose allowed_agents in API key OpenAPI schemas#735
kayx23 merged 2 commits into
mainfrom
docs-a2a-apikey-openapi

Conversation

@kayx23

@kayx23 kayx23 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add allowed_agents to the API key create/update OpenAPI schema
  • add allowed_agents to the public API key response schema
  • register the A2A Agents tag in the generated Admin API reference
  • extend the OpenAPI unit coverage for A2A agent access on caller API keys

Validation

  • cargo test -p aisix-admin openapi_uses_self_hosted_apikey_request_schema
  • cargo fmt --check
  • git diff --check

This supports api7/docs#1790, where the Agent Gateway guides use allowed_agents in caller API key examples.

Summary by CodeRabbit

  • New Features
    • Added support for allowing A2A agents on caller API keys.
    • Key details now include an optional agent-access list with wildcard matching and clear “omitted or null means no access” behavior.
    • Added a new OpenAPI tag for A2A Agents.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@kayx23, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 48 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c9ea4117-b2f4-4fe6-bd66-06b8dc58c5b3

📥 Commits

Reviewing files that changed from the base of the PR and between 9fd18bc and a7732f5.

📒 Files selected for processing (3)
  • crates/aisix-admin/src/openapi.rs
  • crates/aisix-core/src/models/apikey.rs
  • schemas/resources/api_key.schema.json
📝 Walkthrough

Walkthrough

Adds an allowed_agents field to the Admin OpenAPI schemas for PublicApiKey and ApiKeyRequest, documenting nullable list semantics with wildcard matching for A2A agent authorization. Registers a new "A2A Agents" OpenAPI tag and extends existing tests to assert the new field's presence and documentation.

Changes

A2A Agents OpenAPI Schema Update

Layer / File(s) Summary
allowed_agents schema fields and tag
crates/aisix-admin/src/openapi.rs
PublicApiKey and ApiKeyRequest schemas gain a nullable allowed_agents array property with wildcard matching semantics and "omitted or null means no access" documentation; a new "A2A Agents" tag is registered.
OpenAPI test assertions for allowed_agents
crates/aisix-admin/src/openapi.rs
The existing OpenAPI schema test is extended to assert allowed_agents exists on both request and response schemas with expected documentation wording.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • api7/aisix#677: Same file and pattern — adds an authorization allowlist field (allowed_tools) to the same OpenAPI schemas and test.
  • api7/aisix#717: Introduces the same allowed_agents allowlist field at the schema/core level, which this PR documents/validates in the OpenAPI spec.
🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
E2e Test Quality Review ⚠️ Warning Coverage is spec-only: the test parses merged_openapi() and asserts schema fields; it never hits the live admin API or persistence layer, so E2E is missing. Add an integration/E2E test that runs the admin service, creates/updates an API key with allowed_agents, reads it back, and verifies the field survives the real request/response flow.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: exposing allowed_agents in API key OpenAPI schemas.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Security Check ✅ Passed No security issues found: the PR only adds OpenAPI docs/tests for allowed_agents and a tag; it doesn't alter auth, storage, logging, or secret handling.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs-a2a-apikey-openapi

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the generated Admin API OpenAPI JSON (and its unit assertions) to expose the allowed_agents field on caller API keys, so the API reference matches the gateway’s A2A agent access-control capabilities.

Changes:

  • Add allowed_agents to the API key create/update request schema (ApiKeyRequest) and public response schema (PublicApiKey) in the OpenAPI JSON.
  • Register a new OpenAPI tag, A2A Agents, for the Admin API reference.
  • Extend the OpenAPI unit test to assert allowed_agents is documented for both request and response schemas.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/aisix-admin/src/openapi.rs
Comment thread crates/aisix-admin/src/openapi.rs
@kayx23
kayx23 merged commit 292aeb4 into main Jul 7, 2026
12 checks passed
@kayx23
kayx23 deleted the docs-a2a-apikey-openapi branch July 7, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants