Skip to content

Commit 1fc9dc8

Browse files
jmesnilclaude
andcommitted
fix: use DataPart.fromJson() instead of constructor in a2a-java SUT
The a2a-java SDK changed the DataPart API to allow using raw JSON directly (from a2aproject/a2a-java#778). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ace67f7 commit 1fc9dc8

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

codegen/java_emitter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def _single_part_to_java(part: PartDef) -> str:
264264
)
265265

266266
if isinstance(part, DataPartDef):
267-
return f"new DataPart({_java_string(part.json_content)})"
267+
return f"DataPart.fromJson({_java_string(part.json_content)})"
268268

269269
msg = f"Unknown part type: {type(part).__name__}"
270270
raise ValueError(msg)

sut/a2a-java/src/main/java/org/a2aproject/sdk/TckAgentExecutorProducer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public void execute(RequestContext context, AgentEmitter emitter) throws A2AErro
103103
}
104104

105105
if (messageId.startsWith("tck-artifact-data")) {
106-
emitter.addArtifact(List.of(new DataPart("{\"key\": \"value\", \"count\": 42}")), null, null, null);
106+
emitter.addArtifact(List.of(DataPart.fromJson("{\"key\": \"value\", \"count\": 42}")), null, null, null);
107107
emitter.complete();
108108
return;
109109
}

0 commit comments

Comments
 (0)