Skip to main content

encode_encoding

Function encode_encoding 

Source
pub fn encode_encoding(
    declared: Option<&str>,
    registry: Option<&WireEncoding>,
    schema: Option<&TypeSchema>,
) -> Option<String>
Available on crate feature decode only.
Expand description

The encoding a body should be encoded into, which is a different question from the one crate::model::decode::resolve_encoding answers.

Decoding resolves sample > registry > sniff because a received payload has bytes to sniff. An outgoing body has none that mean anything — the operator typed JSON whatever the subject carries, so sniffing it would label every protobuf subject application/json. The ladder is therefore declared flag > registry encoding > the schema kind’s native encoding, and the kind is the authority of last resort precisely because it is the one thing that cannot be wrong.