Expand description
Analysis module for processing protobuf metadata into code generation plans
This module takes the raw metadata extracted from protobuf files and analyzes it to create a structured plan for code generation. It handles:
- Grouping methods by service
- Extracting HTTP routing information
- Determining parameter types and sources
- Planning the structure of generated code
- Extracting managed resources from method return types
§Managed Resources
Services often manage one or more resource types. These resources are automatically extracted from the return types of get, create, and update methods. For example:
message Catalog {
option (google.api.resource) = {
type: "example.io/Catalog"
pattern: "catalogs/{catalog}"
plural: "catalogs"
singular: "catalog"
};
string name = 1;
// ... other fields
}
service CatalogService {
rpc GetCatalog(GetCatalogRequest) returns (Catalog);
rpc CreateCatalog(CreateCatalogRequest) returns (Catalog);
rpc UpdateCatalog(UpdateCatalogRequest) returns (Catalog);
}The analysis will extract that CatalogService manages the Catalog resource,
making this information available for subsequent code generation phases.
Structs§
- Body
Field - A body field that should be extracted from the request body
- Generation
Plan - High-level plan for what code to generate
- Managed
Resource - Information about a resource managed by a service
- Method
Plan - Plan for generating code for a single method
- Path
Param - A path parameter in a URL template
- Query
Param - A query parameter for HTTP requests
- Resource
Hierarchy - Describes one ancestor step in a managed resource’s parent chain, derived from
google.api.resource_reference { child_type }annotations on List request fields. - Service
Plan - Plan for generating code for a single service
- Skipped
Method - A method that was skipped during analysis due to incomplete metadata.
Enums§
- Request
Param - Request
Type - The Operation a method is performing
Functions§
- analyze_
metadata - Analyze collected metadata and create a generation plan.
- extract_
managed_ resources - Extract managed resources from service methods, deduplicating by type name.
- split_
body_ fields - Split body fields from a
MethodPlaninto required and optional subsets.