Reference
Reference pages cover exact generated shapes, plugin options, runtime types, and edge cases. Use them when you need a specific behavior. For end-to-end workflows, see Getting started and the guide pages in the sidebar.
Code generation
Section titled “Code generation”- Generated code: file names, message shapes, enum generation, extension descriptors, and service schemas.
- Field types: scalar mappings, message fields, enum fields, repeated fields, map fields, and well-known type field shapes.
- Generated features: oneofs, proto2 groups, required fields, optional fields, services, reserved names, nested types, comments, and packages.
- Plugin options:
target, import extensions, CommonJS output, empty files,ts_nocheck, plugin version elision, JSON types, and Valid types.
Runtime
Section titled “Runtime”- Working with messages:
create(), initializer objects,isMessage(),$typeName, field presence,equals(), andclone(). - Serialization: binary and JSON helpers, options, unknown fields, low-level wire APIs, text encoding, Base64, and size-delimited streams.
- Extensions: defining, setting, reading, mutating, clearing, and serializing extensions.
- Reflection: overview and typed dynamic message patterns.
- Descriptors: descriptor hierarchy, schema traversal, field descriptors, and traversal helpers.
- Registries: descriptor lookup, mutable registries, and file registries from descriptor sets.
- Custom options: defining, using, and reading schema annotations.
- Dynamic messages:
ReflectMessage,ReflectList, andReflectMap. - Well-known types: precompiled
google.protobufexports and convenience helpers forTimestamp,Duration,Any,Struct, wrappers, descriptors, and compiler types.
Plugin authors
Section titled “Plugin authors”- Writing plugins: plugin structure and a minimal runnable plugin.
- Generating files: output files, preambles, printing, imports, exports, name collisions, and CommonJS adaptation.
- Plugin options and release: custom option parsing, transpilation, publishing, and testing.
Type helpers
Section titled “Type helpers”- JSON types: generated JSON types, enum JSON types,
MessageJsonType,EnumJsonType, and plugin imports. - Valid types: experimental generated Valid types for required message-field guarantees.
Migration and troubleshooting
Section titled “Migration and troubleshooting”- Migrating from v1: package updates, changed plugin defaults, schema-based runtime calls, and notable v2 behavior changes.
- FAQ: enum design, 64-bit integers, plugin-option philosophy, resolver issues, generated imports, and determinism.