Skip to main content

Module postprocess

Module postprocess 

Source
Expand description

Rewrites of the buffa model output, whose JSON choices are fixed in the buf plugin:

  • Field names. JsonFieldNames::Proto serializes the snake_case proto names instead of lowerCamelCase (both are still read). An explicit json_name is kept.
  • 64-bit integers. int64_module points buffa’s string helpers at the json_int64 module, which writes numbers.
  • Free-form JSON. json_value_module makes google.protobuf.Value/Struct/ListValue fields write whole numbers as integers (1, not 1.0).
  • Field options (field_options): explicit json_names.

The rewrites are idempotent and skip the files trestle writes itself.

Structs§

ModelRewrites
The rewrites to apply to the buffa model output.
PackageFields
The fields of one proto package with JSON options, keyed Message.field.

Enums§

JsonFieldNames
How the JSON field names of one proto package are serialized.

Functions§

field_options
The fields of metadata with JSON options, by package, for ModelRewrites::fields.
space_items
Put blank lines between the items of a pretty-printed Rust file (prettyplease prints none; rustfmt keeps them but never adds them): before an item that follows a } or a use group at the same indentation, and after the file’s inner attributes. Idempotent.