Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import io.a2a.grpc.utils.JSONRPCUtils;
import io.a2a.grpc.utils.ProtoUtils;
import io.a2a.json.JsonProcessingException;
import io.a2a.spec.A2AClientError;
import io.a2a.spec.A2AClientJSONError;
import io.a2a.spec.AgentCard;
Expand Down Expand Up @@ -105,13 +106,10 @@ public AgentCard getAgentCard() throws A2AClientError, A2AClientJSONError {

try {
io.a2a.grpc.AgentCard.Builder agentCardBuilder = io.a2a.grpc.AgentCard.newBuilder();
JSONRPCUtils.parseJsonString(body, agentCardBuilder);
JSONRPCUtils.parseJsonString(body, agentCardBuilder, null);
return ProtoUtils.FromProto.agentCard(agentCardBuilder);
} catch (JSONRPCError e) {
} catch (JSONRPCError | JsonProcessingException e) {
throw new A2AClientJSONError("Could not unmarshal agent card response", e);
}

}


}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.google.protobuf.util.JsonFormat;
import io.a2a.grpc.utils.JSONRPCUtils;
import io.a2a.grpc.utils.ProtoUtils;
import io.a2a.json.JsonProcessingException;
import io.a2a.spec.A2AClientError;
import io.a2a.spec.A2AClientJSONError;
import io.a2a.spec.AgentCard;
Expand Down Expand Up @@ -79,9 +80,9 @@ public void testGetAgentCardSuccess() throws Exception {
assertEquals(expected, requestCardString);
}

private AgentCard unmarshalFrom(String body) {
private AgentCard unmarshalFrom(String body) throws JsonProcessingException {
io.a2a.grpc.AgentCard.Builder agentCardBuilder = io.a2a.grpc.AgentCard.newBuilder();
JSONRPCUtils.parseJsonString(body, agentCardBuilder);
JSONRPCUtils.parseJsonString(body, agentCardBuilder, null);
return ProtoUtils.FromProto.agentCard(agentCardBuilder);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON;
import static jakarta.ws.rs.core.MediaType.SERVER_SENT_EVENTS;

import com.google.gson.JsonSyntaxException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -39,6 +40,7 @@
import io.a2a.spec.GetTaskPushNotificationConfigResponse;
import io.a2a.spec.GetTaskRequest;
import io.a2a.spec.GetTaskResponse;
import io.a2a.spec.IdJsonMappingException;
import io.a2a.spec.InternalError;
import io.a2a.spec.InvalidParamsJsonMappingException;
import io.a2a.spec.JSONParseError;
Expand Down Expand Up @@ -113,12 +115,12 @@ public void invokeJSONRPCHandler(@Body String body, RoutingContext rc) {
error = new JSONRPCErrorResponse(e.getId(), new io.a2a.spec.InvalidParamsError(null, e.getMessage(), null));
} catch (MethodNotFoundJsonMappingException e) {
error = new JSONRPCErrorResponse(e.getId(), new io.a2a.spec.MethodNotFoundError(null, e.getMessage(), null));
} catch (io.a2a.spec.IdJsonMappingException e) {
} catch (IdJsonMappingException e) {
error = new JSONRPCErrorResponse(e.getId(), new io.a2a.spec.InvalidRequestError(null, e.getMessage(), null));
} catch (JsonMappingException e) {
// General JsonMappingException - treat as InvalidRequest
error = new JSONRPCErrorResponse(new io.a2a.spec.InvalidRequestError(null, e.getMessage(), null));
} catch (com.google.gson.JsonSyntaxException e) {
} catch (JsonSyntaxException e) {
error = new JSONRPCErrorResponse(new JSONParseError(e.getMessage()));
} catch (JsonProcessingException e) {
error = new JSONRPCErrorResponse(new JSONParseError(e.getMessage()));
Expand Down
Loading