Skip to content

Fix Python producer inherited Avro content types - #671

Merged
clemensv merged 1 commit into
mainfrom
fix/670-python-avro-content-type
Nov 13, 2026
Merged

clemensv merged 1 commit into
mainfrom
fix/670-python-avro-content-type

Conversation

@clemensv

Copy link
Copy Markdown
Collaborator

Changes

Fixes #670.

  • Honor declared and inherited Avro datacontenttype values in Python producer defaults; retain avro/binary when no media type is declared. JSON variants over Avro schemas remain JSON.
  • Normalize application/vnd.apache.org.avro+avro to Avrotize's accepted application/vnd.apache.avro+avro only at serialization calls. Wire metadata keeps the declared value. Apply this across the Python producers that share the default macro.
  • Preserve datacontenttype inside structured Kafka envelopes, alongside data_base64 and the application/cloudevents+json Kafka content-type header.

Verification

Seven focused regression/compatibility cases pass locally. The new generated Kafka test executes actual send methods with a recording producer, decodes wire payloads using the independent Avro reader, and checks JSON payloads, structured envelopes, defaults, explicit overrides, canonical aliases and MIME parameters. AMQP generated defaults and generated Python compilation are covered. No live-broker AMQP claim is made.

The existing Kafka byte-preserving marshaller was already present on main; the new tests exercise the complete send path rather than just that helper.

Preserve JSON and binary Avro variants over the same schema, normalize the reported Avro alias only for serialization, and retain datacontenttype in structured Kafka envelopes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: dfdd160a-bd4a-4a7e-bfb0-34d189fc944a
Signed-off-by: Clemens Vasters <clemens@vasters.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python producers ignore inherited Avro content type; Kafka binary marshaller always emits JSON

1 participant