Skip to main content

plugin_response_metadata

Function plugin_response_metadata 

Source
pub fn plugin_response_metadata() -> CodeGeneratorResponse
Expand description

A CodeGeneratorResponse carrying only the plugin capability fields: supported_features (proto3 optional and editions) and the edition range this crate’s code generation supports, currently EDITION_PROTO2 through EDITION_2024. The range widens when buffa-codegen gains support for a newer edition.

Attach these to every response a plugin writes, success or error, with struct-update syntax: CodeGeneratorResponse { error: Some(msg), ..plugin_response_metadata() }. Buf validates them even on an error response: when editions support is advertised without an edition range, it reports a protocol error in place of the plugin’s own message. A plugin whose output supports a narrower range should override maximum_edition (or supported_features) in the same struct expression.