Skip to main content

analyze_metadata

Function analyze_metadata 

Source
pub fn analyze_metadata(metadata: &CodeGenMetadata) -> Result<GenerationPlan>
Expand description

Analyze collected metadata and create a generation plan.

Analysis is protocol-agnostic: every method gets a MethodPlan. REST analysis is a superset of what ConnectRPC needs, so a method with a google.api.http annotation carries the full REST shape (path/query/body split, URL template) and one without carries the routeless shape (all request fields as body). MethodPlan::has_http_route distinguishes them: the REST emitters generate only routed methods; the ConnectRPC emitter generates all. No method is dropped here.

Hierarchy derivation uses a two-phase cross-service algorithm:

  1. Build all service plans (hierarchy empty).
  2. Construct a global parent map across all services, then assign depth-sorted hierarchies.