An option is a setting attached to a schema element: a file, a message, a field, an enum, or a service. The options on this page change what the compiler generates and how data maps to other formats, and they never change the wire format. (Editions features use the same syntax and are an exception. Field presence, for example, changes what gets written.) A file with go_package set and the same file without it encode the same bytes.
The most common ones:
go_packageandjava_package: where the generated Go and Java code goes.optimize_for: trades generated-code size for speed in C++.SPEED,CODE_SIZE, orLITE_RUNTIME.[deprecated = true]: marks a field so generated code warns when it is used.[json_name = "uid"]: changes the key the JSON mapping uses, as the example shows.
The full set lives in descriptor.proto, and the Custom Options page shows how to define your own.
edition = "2024"; option go_package = "github.com/example/v1"; option java_package = "com.example.v1"; option optimize_for = SPEED; message User { string user_id = 1 [json_name = "uid"]; string old_field = 2 [deprecated = true]; }
JSON
{
"uid": "01H8XGJWBWBAQ4",
"oldField": "still serialized"
}Next
Unknown Fields
How Protobuf preserves fields a decoder doesn't recognize, why that keeps old clients compatible with new schemas, and where unknown fields can bite.