diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 3af3cc8..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "protobuf"] - path = examples/helloworld/protobuf - url = https://github.com/protocolbuffers/protobuf.git diff --git a/README.md b/README.md index 7bdadc3..8cfa677 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,11 @@ # GrpcReflection -GrpcReclection is a grpc server built using `grpc-elixir`. This server adds grpc reflection support to a `grpc-elixir` based application. +Server reflection allows servers to assist clients in runtime construction of requests without having stub information precompiled into the client. + +Accoring to the [GRPC Server Reflection Protocol +](https://github.com/grpc/grpc/blob/master/doc/server-reflection.md), the primary usecase for server reflection is to write (typically) command line debugging tools for talking to a grpc server. In particular, such a tool will take in a method and a payload (in human readable text format) send it to the server (typically in binary proto wire format), and then take the response and decode it to text to present to the user. + +GrpcReflection, implemented as a gRPC server using `grpc-elixir`, adds reflection support to a `grpc-elixir` based application. ## Installation @@ -21,7 +26,7 @@ be found at . # Reflection -This is written and tested using grpcurl and postman. It supports both v1alpha and v1 reflection by using one or both of the provided servers: `rpcReflection.V1.Server` or `rpcReflection.V1alpha.Server` +This is written and tested using [grpcurl](https://github.com/fullstorydev/grpcurl) and postman. It supports both v1alpha and v1 reflection by using one or both of the provided servers: `rpcReflection.V1.Server` or `rpcReflection.V1alpha.Server` ## Enable reflection on your application @@ -74,6 +79,12 @@ message HelloReply { optional string message = 1; optional .google.protobuf.Timestamp today = 2; } + +$ grpcurl -plaintext -format text -d 'name: "faker"' localhost:50051 helloworld.Greeter.SayHello +message: "Hello faker" +today: < + seconds:1708412184 nanos:671267628 +> ``` ## Protobuf Version Support diff --git a/examples/helloworld/README.md b/examples/helloworld/README.md index d66611d..720cc1e 100644 --- a/examples/helloworld/README.md +++ b/examples/helloworld/README.md @@ -8,11 +8,6 @@ This example is mostly copied directly from `grpc-elixir`, with the exception th ## Usage -1. Fetch Protobuf Dependencies -```shell -git submodule init -``` - 1. Install deps and compile ```shell $ mix do deps.get, compile @@ -52,6 +47,12 @@ message HelloReply { optional string message = 1; optional .google.protobuf.Timestamp today = 2; } + +$ grpcurl -plaintext -format text -d 'name: "faker"' localhost:50051 helloworld.Greeter.SayHello +message: "Hello faker" +today: < + seconds:1708412184 nanos:671267628 +> ``` ## Regenerate Elixir code from proto diff --git a/examples/helloworld/generate_protos.sh b/examples/helloworld/generate_protos.sh index 9b92d7c..301db28 100755 --- a/examples/helloworld/generate_protos.sh +++ b/examples/helloworld/generate_protos.sh @@ -3,20 +3,6 @@ rm -rf ./lib/protos mkdir ./lib/protos -GOOGLE_PROTOS=(" - protobuf/src/google/protobuf/any.proto - protobuf/src/google/protobuf/duration.proto - protobuf/src/google/protobuf/empty.proto - protobuf/src/google/protobuf/field_mask.proto - protobuf/src/google/protobuf/struct.proto - protobuf/src/google/protobuf/timestamp.proto - protobuf/src/google/protobuf/wrappers.proto -") - -for file in $GOOGLE_PROTOS; do - protoc --elixir_opt=include_docs=true --elixir_out=plugins=grpc,gen_descriptors=true:./lib/protos --proto_path=protobuf/src/ $file -done - PROTOS=(" priv/protos/helloworld.proto ") diff --git a/examples/helloworld/mix.lock b/examples/helloworld/mix.lock index 32310dc..50c08f3 100644 --- a/examples/helloworld/mix.lock +++ b/examples/helloworld/mix.lock @@ -3,7 +3,7 @@ "cowlib": {:hex, :cowlib, "2.12.1", "a9fa9a625f1d2025fe6b462cb865881329b5caff8f1854d1cbc9f9533f00e1e1", [:make, :rebar3], [], "hexpm", "163b73f6367a7341b33c794c4e88e7dbfe6498ac42dcd69ef44c5bc5507c8db0"}, "dialyxir": {:hex, :dialyxir, "1.4.2", "764a6e8e7a354f0ba95d58418178d486065ead1f69ad89782817c296d0d746a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "516603d8067b2fd585319e4b13d3674ad4f314a5902ba8130cd97dc902ce6bbd"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, - "google_protos": {:hex, :google_protos, "0.3.0", "15faf44dce678ac028c289668ff56548806e313e4959a3aaf4f6e1ebe8db83f4", [:mix], [{:protobuf, "~> 0.10", [hex: :protobuf, repo: "hexpm", optional: false]}], "hexpm", "1f6b7fb20371f72f418b98e5e48dae3e022a9a6de1858d4b254ac5a5d0b4035f"}, + "google_protos": {:hex, :google_protos, "0.4.0", "93e1be2c1a07517ffed761f69047776caf35e4acd385aac4f5ce4fedd07f3660", [:mix], [{:protobuf, "~> 0.10", [hex: :protobuf, repo: "hexpm", optional: false]}], "hexpm", "4c54983d78761a3643e2198adf0f5d40a5a8b08162f3fc91c50faa257f3fa19f"}, "grpc": {:hex, :grpc, "0.7.0", "a86eab356b0b84406b526786a947ca50e9b9eae87108c873b51e321f8a71e8ed", [:mix], [{:cowboy, "~> 2.10", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowlib, "~> 2.12", [hex: :cowlib, repo: "hexpm", optional: false]}, {:gun, "~> 2.0", [hex: :gun, repo: "hexpm", optional: false]}, {:mint, "~> 1.5", [hex: :mint, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "632a9507da8d3c12b112b197db4d60da3c95bad02594d37711eeb622d032f254"}, "gun": {:hex, :gun, "2.0.1", "160a9a5394800fcba41bc7e6d421295cf9a7894c2252c0678244948e3336ad73", [:make, :rebar3], [{:cowlib, "2.12.1", [hex: :cowlib, repo: "hexpm", optional: false]}], "hexpm", "a10bc8d6096b9502205022334f719cc9a08d9adcfbfc0dbee9ef31b56274a20b"}, "hpax": {:hex, :hpax, "0.1.2", "09a75600d9d8bbd064cdd741f21fc06fc1f4cf3d0fcc335e5aa19be1a7235c84", [:mix], [], "hexpm", "2c87843d5a23f5f16748ebe77969880e29809580efdaccd615cd3bed628a8c13"}, diff --git a/examples/helloworld/protobuf b/examples/helloworld/protobuf deleted file mode 160000 index ecc2bac..0000000 --- a/examples/helloworld/protobuf +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ecc2bac63875b4291900f73dfe2c1f836c5b53b6 diff --git a/lib/grpc_reflection/server.ex b/lib/grpc_reflection/server.ex index b820ccd..7e4b1de 100644 --- a/lib/grpc_reflection/server.ex +++ b/lib/grpc_reflection/server.ex @@ -35,7 +35,8 @@ defmodule GrpcReflection.Server do @doc """ Get the reflection reponse containing the given symbol, if it is exposed by a configured service """ - @spec get_by_symbol(binary()) :: {:ok, GrpcReflection.descriptor_t()} | {:error, binary} + @spec get_by_symbol(binary()) :: + {:ok, GrpcReflection.Server.descriptor_t()} | {:error, binary} def get_by_symbol(symbol) do Service.get_by_symbol(@cfg, symbol) end @@ -43,7 +44,8 @@ defmodule GrpcReflection.Server do @doc """ Get the reflection response for the named file, if it is exposed by a configured service """ - @spec get_by_filename(binary()) :: {:ok, GrpcReflection.descriptor_t()} | {:error, binary} + @spec get_by_filename(binary()) :: + {:ok, GrpcReflection.Server.descriptor_t()} | {:error, binary} def get_by_filename(filename) do Service.get_by_filename(@cfg, filename) end @@ -51,7 +53,7 @@ defmodule GrpcReflection.Server do @doc """ Get the extension numbers for the given type, if it is exposed by a configured service """ - @spec get_extension_numbers_by_type(module()) :: {:ok, list(integer())} | {:error, binary} + @spec get_extension_numbers_by_type(binary()) :: {:ok, list(integer())} | {:error, binary} def get_extension_numbers_by_type(mod) do Service.get_extension_numbers_by_type(@cfg, mod) end @@ -59,7 +61,8 @@ defmodule GrpcReflection.Server do @doc """ Get the reflection response for the given extension, if it is exposed by a configured service """ - @spec get_by_extension(binary()) :: {:ok, GrpcReflection.descriptor_t()} | {:error, binary} + @spec get_by_extension(binary()) :: + {:ok, GrpcReflection.Server.descriptor_t()} | {:error, binary} def get_by_extension(containing_type) do Service.get_by_extension(@cfg, containing_type) end diff --git a/mix.exs b/mix.exs index f25c564..77c577b 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,8 @@ defmodule GrpcReflection.MixProject do use Mix.Project - @version "0.1.0" + @version "0.1.1" + @source_url "https://github.com/elixir-grpc/grpc-reflection" @description "gRPC reflection server for Elixir" def project do @@ -14,10 +15,10 @@ defmodule GrpcReflection.MixProject do start_permanent: Mix.env() == :prod, deps: deps(), package: package(), + docs: docs(), aliases: aliases(), test_coverage: [ ignore_modules: [ - ~r/^Google\./, ~r/^Grpc\./, ~r/^Helloworld\./, ~r/^TestserviceV2\./, @@ -42,7 +43,8 @@ defmodule GrpcReflection.MixProject do {:credo, "~> 1.7", only: [:dev, :test], runtime: false}, {:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false}, {:grpc, "~> 0.7"}, - {:protobuf, "~> 0.11"} + {:protobuf, "~> 0.11"}, + {:google_protos, "~> 0.4.0"} ] end @@ -96,8 +98,20 @@ defmodule GrpcReflection.MixProject do %{ name: "grpc_reflection", files: ~w(.formatter.exs mix.exs lib), - links: %{"GitHub" => "https://github.com/elixir-grpc/grpc-reflection"}, + links: %{"GitHub" => @source_url}, licenses: ["Apache-2.0"] } end + + defp docs do + [ + extras: [ + "README.md": [title: "Overview"] + ], + main: "readme", + source_url: @source_url, + source_ref: "#{@version}", + formatters: ["html"] + ] + end end diff --git a/mix.lock b/mix.lock index f5c680a..8a81f0d 100644 --- a/mix.lock +++ b/mix.lock @@ -6,6 +6,7 @@ "dialyxir": {:hex, :dialyxir, "1.4.2", "764a6e8e7a354f0ba95d58418178d486065ead1f69ad89782817c296d0d746a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "516603d8067b2fd585319e4b13d3674ad4f314a5902ba8130cd97dc902ce6bbd"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, + "google_protos": {:hex, :google_protos, "0.4.0", "93e1be2c1a07517ffed761f69047776caf35e4acd385aac4f5ce4fedd07f3660", [:mix], [{:protobuf, "~> 0.10", [hex: :protobuf, repo: "hexpm", optional: false]}], "hexpm", "4c54983d78761a3643e2198adf0f5d40a5a8b08162f3fc91c50faa257f3fa19f"}, "grpc": {:hex, :grpc, "0.7.0", "a86eab356b0b84406b526786a947ca50e9b9eae87108c873b51e321f8a71e8ed", [:mix], [{:cowboy, "~> 2.10", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowlib, "~> 2.12", [hex: :cowlib, repo: "hexpm", optional: false]}, {:gun, "~> 2.0", [hex: :gun, repo: "hexpm", optional: false]}, {:mint, "~> 1.5", [hex: :mint, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "632a9507da8d3c12b112b197db4d60da3c95bad02594d37711eeb622d032f254"}, "gun": {:hex, :gun, "2.0.1", "160a9a5394800fcba41bc7e6d421295cf9a7894c2252c0678244948e3336ad73", [:make, :rebar3], [{:cowlib, "2.12.1", [hex: :cowlib, repo: "hexpm", optional: false]}], "hexpm", "a10bc8d6096b9502205022334f719cc9a08d9adcfbfc0dbee9ef31b56274a20b"}, "hpax": {:hex, :hpax, "0.1.2", "09a75600d9d8bbd064cdd741f21fc06fc1f4cf3d0fcc335e5aa19be1a7235c84", [:mix], [], "hexpm", "2c87843d5a23f5f16748ebe77969880e29809580efdaccd615cd3bed628a8c13"}, diff --git a/test/support/protos/google/protobuf/any.pb.ex b/test/support/protos/google/protobuf/any.pb.ex deleted file mode 100644 index ca28478..0000000 --- a/test/support/protos/google/protobuf/any.pb.ex +++ /dev/null @@ -1,54 +0,0 @@ -defmodule Google.Protobuf.Any do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 - - def descriptor do - # credo:disable-for-next-line - %Google.Protobuf.DescriptorProto{ - name: "Any", - field: [ - %Google.Protobuf.FieldDescriptorProto{ - name: "type_url", - extendee: nil, - number: 1, - label: :LABEL_OPTIONAL, - type: :TYPE_STRING, - type_name: nil, - default_value: nil, - options: nil, - oneof_index: nil, - json_name: "typeUrl", - proto3_optional: nil, - __unknown_fields__: [] - }, - %Google.Protobuf.FieldDescriptorProto{ - name: "value", - extendee: nil, - number: 2, - label: :LABEL_OPTIONAL, - type: :TYPE_BYTES, - type_name: nil, - default_value: nil, - options: nil, - oneof_index: nil, - json_name: "value", - proto3_optional: nil, - __unknown_fields__: [] - } - ], - nested_type: [], - enum_type: [], - extension_range: [], - extension: [], - options: nil, - oneof_decl: [], - reserved_range: [], - reserved_name: [], - __unknown_fields__: [] - } - end - - field :type_url, 1, type: :string, json_name: "typeUrl" - field :value, 2, type: :bytes -end \ No newline at end of file diff --git a/test/support/protos/google/protobuf/duration.pb.ex b/test/support/protos/google/protobuf/duration.pb.ex deleted file mode 100644 index f4003d1..0000000 --- a/test/support/protos/google/protobuf/duration.pb.ex +++ /dev/null @@ -1,54 +0,0 @@ -defmodule Google.Protobuf.Duration do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 - - def descriptor do - # credo:disable-for-next-line - %Google.Protobuf.DescriptorProto{ - name: "Duration", - field: [ - %Google.Protobuf.FieldDescriptorProto{ - name: "seconds", - extendee: nil, - number: 1, - label: :LABEL_OPTIONAL, - type: :TYPE_INT64, - type_name: nil, - default_value: nil, - options: nil, - oneof_index: nil, - json_name: "seconds", - proto3_optional: nil, - __unknown_fields__: [] - }, - %Google.Protobuf.FieldDescriptorProto{ - name: "nanos", - extendee: nil, - number: 2, - label: :LABEL_OPTIONAL, - type: :TYPE_INT32, - type_name: nil, - default_value: nil, - options: nil, - oneof_index: nil, - json_name: "nanos", - proto3_optional: nil, - __unknown_fields__: [] - } - ], - nested_type: [], - enum_type: [], - extension_range: [], - extension: [], - options: nil, - oneof_decl: [], - reserved_range: [], - reserved_name: [], - __unknown_fields__: [] - } - end - - field :seconds, 1, type: :int64 - field :nanos, 2, type: :int32 -end \ No newline at end of file diff --git a/test/support/protos/google/protobuf/empty.pb.ex b/test/support/protos/google/protobuf/empty.pb.ex deleted file mode 100644 index 087aa74..0000000 --- a/test/support/protos/google/protobuf/empty.pb.ex +++ /dev/null @@ -1,22 +0,0 @@ -defmodule Google.Protobuf.Empty do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 - - def descriptor do - # credo:disable-for-next-line - %Google.Protobuf.DescriptorProto{ - name: "Empty", - field: [], - nested_type: [], - enum_type: [], - extension_range: [], - extension: [], - options: nil, - oneof_decl: [], - reserved_range: [], - reserved_name: [], - __unknown_fields__: [] - } - end -end \ No newline at end of file diff --git a/test/support/protos/google/protobuf/field_mask.pb.ex b/test/support/protos/google/protobuf/field_mask.pb.ex deleted file mode 100644 index 171c566..0000000 --- a/test/support/protos/google/protobuf/field_mask.pb.ex +++ /dev/null @@ -1,39 +0,0 @@ -defmodule Google.Protobuf.FieldMask do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 - - def descriptor do - # credo:disable-for-next-line - %Google.Protobuf.DescriptorProto{ - name: "FieldMask", - field: [ - %Google.Protobuf.FieldDescriptorProto{ - name: "paths", - extendee: nil, - number: 1, - label: :LABEL_REPEATED, - type: :TYPE_STRING, - type_name: nil, - default_value: nil, - options: nil, - oneof_index: nil, - json_name: "paths", - proto3_optional: nil, - __unknown_fields__: [] - } - ], - nested_type: [], - enum_type: [], - extension_range: [], - extension: [], - options: nil, - oneof_decl: [], - reserved_range: [], - reserved_name: [], - __unknown_fields__: [] - } - end - - field :paths, 1, repeated: true, type: :string -end \ No newline at end of file diff --git a/test/support/protos/google/protobuf/struct.pb.ex b/test/support/protos/google/protobuf/struct.pb.ex deleted file mode 100644 index 69a8d41..0000000 --- a/test/support/protos/google/protobuf/struct.pb.ex +++ /dev/null @@ -1,346 +0,0 @@ -defmodule Google.Protobuf.NullValue do - @moduledoc false - - use Protobuf, enum: true, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 - - def descriptor do - # credo:disable-for-next-line - %Google.Protobuf.EnumDescriptorProto{ - name: "NullValue", - value: [ - %Google.Protobuf.EnumValueDescriptorProto{ - name: "NULL_VALUE", - number: 0, - options: nil, - __unknown_fields__: [] - } - ], - options: nil, - reserved_range: [], - reserved_name: [], - __unknown_fields__: [] - } - end - - field :NULL_VALUE, 0 -end - -defmodule Google.Protobuf.Struct.FieldsEntry do - @moduledoc false - - use Protobuf, map: true, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 - - def descriptor do - # credo:disable-for-next-line - %Google.Protobuf.DescriptorProto{ - name: "FieldsEntry", - field: [ - %Google.Protobuf.FieldDescriptorProto{ - name: "key", - extendee: nil, - number: 1, - label: :LABEL_OPTIONAL, - type: :TYPE_STRING, - type_name: nil, - default_value: nil, - options: nil, - oneof_index: nil, - json_name: "key", - proto3_optional: nil, - __unknown_fields__: [] - }, - %Google.Protobuf.FieldDescriptorProto{ - name: "value", - extendee: nil, - number: 2, - label: :LABEL_OPTIONAL, - type: :TYPE_MESSAGE, - type_name: ".google.protobuf.Value", - default_value: nil, - options: nil, - oneof_index: nil, - json_name: "value", - proto3_optional: nil, - __unknown_fields__: [] - } - ], - nested_type: [], - enum_type: [], - extension_range: [], - extension: [], - options: %Google.Protobuf.MessageOptions{ - message_set_wire_format: false, - no_standard_descriptor_accessor: false, - deprecated: false, - map_entry: true, - deprecated_legacy_json_field_conflicts: nil, - uninterpreted_option: [], - __pb_extensions__: %{}, - __unknown_fields__: [] - }, - oneof_decl: [], - reserved_range: [], - reserved_name: [], - __unknown_fields__: [] - } - end - - field :key, 1, type: :string - field :value, 2, type: Google.Protobuf.Value -end - -defmodule Google.Protobuf.Struct do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 - - def descriptor do - # credo:disable-for-next-line - %Google.Protobuf.DescriptorProto{ - name: "Struct", - field: [ - %Google.Protobuf.FieldDescriptorProto{ - name: "fields", - extendee: nil, - number: 1, - label: :LABEL_REPEATED, - type: :TYPE_MESSAGE, - type_name: ".google.protobuf.Struct.FieldsEntry", - default_value: nil, - options: nil, - oneof_index: nil, - json_name: "fields", - proto3_optional: nil, - __unknown_fields__: [] - } - ], - nested_type: [ - %Google.Protobuf.DescriptorProto{ - name: "FieldsEntry", - field: [ - %Google.Protobuf.FieldDescriptorProto{ - name: "key", - extendee: nil, - number: 1, - label: :LABEL_OPTIONAL, - type: :TYPE_STRING, - type_name: nil, - default_value: nil, - options: nil, - oneof_index: nil, - json_name: "key", - proto3_optional: nil, - __unknown_fields__: [] - }, - %Google.Protobuf.FieldDescriptorProto{ - name: "value", - extendee: nil, - number: 2, - label: :LABEL_OPTIONAL, - type: :TYPE_MESSAGE, - type_name: ".google.protobuf.Value", - default_value: nil, - options: nil, - oneof_index: nil, - json_name: "value", - proto3_optional: nil, - __unknown_fields__: [] - } - ], - nested_type: [], - enum_type: [], - extension_range: [], - extension: [], - options: %Google.Protobuf.MessageOptions{ - message_set_wire_format: false, - no_standard_descriptor_accessor: false, - deprecated: false, - map_entry: true, - deprecated_legacy_json_field_conflicts: nil, - uninterpreted_option: [], - __pb_extensions__: %{}, - __unknown_fields__: [] - }, - oneof_decl: [], - reserved_range: [], - reserved_name: [], - __unknown_fields__: [] - } - ], - enum_type: [], - extension_range: [], - extension: [], - options: nil, - oneof_decl: [], - reserved_range: [], - reserved_name: [], - __unknown_fields__: [] - } - end - - field :fields, 1, repeated: true, type: Google.Protobuf.Struct.FieldsEntry, map: true -end - -defmodule Google.Protobuf.Value do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 - - def descriptor do - # credo:disable-for-next-line - %Google.Protobuf.DescriptorProto{ - name: "Value", - field: [ - %Google.Protobuf.FieldDescriptorProto{ - name: "null_value", - extendee: nil, - number: 1, - label: :LABEL_OPTIONAL, - type: :TYPE_ENUM, - type_name: ".google.protobuf.NullValue", - default_value: nil, - options: nil, - oneof_index: 0, - json_name: "nullValue", - proto3_optional: nil, - __unknown_fields__: [] - }, - %Google.Protobuf.FieldDescriptorProto{ - name: "number_value", - extendee: nil, - number: 2, - label: :LABEL_OPTIONAL, - type: :TYPE_DOUBLE, - type_name: nil, - default_value: nil, - options: nil, - oneof_index: 0, - json_name: "numberValue", - proto3_optional: nil, - __unknown_fields__: [] - }, - %Google.Protobuf.FieldDescriptorProto{ - name: "string_value", - extendee: nil, - number: 3, - label: :LABEL_OPTIONAL, - type: :TYPE_STRING, - type_name: nil, - default_value: nil, - options: nil, - oneof_index: 0, - json_name: "stringValue", - proto3_optional: nil, - __unknown_fields__: [] - }, - %Google.Protobuf.FieldDescriptorProto{ - name: "bool_value", - extendee: nil, - number: 4, - label: :LABEL_OPTIONAL, - type: :TYPE_BOOL, - type_name: nil, - default_value: nil, - options: nil, - oneof_index: 0, - json_name: "boolValue", - proto3_optional: nil, - __unknown_fields__: [] - }, - %Google.Protobuf.FieldDescriptorProto{ - name: "struct_value", - extendee: nil, - number: 5, - label: :LABEL_OPTIONAL, - type: :TYPE_MESSAGE, - type_name: ".google.protobuf.Struct", - default_value: nil, - options: nil, - oneof_index: 0, - json_name: "structValue", - proto3_optional: nil, - __unknown_fields__: [] - }, - %Google.Protobuf.FieldDescriptorProto{ - name: "list_value", - extendee: nil, - number: 6, - label: :LABEL_OPTIONAL, - type: :TYPE_MESSAGE, - type_name: ".google.protobuf.ListValue", - default_value: nil, - options: nil, - oneof_index: 0, - json_name: "listValue", - proto3_optional: nil, - __unknown_fields__: [] - } - ], - nested_type: [], - enum_type: [], - extension_range: [], - extension: [], - options: nil, - oneof_decl: [ - %Google.Protobuf.OneofDescriptorProto{name: "kind", options: nil, __unknown_fields__: []} - ], - reserved_range: [], - reserved_name: [], - __unknown_fields__: [] - } - end - - oneof :kind, 0 - - field :null_value, 1, - type: Google.Protobuf.NullValue, - json_name: "nullValue", - enum: true, - oneof: 0 - - field :number_value, 2, type: :double, json_name: "numberValue", oneof: 0 - field :string_value, 3, type: :string, json_name: "stringValue", oneof: 0 - field :bool_value, 4, type: :bool, json_name: "boolValue", oneof: 0 - field :struct_value, 5, type: Google.Protobuf.Struct, json_name: "structValue", oneof: 0 - field :list_value, 6, type: Google.Protobuf.ListValue, json_name: "listValue", oneof: 0 -end - -defmodule Google.Protobuf.ListValue do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 - - def descriptor do - # credo:disable-for-next-line - %Google.Protobuf.DescriptorProto{ - name: "ListValue", - field: [ - %Google.Protobuf.FieldDescriptorProto{ - name: "values", - extendee: nil, - number: 1, - label: :LABEL_REPEATED, - type: :TYPE_MESSAGE, - type_name: ".google.protobuf.Value", - default_value: nil, - options: nil, - oneof_index: nil, - json_name: "values", - proto3_optional: nil, - __unknown_fields__: [] - } - ], - nested_type: [], - enum_type: [], - extension_range: [], - extension: [], - options: nil, - oneof_decl: [], - reserved_range: [], - reserved_name: [], - __unknown_fields__: [] - } - end - - field :values, 1, repeated: true, type: Google.Protobuf.Value -end \ No newline at end of file diff --git a/test/support/protos/google/protobuf/timestamp.pb.ex b/test/support/protos/google/protobuf/timestamp.pb.ex deleted file mode 100644 index b2bad1e..0000000 --- a/test/support/protos/google/protobuf/timestamp.pb.ex +++ /dev/null @@ -1,54 +0,0 @@ -defmodule Google.Protobuf.Timestamp do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 - - def descriptor do - # credo:disable-for-next-line - %Google.Protobuf.DescriptorProto{ - name: "Timestamp", - field: [ - %Google.Protobuf.FieldDescriptorProto{ - name: "seconds", - extendee: nil, - number: 1, - label: :LABEL_OPTIONAL, - type: :TYPE_INT64, - type_name: nil, - default_value: nil, - options: nil, - oneof_index: nil, - json_name: "seconds", - proto3_optional: nil, - __unknown_fields__: [] - }, - %Google.Protobuf.FieldDescriptorProto{ - name: "nanos", - extendee: nil, - number: 2, - label: :LABEL_OPTIONAL, - type: :TYPE_INT32, - type_name: nil, - default_value: nil, - options: nil, - oneof_index: nil, - json_name: "nanos", - proto3_optional: nil, - __unknown_fields__: [] - } - ], - nested_type: [], - enum_type: [], - extension_range: [], - extension: [], - options: nil, - oneof_decl: [], - reserved_range: [], - reserved_name: [], - __unknown_fields__: [] - } - end - - field :seconds, 1, type: :int64 - field :nanos, 2, type: :int32 -end \ No newline at end of file diff --git a/test/support/protos/google/protobuf/wrappers.pb.ex b/test/support/protos/google/protobuf/wrappers.pb.ex deleted file mode 100644 index 79c43f2..0000000 --- a/test/support/protos/google/protobuf/wrappers.pb.ex +++ /dev/null @@ -1,359 +0,0 @@ -defmodule Google.Protobuf.DoubleValue do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 - - def descriptor do - # credo:disable-for-next-line - %Google.Protobuf.DescriptorProto{ - name: "DoubleValue", - field: [ - %Google.Protobuf.FieldDescriptorProto{ - name: "value", - extendee: nil, - number: 1, - label: :LABEL_OPTIONAL, - type: :TYPE_DOUBLE, - type_name: nil, - default_value: nil, - options: nil, - oneof_index: nil, - json_name: "value", - proto3_optional: nil, - __unknown_fields__: [] - } - ], - nested_type: [], - enum_type: [], - extension_range: [], - extension: [], - options: nil, - oneof_decl: [], - reserved_range: [], - reserved_name: [], - __unknown_fields__: [] - } - end - - field :value, 1, type: :double -end - -defmodule Google.Protobuf.FloatValue do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 - - def descriptor do - # credo:disable-for-next-line - %Google.Protobuf.DescriptorProto{ - name: "FloatValue", - field: [ - %Google.Protobuf.FieldDescriptorProto{ - name: "value", - extendee: nil, - number: 1, - label: :LABEL_OPTIONAL, - type: :TYPE_FLOAT, - type_name: nil, - default_value: nil, - options: nil, - oneof_index: nil, - json_name: "value", - proto3_optional: nil, - __unknown_fields__: [] - } - ], - nested_type: [], - enum_type: [], - extension_range: [], - extension: [], - options: nil, - oneof_decl: [], - reserved_range: [], - reserved_name: [], - __unknown_fields__: [] - } - end - - field :value, 1, type: :float -end - -defmodule Google.Protobuf.Int64Value do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 - - def descriptor do - # credo:disable-for-next-line - %Google.Protobuf.DescriptorProto{ - name: "Int64Value", - field: [ - %Google.Protobuf.FieldDescriptorProto{ - name: "value", - extendee: nil, - number: 1, - label: :LABEL_OPTIONAL, - type: :TYPE_INT64, - type_name: nil, - default_value: nil, - options: nil, - oneof_index: nil, - json_name: "value", - proto3_optional: nil, - __unknown_fields__: [] - } - ], - nested_type: [], - enum_type: [], - extension_range: [], - extension: [], - options: nil, - oneof_decl: [], - reserved_range: [], - reserved_name: [], - __unknown_fields__: [] - } - end - - field :value, 1, type: :int64 -end - -defmodule Google.Protobuf.UInt64Value do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 - - def descriptor do - # credo:disable-for-next-line - %Google.Protobuf.DescriptorProto{ - name: "UInt64Value", - field: [ - %Google.Protobuf.FieldDescriptorProto{ - name: "value", - extendee: nil, - number: 1, - label: :LABEL_OPTIONAL, - type: :TYPE_UINT64, - type_name: nil, - default_value: nil, - options: nil, - oneof_index: nil, - json_name: "value", - proto3_optional: nil, - __unknown_fields__: [] - } - ], - nested_type: [], - enum_type: [], - extension_range: [], - extension: [], - options: nil, - oneof_decl: [], - reserved_range: [], - reserved_name: [], - __unknown_fields__: [] - } - end - - field :value, 1, type: :uint64 -end - -defmodule Google.Protobuf.Int32Value do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 - - def descriptor do - # credo:disable-for-next-line - %Google.Protobuf.DescriptorProto{ - name: "Int32Value", - field: [ - %Google.Protobuf.FieldDescriptorProto{ - name: "value", - extendee: nil, - number: 1, - label: :LABEL_OPTIONAL, - type: :TYPE_INT32, - type_name: nil, - default_value: nil, - options: nil, - oneof_index: nil, - json_name: "value", - proto3_optional: nil, - __unknown_fields__: [] - } - ], - nested_type: [], - enum_type: [], - extension_range: [], - extension: [], - options: nil, - oneof_decl: [], - reserved_range: [], - reserved_name: [], - __unknown_fields__: [] - } - end - - field :value, 1, type: :int32 -end - -defmodule Google.Protobuf.UInt32Value do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 - - def descriptor do - # credo:disable-for-next-line - %Google.Protobuf.DescriptorProto{ - name: "UInt32Value", - field: [ - %Google.Protobuf.FieldDescriptorProto{ - name: "value", - extendee: nil, - number: 1, - label: :LABEL_OPTIONAL, - type: :TYPE_UINT32, - type_name: nil, - default_value: nil, - options: nil, - oneof_index: nil, - json_name: "value", - proto3_optional: nil, - __unknown_fields__: [] - } - ], - nested_type: [], - enum_type: [], - extension_range: [], - extension: [], - options: nil, - oneof_decl: [], - reserved_range: [], - reserved_name: [], - __unknown_fields__: [] - } - end - - field :value, 1, type: :uint32 -end - -defmodule Google.Protobuf.BoolValue do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 - - def descriptor do - # credo:disable-for-next-line - %Google.Protobuf.DescriptorProto{ - name: "BoolValue", - field: [ - %Google.Protobuf.FieldDescriptorProto{ - name: "value", - extendee: nil, - number: 1, - label: :LABEL_OPTIONAL, - type: :TYPE_BOOL, - type_name: nil, - default_value: nil, - options: nil, - oneof_index: nil, - json_name: "value", - proto3_optional: nil, - __unknown_fields__: [] - } - ], - nested_type: [], - enum_type: [], - extension_range: [], - extension: [], - options: nil, - oneof_decl: [], - reserved_range: [], - reserved_name: [], - __unknown_fields__: [] - } - end - - field :value, 1, type: :bool -end - -defmodule Google.Protobuf.StringValue do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 - - def descriptor do - # credo:disable-for-next-line - %Google.Protobuf.DescriptorProto{ - name: "StringValue", - field: [ - %Google.Protobuf.FieldDescriptorProto{ - name: "value", - extendee: nil, - number: 1, - label: :LABEL_OPTIONAL, - type: :TYPE_STRING, - type_name: nil, - default_value: nil, - options: nil, - oneof_index: nil, - json_name: "value", - proto3_optional: nil, - __unknown_fields__: [] - } - ], - nested_type: [], - enum_type: [], - extension_range: [], - extension: [], - options: nil, - oneof_decl: [], - reserved_range: [], - reserved_name: [], - __unknown_fields__: [] - } - end - - field :value, 1, type: :string -end - -defmodule Google.Protobuf.BytesValue do - @moduledoc false - - use Protobuf, protoc_gen_elixir_version: "0.12.0", syntax: :proto3 - - def descriptor do - # credo:disable-for-next-line - %Google.Protobuf.DescriptorProto{ - name: "BytesValue", - field: [ - %Google.Protobuf.FieldDescriptorProto{ - name: "value", - extendee: nil, - number: 1, - label: :LABEL_OPTIONAL, - type: :TYPE_BYTES, - type_name: nil, - default_value: nil, - options: nil, - oneof_index: nil, - json_name: "value", - proto3_optional: nil, - __unknown_fields__: [] - } - ], - nested_type: [], - enum_type: [], - extension_range: [], - extension: [], - options: nil, - oneof_decl: [], - reserved_range: [], - reserved_name: [], - __unknown_fields__: [] - } - end - - field :value, 1, type: :bytes -end \ No newline at end of file