feat(model-avro): re-platform converter onto common-avro + common-json#1909
Open
jfallows wants to merge 2 commits into
Open
feat(model-avro): re-platform converter onto common-avro + common-json#1909jfallows wants to merge 2 commits into
jfallows wants to merge 2 commits into
Conversation
Re-platform the model-avro converter off the shaded Apache Avro + Jackson whole-message GenericRecord/JSON path onto the format-native common-avro library and the common-json transcoder, surfaced through the engine model SPI. - AvroRead/AvroWrite converters drive the common-avro AvroJson streaming pipelines (avro<->JSON) for view: json; schemas are resolved via CatalogHandler and the compiled AvroSchema + parser cached per schemaId. - Validation and field extraction run on the common-avro streaming pull parser (zero-copy segments for string/bytes/fixed), aborting via engine RESET on a decode/validation failure. - Add a canonical (flattened nullable-single union) mode to the common-avro AvroJson parser/stream/generator so view: json keeps the existing key=value encoding for [null, T] unions; every other union shape is unchanged. - Drop the shaded Apache Avro + Jackson dependencies, the shade plugin, and the org.apache.avro.io.* classes; depend on common-avro + common-json and regenerate NOTICE. - Preserve existing model: avro config, view: json semantics, padding, and field extraction; the validation-failed event now carries the common-avro decode error, mirroring the model-json re-platform. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CLYLdgT4B97uSUndTsG6N
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CLYLdgT4B97uSUndTsG6N
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1856.
Re-platforms the
model-avroconverter off the shaded Apache Avro + Jackson whole-messageGenericRecord/JSON path onto the format-nativecommon-avrolibrary (#1838/#1884) for the Avro side and thecommon-jsontranscoder (#1855) for the JSON side, surfaced through the engine model SPI.common-avro — canonical union mode
Adds a canonical (flattened nullable-single union) mode to the
AvroJsonbridge:AvroJson.parser/stream/generator(schema, ..., canonical)— whencanonicalistrue, a union ofnulland exactly one other type encodes/decodes as a bare JSON value (nullor the unwrapped value) instead of the{"<branch>": value}wrapper. Every other union shape is unchanged.model-avro'sview: jsonkeep its existing key=value semantics for["null", T]unions, matching the priorCanonicalJsonEncoder.AvroJsonTestcases.model-avro — re-platform
AvroRead/AvroWriteconverters drive thecommon-avroAvroJsonstreaming pipelines (avro↔JSON, canonical) forview: json; the schema is resolved viaCatalogHandler, compiled to anAvroSchema, and cached perschemaIdalongside its pull parser.$.fieldextraction run on thecommon-avrostreaming pull parser (zero-copy segments forstring/bytes/fixed); a decode/validation failure aborts via engineRESET.org.apache.avro.io.*classes; depends oncommon-avro+common-json;NOTICEregenerated.model: avroconfig,view: jsonsemantics, JSON padding, and field extraction. The validation-failed event now carries thecommon-avrodecode error, mirroring themodel-jsonre-platform precedent (EventIT+event.yamlupdated accordingly).Testing
Full
clean installwith k3po integration tests is green formodel-avro.spec,common-avro, andmodel-avro: unit tests,EventIT, JaCoCo coverage, Checkstyle, license, and NOTICE checks all pass.Notes
io.aklivity.zilla.runtime.model.avro.config) is unchanged, so dependents (docker image, bindings using the avro model) are not expected to be affected.truncated datumerror string fromcommon-avro; if that wording changes upstream the spec expectation needs a matching update — the same couplingmodel-jsonalready has.🤖 Generated with Claude Code
https://claude.ai/code/session_012CLYLdgT4B97uSUndTsG6N
Generated by Claude Code