pub fn parse_file_descriptor_set(
file_descriptor_set: &FileDescriptorSet,
) -> Result<CodeGenMetadata>Expand description
Parse a compiled protobuf FileDescriptorSet into CodeGenMetadata.
This is the first stage of the code-generation pipeline. It walks every
message, enum, and service in the descriptor set and extracts the annotations
that drive generation (google.api.http, google.api.resource,
field_behavior, debug_redact, …) into a structured form.
The full pipeline is three stages:
FileDescriptorSet
│ parse_file_descriptor_set
▼
CodeGenMetadata
│ analyze_metadata (analysis/mod.rs)
▼
GenerationPlan
│ generate_code (codegen/mod.rs)
▼
Rust / Python / TypeScript source written to diskTypical usage from a build script:
ⓘ
let fds = prost_types::FileDescriptorSet::decode(&bytes[..])?;
let metadata = parse_file_descriptor_set(&fds)?;
let config = CodeGenConfig::new(/* … */);
generate_code(&metadata, &config)?;Returns an error if a descriptor contains an annotation that cannot be
decoded; methods without HTTP annotations are not an error here (they are
recorded later, during analyze_metadata).