DevTools Logo

Protocol Buffers AST Explorer

Protocol Buffers AST Explorer

Inspect .proto messages, enums, services and resolved types, with field-number checks, locally.

Runs in your browser
Try an example

.proto source

Messages

Paste a .proto file to explore it

Parsing happens as you type. Nothing leaves your browser.

Paste a .proto source and the explorer parses it into a structured AST: every message with typed, numbered fields; every enum with values; every service with request/response RPC signatures. Field types are resolved against the declared scope so you can tell scalars from message references at a glance. The parsed representation is exportable as JSON — handy for codegen pipelines, docs generation, or diffing schema evolution between versions. Parsing runs via the protobufjs engine, loaded lazily and executed entirely client-side; your schema definitions never leave your device.

Examples

Nested message walk

Input
parseProtobuf('syntax = "proto3"; message Outer { message Inner { int32 value = 1; } Inner inner = 1; }')
Output
{ messages: ["Outer", "Outer.Inner"], nestedMessages: ["Outer.Inner"] }

Outer lists Inner as a nested message and both appear with dotted full names.

Sorted enum plus RPC

Input
parseProtobuf('syntax = "proto3"; enum P { HIGH = 2; LOW = 0; } service S { rpc One (A) returns (B); }')
Output
{ enums: [{ values: [{ LOW: 0 }, { HIGH: 2 }] }], methods: [{ name: "One", requestStream: false }] }

Enum values sort by id and service methods keep request/response types with streaming flags.

About this tool

Protobuf AST Explorer parses .proto sources with parseProtobuf(source) (alias exploreProtobuf): protobufjs compiles the schema with keepCase, then walks the reflection root into sorted messages, enums, and services plus a stable JSON ast of { syntax, package, imports, root }, with imports sorted alphabetically.

Fields resolve to scalar, message, enum, or unknown kinds via SCALAR_TYPES plus root.lookup: message User { Profile profile = 2; } reports kind message with resolvedType demo.Profile, repeated and map flags preserved, and rule defaulting to repeated or optional when protobufjs omits it.

Output is deterministic: messages, enums, and services sort by fullName, nested children sort by name, enum values sort by id then name, and service methods plus namespace JSON sort by method and member name, so repeated parses are byte-identical.

How to use this tool

  1. Paste the schema

    Provide proto2 or proto3 source with syntax, package, messages, enums, and services.

  2. Read resolved fields

    Check each field kind and resolvedType to trace message and enum references.

  3. Walk nesting

    Use nestedMessages and the ast.root tree to follow Outer.Inner style scopes.

  4. Copy stable JSON

    Export the sorted ast for snapshots, docs, or code-review diffs.

Use cases

Reviewing schema changes

Diff sorted messages, fields, and RPCs before merging a .proto update.

Tracing type references

Follow resolvedType links to find which messages depend on a renamed enum.

Documenting services

Export the method map with streaming flags for API docs and client generation.

Common mistakes

Mistake:Expecting declaration order to be preserved.

Fix:Messages, enums, services, and children sort alphabetically — search by fullName instead of position.

Mistake:Reading rule as always present.

Fix:protobufjs may omit rule, so the explorer defaults it to repeated or optional — check repeated and map flags directly.

Mistake:Assuming broken syntax returns empty output.

Fix:Invalid schemas throw protobufjs parse errors — fix the reported illegal or expected token first.

Frequently asked questions

What does this tool do?

It runs parseProtobuf on .proto source with protobufjs, returning sorted messages with field kinds, enums with sorted values, services with RPC streaming flags, and a deterministic ast of syntax, package, imports, and root.

How are field kinds and nesting resolved?

Scalar names map to scalar, root.lookup resolves message and enum targets with dotted resolvedType, and Outer lists Inner in nestedMessages with full names like Outer.Inner.

Is my schema uploaded or stored?

No. Protobuf parsing and tree building run entirely in your browser.

Why did parsing throw, or the order change?

Invalid syntax throws the protobufjs illegal or expected error, and messages, enums, services, and children always sort alphabetically rather than keeping declaration order.

References & standards