Protobuf
Glue supports protobuf as a code generation target, allowing you to generate .proto schemas from Glue models, enums, and services.
Simply run:
#Configuration
You can configure the emitted protobuf package name:
#Example
For this Glue spec:
...generating protobuf...
...will produce:
Enum constants are generated in CONSTANT_CASE from the Glue string values.
Values that normalize to the same Protobuf identifier are rejected because Protobuf enum value names share the package scope.
#Field tags
By default, Glue assigns Protobuf field tags from field declaration order, starting at 1. You do not need to annotate fields for simple or early schemas.
Use @field(proto_tag=<number>) when you need stable Protobuf wire compatibility across field reordering:
If one field in a message has proto_tag, every field in that message must have one. Untagged messages keep source-order numbering.
proto_tag can use folded int constant expressions, including model-scoped constants:
#Optional fields
Optional Glue fields generate optional Protobuf fields:
Protobuf does not track field presence for repeated or map fields, so optional repeated/map Glue fields are emitted as regular repeated and map fields.
#Services
Glue services generate Protobuf service definitions:
#Notes
- Endpoint declarations are ignored by the Protobuf generator.
#Current limitations
Record<K, V>is emitted asmap<K, V>for supported Protobuf key/value types.- Anonymous structs are emitted as generated messages named from the owning field path.
- Unions are emitted as
oneofonly when every member is valid inside a Protobufoneof; repeated fields, maps, optional members, and explicitproto_tagunions are rejected with an error. - RPC
bodyandreturnsmust be message types.