Skip to content

Commit 04a9c84

Browse files
#331: use default codec (Avro) instead of hardcoded json in PayloadEnvelopeResolver and CodecRegistry
PayloadEnvelopeResolver::resolve() now uses CodecRegistry::defaultCodec() instead of hardcoding json when wrapping plain array input. CodecRegistry::universal() now returns [avro] only — json is no longer a universal v2 codec (per #334, Avro is the only v2 codec).
1 parent 9d7f7ac commit 04a9c84

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/Serializers/CodecRegistry.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* Canonical names:
1717
* - "avro" — Apache Avro binary codec (default for new workflows)
18-
* - "json" — language-neutral JSON (supported, not default)
18+
* - "json" — language-neutral JSON (v1 migration reads only, not for new v2 workflows)
1919
* - "workflow-serializer-y" — PHP SerializableClosure with byte-escape encoding (legacy)
2020
* - "workflow-serializer-base64" — PHP SerializableClosure with base64 encoding (legacy)
2121
*
@@ -123,7 +123,7 @@ public static function names(): array
123123
*/
124124
public static function universal(): array
125125
{
126-
return ['json', 'avro'];
126+
return ['avro'];
127127
}
128128

129129
/**

src/V2/Support/PayloadEnvelopeResolver.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* The worker protocol carries every payload as `{codec, blob}`. Clients may
1515
* send `input` in two shapes on the HTTP API:
1616
*
17-
* 1. A plain JSON array of arguments → codec "json", blob = JSON bytes
17+
* 1. A plain array of arguments → encoded with the configured default codec (Avro)
1818
* 2. An explicit envelope object `{codec: "<name>", blob: "<opaque>"}`
1919
* → codec = the declared name, blob = the opaque string as-is
2020
*
@@ -155,8 +155,8 @@ public static function resolve($input, string $field = 'input'): array
155155
$values = array_values($input);
156156

157157
return [
158-
'codec' => 'json',
159-
'blob' => Serializer::serializeWithCodec('json', $values),
158+
'codec' => CodecRegistry::defaultCodec(),
159+
'blob' => Serializer::serializeWithCodec(CodecRegistry::defaultCodec(), $values),
160160
];
161161
}
162162

0 commit comments

Comments
 (0)