Skip to content

Python Kafka structured JSON emits data_base64 instead of data #713

Not planned

Description

@clemensv

Generated Python Kafka producers serialize JSON into bytes before constructing the CloudEvent. In structured mode, the SDK consequently emits data_base64 for datacontenttype=application/json rather than embedding the JSON value as data.

Reproducer: generate a Python kafkaproducer for the existing versioned Reading fixture, create the generated Reading with value="live", construct the producer with content_mode="structured" and capture the produce(value=...) argument. json.loads(value)["data"] raises KeyError; the envelope contains data_base64.

Four source-level regression cases exposed this during Pegelonline regeneration: both event families, with and without dataschema overrides. The SDK can round-trip the base64 envelope, so consumer round-trip checks alone miss the binding error.

Correction: decode JSON and +json payload bytes before structured formatting, use an identity data marshaller, and retain raw binary bytes for non-JSON media types. Verify both JSON embedding and raw Avro base64 encoding in generated-runtime tests.

Activity

  1. added a commit that references this issue on Nov 24, 2026
    439f7a7
  2. clemensv commented on Nov 24, 2026

    @clemensv
    CollaboratorAuthor

    Duplicate of #701, discovered during regeneration. The same fix and regression proof are included in #712; tracking remains in #701.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions