Class A2aServerJson

java.lang.Object
com.xebialabs.xlrelease.a2a.server.A2aServerJson

public final class A2aServerJson extends Object
The one place A2A payloads become JSON on the server side, delegating to the SDK's own mapper.

Why not the host's Jackson mapper. The A2A spec types are not plain data. Several are discriminated by member name rather than by a type tag, and the SDK implements that with Gson type adapters registered inside JsonUtil: a Part is written as exactly one of text / raw / url / data, and a SendMessageResponse result as exactly one of task / message. Jackson sees ordinary Java records and writes every member, producing JSON that round-trips locally and that a spec-compliant client cannot discriminate. The sibling implementation in dai-release-assistant shipped exactly that bug before switching to the SDK mapper, so this is a known failure mode and not a precaution.

The cost is a second JSON library inside this module — Gson, already a transitive dependency of the spec jar. It stays confined here: nothing outside com.xebialabs.xlrelease.a2a sees an SDK type, and the OSGi-exported surface is still the plain view types.

  • Method Details

    • write

      public static String write(Object payload)
      Serializes an A2A payload through the SDK's mapper.
      Parameters:
      payload - the spec type to serialize
      Returns:
      its JSON representation