Skip to content

Commit 678a995

Browse files
committed
feat: add Elixir module prefix to proto files (#11)
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
1 parent 415fb73 commit 678a995

File tree

6 files changed

+47
-1
lines changed

6 files changed

+47
-1
lines changed

.github/release-please-config.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"packages": {
1111
".": {
1212
"release-type": "simple",
13-
"release-as": "0.1.0",
1413
"bump-minor-pre-major": true,
1514
"bump-patch-for-minor-pre-major": false,
1615
"draft": false,

buf.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ lint:
1111
use:
1212
- STANDARD
1313
disallow_comment_ignores: true
14+
ignore:
15+
- proto/elixirpb.proto
1416

1517
breaking:
1618
use:
1719
- FILE
20+
ignore:
21+
- proto/elixirpb.proto

proto/elixirpb.proto

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// COPIED FROM: https://github.com/elixir-protobuf/protobuf/blob/main/src/elixirpb.proto
2+
3+
// Put this file to elixirpb.proto under PROTO_PATH. See `protoc -h` for `--proto_path` option.
4+
// Then import it
5+
// ````proto
6+
// import "elixirpb.proto";
7+
// ````
8+
//
9+
// 1047 is allocated to this project by Protobuf
10+
// https://github.com/protocolbuffers/protobuf/blob/master/docs/options.md
11+
12+
syntax = "proto2";
13+
14+
package elixirpb;
15+
16+
import "google/protobuf/descriptor.proto";
17+
18+
// File level options
19+
//
20+
// For example,
21+
// option (elixirpb.file).module_prefix = "Foo";
22+
message FileOptions {
23+
// Specify a module prefix. This will override package name.
24+
// For example, the package is "hello" and a message is "Request", the message
25+
// will be "Hello.Request". But with module_prefix "Foo", the message will be
26+
// "Foo.Request"
27+
optional string module_prefix = 1;
28+
}
29+
30+
extend google.protobuf.FileOptions {
31+
optional FileOptions file = 1047;
32+
}

proto/trogon/uuid/v1/namespace.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
syntax = "proto3";
22
package trogon.uuid.v1;
33

4+
import "elixirpb.proto";
5+
6+
option (elixirpb.file).module_prefix = "TrogonProto";
7+
48
// Namespace defines the namespace for UUIDv5 generation.
59
message Namespace {
610
oneof value {

proto/trogon/uuid/v1/options.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
syntax = "proto3";
22
package trogon.uuid.v1;
33

4+
import "elixirpb.proto";
45
import "google/protobuf/descriptor.proto";
56
import "trogon/uuid/v1/namespace.proto";
67

8+
option (elixirpb.file).module_prefix = "TrogonProto";
9+
710
// FileOptions defines file-level options for UUID generation.
811
message FileOptions {
912
// The default namespace for UUIDv5 generation.

proto/trogon/uuid/v1/uuid.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
syntax = "proto3";
22
package trogon.uuid.v1;
33

4+
import "elixirpb.proto";
5+
6+
option (elixirpb.file).module_prefix = "TrogonProto";
7+
48
// Uuid represents a universally unique identifier.
59
//
610
// Use this message type instead of raw strings for type-safe UUID fields.

0 commit comments

Comments
 (0)