Skip to content

Language record

Protobuf

A `.proto` file is indexed as the declarations it makes and the types they name: a package, messages with their fields, enums, oneofs and services with their rpcs each get an identity, nesting is containment, and a field's declared type — or an rpc's request and response — is a reference to the type it names.

.proto · 1 registry id · 5 of 14 relationship types

The registry row this page is generated from

Read at render time from the same family row the register reads, so nothing in this block can disagree with it.

Extensions
.proto
Registry names
protobuf
Recorded symbols
messages · enums · services · fields

Relationship types this analyzer constructs

5 of 14 constructed, read from this analyzer's source and re-derived by the languages gate. Each row below is one of the engine's types, in the engine's own order.

Relationship typeConstructed
callsruled absent
extendsruled absent
implementsruled absent
usesruled absent
importsconstructed by this analyzer
exportsconstructed by this analyzer
containsconstructed by this analyzer
referencesconstructed by this analyzer
overridesconstructed by this analyzer
instantiatesruled absent
decoratesruled absent
rendersruled absent
mixes_inruled absent
part_ofruled absent

5 constructed, 9 not constructed. All 9 absent types are recorded as ruled absent: the written reason and the corpus measurement behind each are in this family's completeness record. The register explains what each label means.

What this analyzer does not resolve

  • extends is deliberately unused, and the reason is the language rather than the analyzer. Proto's extend Foo { … } does not make the block a subclass of Foo; it adds FIELDS to Foo. So the extension block publishes no symbol of its own, its members are emitted with the extended type as their owner and marked viaExtension, and nothing in a schema should be read as an inheritance relationship.
  • Reference resolution is per-file. The specification's own rule is implemented — a leading dot is absolute, anything else resolves from the innermost scope outward, and a forward reference to a message declared later in the file is fine because declarations are collected in a pre-pass — but it resolves against what THIS file declares. A dotted reference whose owner lives in another file falls back to the name as written, which is correct for the fully qualified names real schemas use and is where the 3 unresolved endpoints out of 17,411 relationships across all four pinned corpora come from.
  • A scalar type is a keyword, not a reference, so string and int32 produce no edge; whether a type node names something is decided by whether it holds a message-or-enum type, not by a list of known scalars. And per-field and per-enum-value options are not extracted — option, reserved and extensions ride on the file or the owning message as metadata rather than becoming declarations.

Every line above was written against Protobuf’s own analyzer module and is named against a construct in it, so it can be checked against the source. Nothing here is inherited from a template, or from another language’s page.

Where you meet it in a repository

Recognised by extension — .proto. Everything below is about where those files actually sit in a working repository.

  • A schema is a directory of .proto files under a versioned package path, so acme.billing.v1.Invoice is the real address and the leading v1 is a package segment rather than a kind. Against protobuf's own 108-file reference corpus this analyzer publishes 7,744 symbols and 9,073 relationships with 107 of 108 files clean.
  • A oneof is a symbol and its fields still belong to the message, because a field number lives in the message's space and msg.field is how every protobuf tool refers to them — so the oneof is a union with containment edges to each member, and each member carries the oneof it belongs to.
  • The proto2 group form declares a type AND a field, and both are published under distinct ids: optional group G = 4 { … } gives you pkg.M.G and pkg.M.G#property. A # cannot occur in a protobuf identifier, so no real name can forge the second one — which accounts for all 39 ownership changes measured when this analyzer replaced the grammar it shipped with.

Questions this index answers

Phrased as retrievals, because that is what an index can honestly do: it holds the symbols and the edges between them, and hands them back with the evidence attached.

  1. Which messages, enums, services and oneofs does this file declare?
  2. Which fields does this message have, and which types do they name?
  3. Which operations does this service expose, and what do they take and return?
  4. Which field numbers has this message reserved?

What the analyzer sees in code like this

A package, a message with two fields, and a service with one rpc
package acme.billing;               // bb records: namespace acme.billing

message Invoice {                    // bb records: class Invoice
  string id = 1;                     // bb records: property id — a scalar, so no edge
  repeated Line lines = 2;           // bb records: property lines; uses -> Line
}

service Billing {                    // bb records: interface Billing
  rpc Charge (Invoice) returns (Receipt);   // bb records: method Charge; uses -> Invoice and Receipt
}

Symbols are stored with the file they came from and the bytes they span, so a hit points at a line rather than at a guess. The annotations in the sample are commentary for the reader, not strings the index would store.

Languages that turn up in the same repository

Web, data & config — the count beside each name is how many relationship types that family’s analyzer constructs.

The extensions, registry names, recorded symbols and relationship types above are the parser registry row for Protobuf, read while the page rendered — the same row the register reads, so the two surfaces cannot tell two stories. Every relationship type listed as constructed appears in src/ast/real-*, the analyzer modules bb ships. bb 0.1.0 answers from a local store over 50 languages (53 registry ids, three of them aliases). There is no benchmark on this page: every claim here is one you can go and read in the source.