diff --git a/docs/explanation/protobuf-extension-naming.md b/docs/explanation/protobuf-extension-naming.md index c76b55b..5f80a33 100644 --- a/docs/explanation/protobuf-extension-naming.md +++ b/docs/explanation/protobuf-extension-naming.md @@ -86,7 +86,8 @@ Claim your extension numbers here to prevent conflicts: | 870001 | trogon.uuid.v1 | google.protobuf.EnumOptions | | 870002 | trogon.uuid.v1 | google.protobuf.EnumValueOptions | | 870010 | trogon.object_id.v1alpha1 | google.protobuf.EnumValueOptions | -| 870011–870999 | *Available* | — | +| 870011 | trogon.stream.v1alpha1 | google.protobuf.EnumValueOptions | +| 870012–870999 | *Available* | — | ## Examples in This Repo @@ -99,6 +100,9 @@ trogon/uuid/v1/options.proto trogon/object_id/v1alpha1/options.proto └─ EnumValueOptions { object_type, separator } → enum_value (870010) + +trogon/stream/v1alpha1/options.proto +└─ EnumValueOptions { prefix, separator } → enum_value (870011) ``` ## Field Number Ranges diff --git a/proto/trogon/stream/v1alpha1/options.proto b/proto/trogon/stream/v1alpha1/options.proto new file mode 100644 index 0000000..7791ff8 --- /dev/null +++ b/proto/trogon/stream/v1alpha1/options.proto @@ -0,0 +1,39 @@ +syntax = "proto3"; +package trogon.stream.v1alpha1; + +import "elixirpb.proto"; +import "google/protobuf/descriptor.proto"; + +option (elixirpb.file).module_prefix = "TrogonProto.Stream.V1Alpha1"; + +// EnumValueOptions defines enum-value-level options for stream identity prefixes. +message EnumValueOptions { + // The stream prefix for this aggregate (e.g., "order", "account", "fanid"). + string prefix = 1; + + // Separator between prefix and identity value. Defaults to ":" if not set. + optional string separator = 2; +} + +extend google.protobuf.EnumValueOptions { + // enum_value specifies the stream identity prefix for an enum value. + // + // Example usage: + // + // // acme/type/v1/stream_prefix.proto + // syntax = "proto3"; + // package acme.type.v1; + // + // import "trogon/stream/v1alpha1/options.proto"; + // + // enum StreamPrefix { + // STREAM_PREFIX_UNSPECIFIED = 0; + // STREAM_PREFIX_ORDER = 1 [(trogon.stream.v1alpha1.enum_value).prefix = "order"]; + // STREAM_PREFIX_ACCOUNT = 2 [(trogon.stream.v1alpha1.enum_value) = { + // prefix: "account", + // separator: "-" + // }]; + // } + // + optional EnumValueOptions enum_value = 870011; +}