[Bug]: JsonFormat parser fails on standard OpenAPI AgentCard (securityRequirements & securitySchemes)

Open
#1,161 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@ashish927 is already working on this.

Since Oct 26, 2026.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
java, openapi
Domain
api

Research direction

Reproduce the failure with Protobuf's JsonFormat.parser().merge() using a standard OpenAPI AgentCard payload. Inspect the AgentCard, SecurityRequirement, and SecurityScheme definitions and the ProtoUtils.FromProto.agentCard validation; done means standard securityRequirements and securitySchemes deserialize successfully without manual Jackson AST mutation.

Written by the indexing model from the issue text.

Description

What happened?

When deserializing an OpenAPI-compliant AgentCard JSON payload into org.a2aproject.sdk.grpc.AgentCard using Protobuf's JsonFormat.parser().merge(), two schema mismatch errors occur because the Protobuf definitions expect custom nested message structures instead of standard OpenAPI JSON structures.

Bug 1: securityRequirements Array Mismatch

Issue: OpenAPI specs define security requirements as "bearerAuth": []. In a2a.proto, SecurityRequirement maps schemes as map<string, StringList>, expecting a nested StringList message ({"bearerAuth": {"list": []}}).

Error: com.google.protobuf.InvalidProtocolBufferException: Expect message object but got: [].

Bug 2: securitySchemes Flattened Structure Mismatch

Issue: OpenAPI specs define security scheme parameters at the root level ("scheme": "bearer", "bearerFormat": "API Key"). Protobuf expects these wrapped inside the oneof field http ("http": {"scheme": "bearer", ...}).

Error: InvalidParamsError: SecurityScheme oneof field not set during ProtoUtils.FromProto.agentCard(builder) validation.

Expected Behavior
The SDK should provide an adapter or custom JSON deserializer capable of parsing standard OpenAPI Agent Cards without requiring clients to manually mutate Jackson AST nodes before Protobuf merging.

Environment

SDK Version: Protobuf Java 4.33.1 / SDK org.a2aproject.sdk.grpc

Relevant log output

Code of Conduct
  • I agree to follow this project's Code of Conduct
Dominant language
Java
Stars
514
Forks
200
Avg merge
1d 2h
Merged PRs (30d)
53

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from a2aproject/a2a-java

All issues in a2aproject/a2a-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.