-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
What happened?
Problem Description
There is a critical field name mismatch in the APIKeySecurityScheme message that breaks interoperability between JSON-RPC and gRPC transports:
- JSON Schema (a2a.json): Uses field name "in" (following OpenAPI 3.0 standard)
- gRPC Proto (a2a.proto): Uses field name "location"
This inconsistency causes authentication configuration to fail when converting between JSON and gRPC formats, as clients implementing different transports cannot properly exchange security scheme information.
Current State
gRPC Proto:
message APIKeySecurityScheme {
string description = 1;
string location = 2; // ❌ Incorrect field name
string name = 3;
}JSON Schema:
"APIKeySecurityScheme": {
// ...
"in": {
"description": "The location of the API key.",
"enum": [
"cookie",
"header",
"query"
],
"type": "string"
}
// ...
}Why This Breaks
- Proto serializes to JSON as
"location", violating the JSON schema - JSON clients send
"in", which proto parsers don't recognize - OpenAPI 3.0 standard mandates
"in"- the JSON schema is correct per spec - Authentication configuration fails silently - security schemes are ignored
Expected Behavior
Both specifications should use "in" to match the OpenAPI 3.0 Security Scheme specification.
Reproduction
// 1. Create security scheme in gRPC
security_schemes {
key: "api_key"
value {
api_key_security_scheme {
description: "API Key authentication"
location: "header" // Using proto field name
name: "X-API-Key"
}
}
}
// 2. Serialize to JSON via HTTP/JSON transcoding
// Result: {"location": "header", ...}
// 3. Validate against JSON schema
// Error: Missing required field "in"Proposed Solution
Option A (Recommended): Rename proto field
message APIKeySecurityScheme {
string description = 1;
string in = 2; // CHANGED: Renamed from "location" to "in"
string name = 3;
}Option B: Add json_name annotation
message APIKeySecurityScheme {
string description = 1;
string location = 2 [json_name = "in"]; // Map to correct JSON field
string name = 3;
}Recommendation: Option A aligns the proto with OpenAPI 3.0 standard and maintains consistency. Field number 2 remains unchanged, so wire format compatibility is preserved.
Relevant log output
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
No labels