Skip to content

Commit 9550e58

Browse files
btkostnerwhatyouhidev0idpwn
authored
Generate Google modules (#353)
Co-authored-by: Andrea Leopardi <[email protected]> Co-authored-by: v0idpwn <[email protected]>
1 parent 18ad14f commit 9550e58

File tree

11 files changed

+178
-10
lines changed

11 files changed

+178
-10
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ The package can be installed by adding `:protobuf` to your list of dependencies
2222
```elixir
2323
def deps do
2424
[
25-
{:protobuf, "~> 0.10.0"},
26-
# Only for files generated from Google's protos.
27-
# Can be ignored if you don't use Google's protos.
28-
# Or you can generate the code by yourself.
29-
{:google_protos, "~> 0.1"}
25+
{:protobuf, "~> 0.13.0"}
3026
]
3127
end
3228
```
3329

30+
### Google Protos
31+
32+
Since `:protobuf` version `0.13.0` we include all of the well known Google Protobuf modules. This conflicts with the deprecated `:google_protos` package. Please remove the `:google_protos` package from your dependencies and run `mix deps.unlock --unused`.
33+
3434
## Features
3535

3636
* Define messages with DSL

lib/elixirpb.pb.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule Elixirpb.FileOptions do
22
@moduledoc false
33

4-
use Protobuf, syntax: :proto2, protoc_gen_elixir_version: "0.13.0"
4+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto2
55

66
field :module_prefix, 1, optional: true, type: :string
77
end

lib/google/protobuf/any.pb.ex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
defmodule Google.Protobuf.Any do
2+
@moduledoc false
3+
4+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
5+
6+
field :type_url, 1, type: :string, json_name: "typeUrl"
7+
field :value, 2, type: :bytes
8+
end

lib/google/protobuf/compiler/plugin.pb.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule Google.Protobuf.Compiler.CodeGeneratorResponse.Feature do
22
@moduledoc false
33

4-
use Protobuf, enum: true, syntax: :proto2, protoc_gen_elixir_version: "0.13.0"
4+
use Protobuf, enum: true, protoc_gen_elixir_version: "0.13.0", syntax: :proto2
55

66
field :FEATURE_NONE, 0
77
field :FEATURE_PROTO3_OPTIONAL, 1

lib/google/protobuf/duration.pb.ex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
defmodule Google.Protobuf.Duration do
2+
@moduledoc false
3+
4+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
5+
6+
field :seconds, 1, type: :int64
7+
field :nanos, 2, type: :int32
8+
end

lib/google/protobuf/empty.pb.ex

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
defmodule Google.Protobuf.Empty do
2+
@moduledoc false
3+
4+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
5+
end

lib/google/protobuf/field_mask.pb.ex

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
defmodule Google.Protobuf.FieldMask do
2+
@moduledoc false
3+
4+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
5+
6+
field :paths, 1, repeated: true, type: :string
7+
end

lib/google/protobuf/struct.pb.ex

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
defmodule Google.Protobuf.NullValue do
2+
@moduledoc false
3+
4+
use Protobuf, enum: true, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
5+
6+
field :NULL_VALUE, 0
7+
end
8+
9+
defmodule Google.Protobuf.Struct.FieldsEntry do
10+
@moduledoc false
11+
12+
use Protobuf, map: true, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
13+
14+
field :key, 1, type: :string
15+
field :value, 2, type: Google.Protobuf.Value
16+
end
17+
18+
defmodule Google.Protobuf.Struct do
19+
@moduledoc false
20+
21+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
22+
23+
field :fields, 1, repeated: true, type: Google.Protobuf.Struct.FieldsEntry, map: true
24+
end
25+
26+
defmodule Google.Protobuf.Value do
27+
@moduledoc false
28+
29+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
30+
31+
oneof :kind, 0
32+
33+
field :null_value, 1,
34+
type: Google.Protobuf.NullValue,
35+
json_name: "nullValue",
36+
enum: true,
37+
oneof: 0
38+
39+
field :number_value, 2, type: :double, json_name: "numberValue", oneof: 0
40+
field :string_value, 3, type: :string, json_name: "stringValue", oneof: 0
41+
field :bool_value, 4, type: :bool, json_name: "boolValue", oneof: 0
42+
field :struct_value, 5, type: Google.Protobuf.Struct, json_name: "structValue", oneof: 0
43+
field :list_value, 6, type: Google.Protobuf.ListValue, json_name: "listValue", oneof: 0
44+
end
45+
46+
defmodule Google.Protobuf.ListValue do
47+
@moduledoc false
48+
49+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
50+
51+
field :values, 1, repeated: true, type: Google.Protobuf.Value
52+
end

lib/google/protobuf/timestamp.pb.ex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
defmodule Google.Protobuf.Timestamp do
2+
@moduledoc false
3+
4+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
5+
6+
field :seconds, 1, type: :int64
7+
field :nanos, 2, type: :int32
8+
end

lib/google/protobuf/wrappers.pb.ex

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
defmodule Google.Protobuf.DoubleValue do
2+
@moduledoc false
3+
4+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
5+
6+
field :value, 1, type: :double
7+
end
8+
9+
defmodule Google.Protobuf.FloatValue do
10+
@moduledoc false
11+
12+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
13+
14+
field :value, 1, type: :float
15+
end
16+
17+
defmodule Google.Protobuf.Int64Value do
18+
@moduledoc false
19+
20+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
21+
22+
field :value, 1, type: :int64
23+
end
24+
25+
defmodule Google.Protobuf.UInt64Value do
26+
@moduledoc false
27+
28+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
29+
30+
field :value, 1, type: :uint64
31+
end
32+
33+
defmodule Google.Protobuf.Int32Value do
34+
@moduledoc false
35+
36+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
37+
38+
field :value, 1, type: :int32
39+
end
40+
41+
defmodule Google.Protobuf.UInt32Value do
42+
@moduledoc false
43+
44+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
45+
46+
field :value, 1, type: :uint32
47+
end
48+
49+
defmodule Google.Protobuf.BoolValue do
50+
@moduledoc false
51+
52+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
53+
54+
field :value, 1, type: :bool
55+
end
56+
57+
defmodule Google.Protobuf.StringValue do
58+
@moduledoc false
59+
60+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
61+
62+
field :value, 1, type: :string
63+
end
64+
65+
defmodule Google.Protobuf.BytesValue do
66+
@moduledoc false
67+
68+
use Protobuf, protoc_gen_elixir_version: "0.13.0", syntax: :proto3
69+
70+
field :value, 1, type: :bytes
71+
end

0 commit comments

Comments
 (0)