Skip to main content

Module default_json

Module default_json 

Source
Expand description

Emit pub fn default_json(version: i16) -> serde_json::Value per message.

The emitted function produces a serde_json::Value whose shape mirrors what Kafka’s *DataJsonConverter.read(json, version) expects for the default state of a message. That is the JSON the JVM oracle should accept to yield the same bytes as MessageName::default() after encoding.

The function is version-aware. It includes only fields that are valid for the requested version, and it emits null only for versions where the field is actually nullable. The JVM converter therefore never rejects the input.

Functions§

emit_default_json
Emit the default_json(version: i16) function body for the given message. The output is plain Rust source, and the caller appends it to the per-message owned module body.
json_field_name
Convert a Kafka schema field name in PascalCase, such as TransactionalId, to the JSON key the JVM’s *DataJsonConverter uses.