diff --git a/.circleci/config.yml b/.circleci/config.yml index a478988e..fca5ed36 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,6 +8,7 @@ workflows: ci: jobs: - elixir-orb/test: + context: Hex executor: elixir-orb/elixir - hold-for-dev-publish: type: approval diff --git a/interop/lib/grpc_testing/empty.pb.ex b/interop/lib/grpc_testing/empty.pb.ex index 0208e266..8bc8e51f 100644 --- a/interop/lib/grpc_testing/empty.pb.ex +++ b/interop/lib/grpc_testing/empty.pb.ex @@ -2,6 +2,5 @@ defmodule Grpc.Testing.Empty do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{} defstruct [] end diff --git a/lib/google/protobuf/any.pb.ex b/lib/google/protobuf/any.pb.ex index db9d2f1e..5381d024 100644 --- a/lib/google/protobuf/any.pb.ex +++ b/lib/google/protobuf/any.pb.ex @@ -2,13 +2,6 @@ defmodule Google.Protobuf.Any do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - type_url: String.t(), - value: binary - } - - defstruct [:type_url, :value] - field :type_url, 1, type: :string field :value, 2, type: :bytes end diff --git a/lib/google/protobuf/duration.pb.ex b/lib/google/protobuf/duration.pb.ex index 0faf3894..dd1d94ae 100644 --- a/lib/google/protobuf/duration.pb.ex +++ b/lib/google/protobuf/duration.pb.ex @@ -2,13 +2,6 @@ defmodule Google.Protobuf.Duration do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - seconds: integer, - nanos: integer - } - - defstruct [:seconds, :nanos] - field :seconds, 1, type: :int64 field :nanos, 2, type: :int32 end diff --git a/lib/google/protobuf/struct.pb.ex b/lib/google/protobuf/struct.pb.ex index f7ca5e46..0a57332d 100644 --- a/lib/google/protobuf/struct.pb.ex +++ b/lib/google/protobuf/struct.pb.ex @@ -1,7 +1,6 @@ defmodule Google.Protobuf.NullValue do @moduledoc false use Protobuf, enum: true, syntax: :proto3 - @type t :: integer | :NULL_VALUE field :NULL_VALUE, 0 end @@ -10,13 +9,6 @@ defmodule Google.Protobuf.Struct.FieldsEntry do @moduledoc false use Protobuf, map: true, syntax: :proto3 - @type t :: %__MODULE__{ - key: String.t(), - value: Google.Protobuf.Value.t() | nil - } - - defstruct [:key, :value] - field :key, 1, type: :string field :value, 2, type: Google.Protobuf.Value end @@ -25,12 +17,6 @@ defmodule Google.Protobuf.Struct do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - fields: %{String.t() => Google.Protobuf.Value.t() | nil} - } - - defstruct [:fields] - field :fields, 1, repeated: true, type: Google.Protobuf.Struct.FieldsEntry, map: true end @@ -38,12 +24,6 @@ defmodule Google.Protobuf.Value do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - kind: {atom, any} - } - - defstruct [:kind] - oneof :kind, 0 field :null_value, 1, type: Google.Protobuf.NullValue, enum: true, oneof: 0 field :number_value, 2, type: :double, oneof: 0 @@ -57,11 +37,5 @@ defmodule Google.Protobuf.ListValue do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - values: [Google.Protobuf.Value.t()] - } - - defstruct [:values] - field :values, 1, repeated: true, type: Google.Protobuf.Value end diff --git a/lib/google/protobuf/timestamp.pb.ex b/lib/google/protobuf/timestamp.pb.ex index cb58cbfa..ea47137a 100644 --- a/lib/google/protobuf/timestamp.pb.ex +++ b/lib/google/protobuf/timestamp.pb.ex @@ -2,13 +2,6 @@ defmodule Google.Protobuf.Timestamp do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - seconds: integer, - nanos: integer - } - - defstruct [:seconds, :nanos] - field :seconds, 1, type: :int64 field :nanos, 2, type: :int32 end diff --git a/lib/google/protobuf/wrappers.pb.ex b/lib/google/protobuf/wrappers.pb.ex index 3cc83d07..8fdd1698 100644 --- a/lib/google/protobuf/wrappers.pb.ex +++ b/lib/google/protobuf/wrappers.pb.ex @@ -2,12 +2,6 @@ defmodule Google.Protobuf.DoubleValue do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - value: float | :infinity | :negative_infinity | :nan - } - - defstruct [:value] - field :value, 1, type: :double end @@ -15,12 +9,6 @@ defmodule Google.Protobuf.FloatValue do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - value: float | :infinity | :negative_infinity | :nan - } - - defstruct [:value] - field :value, 1, type: :float end @@ -28,12 +16,6 @@ defmodule Google.Protobuf.Int64Value do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - value: integer - } - - defstruct [:value] - field :value, 1, type: :int64 end @@ -41,12 +23,6 @@ defmodule Google.Protobuf.UInt64Value do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - value: non_neg_integer - } - - defstruct [:value] - field :value, 1, type: :uint64 end @@ -54,12 +30,6 @@ defmodule Google.Protobuf.Int32Value do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - value: integer - } - - defstruct [:value] - field :value, 1, type: :int32 end @@ -67,12 +37,6 @@ defmodule Google.Protobuf.UInt32Value do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - value: non_neg_integer - } - - defstruct [:value] - field :value, 1, type: :uint32 end @@ -80,12 +44,6 @@ defmodule Google.Protobuf.BoolValue do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - value: boolean - } - - defstruct [:value] - field :value, 1, type: :bool end @@ -93,12 +51,6 @@ defmodule Google.Protobuf.StringValue do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - value: String.t() - } - - defstruct [:value] - field :value, 1, type: :string end @@ -106,11 +58,5 @@ defmodule Google.Protobuf.BytesValue do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - value: binary - } - - defstruct [:value] - field :value, 1, type: :bytes end diff --git a/lib/google/rpc/error_details.pb.ex b/lib/google/rpc/error_details.pb.ex index 9eb61d59..35926f23 100644 --- a/lib/google/rpc/error_details.pb.ex +++ b/lib/google/rpc/error_details.pb.ex @@ -2,12 +2,6 @@ defmodule Google.Rpc.RetryInfo do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - retry_delay: Google.Protobuf.Duration.t() | nil - } - - defstruct [:retry_delay] - field :retry_delay, 1, type: Google.Protobuf.Duration end @@ -15,13 +9,6 @@ defmodule Google.Rpc.DebugInfo do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - stack_entries: [String.t()], - detail: String.t() - } - - defstruct [:stack_entries, :detail] - field :stack_entries, 1, repeated: true, type: :string field :detail, 2, type: :string end @@ -30,13 +17,6 @@ defmodule Google.Rpc.QuotaFailure.Violation do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - subject: String.t(), - description: String.t() - } - - defstruct [:subject, :description] - field :subject, 1, type: :string field :description, 2, type: :string end @@ -45,12 +25,6 @@ defmodule Google.Rpc.QuotaFailure do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - violations: [Google.Rpc.QuotaFailure.Violation.t()] - } - - defstruct [:violations] - field :violations, 1, repeated: true, type: Google.Rpc.QuotaFailure.Violation end @@ -58,13 +32,6 @@ defmodule Google.Rpc.ErrorInfo.MetadataEntry do @moduledoc false use Protobuf, map: true, syntax: :proto3 - @type t :: %__MODULE__{ - key: String.t(), - value: String.t() - } - - defstruct [:key, :value] - field :key, 1, type: :string field :value, 2, type: :string end @@ -73,14 +40,6 @@ defmodule Google.Rpc.ErrorInfo do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - reason: String.t(), - domain: String.t(), - metadata: %{String.t() => String.t()} - } - - defstruct [:reason, :domain, :metadata] - field :reason, 1, type: :string field :domain, 2, type: :string field :metadata, 3, repeated: true, type: Google.Rpc.ErrorInfo.MetadataEntry, map: true @@ -90,14 +49,6 @@ defmodule Google.Rpc.PreconditionFailure.Violation do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - type: String.t(), - subject: String.t(), - description: String.t() - } - - defstruct [:type, :subject, :description] - field :type, 1, type: :string field :subject, 2, type: :string field :description, 3, type: :string @@ -107,12 +58,6 @@ defmodule Google.Rpc.PreconditionFailure do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - violations: [Google.Rpc.PreconditionFailure.Violation.t()] - } - - defstruct [:violations] - field :violations, 1, repeated: true, type: Google.Rpc.PreconditionFailure.Violation end @@ -120,13 +65,6 @@ defmodule Google.Rpc.BadRequest.FieldViolation do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - field: String.t(), - description: String.t() - } - - defstruct [:field, :description] - field :field, 1, type: :string field :description, 2, type: :string end @@ -135,12 +73,6 @@ defmodule Google.Rpc.BadRequest do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - field_violations: [Google.Rpc.BadRequest.FieldViolation.t()] - } - - defstruct [:field_violations] - field :field_violations, 1, repeated: true, type: Google.Rpc.BadRequest.FieldViolation end @@ -148,13 +80,6 @@ defmodule Google.Rpc.RequestInfo do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - request_id: String.t(), - serving_data: String.t() - } - - defstruct [:request_id, :serving_data] - field :request_id, 1, type: :string field :serving_data, 2, type: :string end @@ -163,15 +88,6 @@ defmodule Google.Rpc.ResourceInfo do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - resource_type: String.t(), - resource_name: String.t(), - owner: String.t(), - description: String.t() - } - - defstruct [:resource_type, :resource_name, :owner, :description] - field :resource_type, 1, type: :string field :resource_name, 2, type: :string field :owner, 3, type: :string @@ -182,13 +98,6 @@ defmodule Google.Rpc.Help.Link do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - description: String.t(), - url: String.t() - } - - defstruct [:description, :url] - field :description, 1, type: :string field :url, 2, type: :string end @@ -197,12 +106,6 @@ defmodule Google.Rpc.Help do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - links: [Google.Rpc.Help.Link.t()] - } - - defstruct [:links] - field :links, 1, repeated: true, type: Google.Rpc.Help.Link end @@ -210,13 +113,6 @@ defmodule Google.Rpc.LocalizedMessage do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - locale: String.t(), - message: String.t() - } - - defstruct [:locale, :message] - field :locale, 1, type: :string field :message, 2, type: :string end diff --git a/lib/google/rpc/status.pb.ex b/lib/google/rpc/status.pb.ex index a254a130..83e4df95 100644 --- a/lib/google/rpc/status.pb.ex +++ b/lib/google/rpc/status.pb.ex @@ -2,14 +2,6 @@ defmodule Google.Rpc.Status do @moduledoc false use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - code: integer, - message: String.t(), - details: [Google.Protobuf.Any.t()] - } - - defstruct [:code, :message, :details] - field :code, 1, type: :int32 field :message, 2, type: :string field :details, 3, repeated: true, type: Google.Protobuf.Any diff --git a/mix.exs b/mix.exs index 2f3ee04e..dceee0cf 100644 --- a/mix.exs +++ b/mix.exs @@ -34,7 +34,7 @@ defmodule GRPC.Mixfile do defp deps do [ - {:protobuf, "~> 0.5"}, + {:protobuf, "~> 0.12.0-git-d5a0", hex: :protobuf_fresha}, {:cowboy, "~> 2.7"}, {:gun, "~> 2.0.0", hex: :grpc_gun}, # 2.9.0 fixes some important bugs, so it's better to use ~> 2.9.0 @@ -43,7 +43,7 @@ defmodule GRPC.Mixfile do {:inch_ex, "~> 2.0", only: [:dev, :test]}, {:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false}, {:junit_formatter, "~> 3.1", only: [:test]}, - {:credo, "~> 1.5", only: [:dev, :test], runtime: false} + {:credo, "~> 1.6", only: [:dev, :test], runtime: false} ] end diff --git a/mix.lock b/mix.lock index caaee7a6..e0b72e9a 100644 --- a/mix.lock +++ b/mix.lock @@ -1,8 +1,8 @@ %{ - "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, + "bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"}, "cowboy": {:hex, :cowboy, "2.7.0", "91ed100138a764355f43316b1d23d7ff6bdb0de4ea618cb5d8677c93a7a2f115", [:rebar3], [{:cowlib, "~> 2.8.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.7.1", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "04fd8c6a39edc6aaa9c26123009200fc61f92a3a94f3178c527b70b767c6e605"}, "cowlib": {:hex, :cowlib, "2.8.0", "fd0ff1787db84ac415b8211573e9a30a3ebe71b5cbff7f720089972b2319c8a4", [:rebar3], [], "hexpm", "79f954a7021b302186a950a32869dbc185523d99d3e44ce430cd1f3289f41ed4"}, - "credo": {:hex, :credo, "1.5.6", "e04cc0fdc236fefbb578e0c04bd01a471081616e741d386909e527ac146016c6", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "4b52a3e558bd64e30de62a648518a5ea2b6e3e5d2b164ef5296244753fc7eb17"}, + "credo": {:hex, :credo, "1.6.7", "323f5734350fd23a456f2688b9430e7d517afb313fbd38671b8a4449798a7854", [:mix], [{:bunt, "~> 0.2.1", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "41e110bfb007f7eda7f897c10bf019ceab9a0b269ce79f015d54b0dcf4fc7dd3"}, "dialyxir": {:hex, :dialyxir, "1.0.0", "6a1fa629f7881a9f5aaf3a78f094b2a51a0357c843871b8bc98824e7342d00a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "aeb06588145fac14ca08d8061a142d52753dbc2cf7f0d00fc1013f53f8654654"}, "earmark": {:hex, :earmark, "1.4.3", "364ca2e9710f6bff494117dbbd53880d84bebb692dafc3a78eb50aa3183f2bfd", [:mix], [], "hexpm", "8cf8a291ebf1c7b9539e3cddb19e9cef066c2441b1640f13c34c1d3cfc825fec"}, "earmark_parser": {:hex, :earmark_parser, "1.4.10", "6603d7a603b9c18d3d20db69921527f82ef09990885ed7525003c7fe7dc86c56", [:mix], [], "hexpm", "8e2d5370b732385db2c9b22215c3f59c84ac7dda7ed7e544d7c459496ae519c0"}, @@ -11,12 +11,12 @@ "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, "gun": {:hex, :grpc_gun, "2.0.0", "f99678a2ab975e74372a756c86ec30a8384d3ac8a8b86c7ed6243ef4e61d2729", [:rebar3], [{:cowlib, "~> 2.8.0", [hex: :cowlib, repo: "hexpm", optional: false]}], "hexpm", "03dbbca1a9c604a0267a40ea1d69986225091acb822de0b2dbea21d5815e410b"}, "inch_ex": {:hex, :inch_ex, "2.0.0", "24268a9284a1751f2ceda569cd978e1fa394c977c45c331bb52a405de544f4de", [:mix], [{:bunt, "~> 0.2", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "96d0ec5ecac8cf63142d02f16b7ab7152cf0f0f1a185a80161b758383c9399a8"}, - "jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fdf843bca858203ae1de16da2ee206f53416bbda5dc8c9e78f43243de4bc3afe"}, + "jason": {:hex, :jason, "1.4.0", "e855647bc964a44e2f67df589ccf49105ae039d4179db7f6271dfd3843dc27e6", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "79a3791085b2a0f743ca04cec0f7be26443738779d09302e01318f97bdb82121"}, "junit_formatter": {:hex, :junit_formatter, "3.3.0", "bd7914d92885f7cf949dbe1dc6bacf76badfb2c1f5f7b3f9433c20e5b6ec42c8", [:mix], [], "hexpm", "4d040410925324b155ae4c7d41e884a0cdebe53b917bee4f22adf152e987a666"}, "makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"}, "makeup_elixir": {:hex, :makeup_elixir, "0.15.0", "98312c9f0d3730fde4049985a1105da5155bfe5c11e47bdc7406d88e01e4219b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "75ffa34ab1056b7e24844c90bfc62aaf6f3a37a15faa76b07bc5eba27e4a8b4a"}, "nimble_parsec": {:hex, :nimble_parsec, "1.1.0", "3a6fca1550363552e54c216debb6a9e95bd8d32348938e13de5eda962c0d7f89", [:mix], [], "hexpm", "08eb32d66b706e913ff748f11694b17981c0b04a33ef470e33e11b3d3ac8f54b"}, "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"}, - "protobuf": {:hex, :protobuf, "0.7.1", "7d1b9f7d9ecb32eccd96b0c58572de4d1c09e9e3bc414e4cb15c2dce7013f195", [:mix], [], "hexpm", "6eff7a5287963719521c82e5d5b4583fd1d7cdd89ad129f0ea7d503a50a4d13f"}, + "protobuf": {:hex, :protobuf_fresha, "0.11.0-git-64db", "d1ece9d1a48b2122c0de2611abb0190a5ed7ba65b720f20134b4f4ed42d47d6e", [:mix], [{:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "3849c6bf299b37449b3046b6d141c3bfbcb41e864b50ae17a5191504c6b0b022"}, "ranch": {:hex, :ranch, "1.7.1", "6b1fab51b49196860b733a49c07604465a47bdb78aa10c1c16a3d199f7f8c881", [:rebar3], [], "hexpm", "451d8527787df716d99dc36162fca05934915db0b6141bbdac2ea8d3c7afc7d7"}, } diff --git a/test/grpc/integration/service_test.exs b/test/grpc/integration/service_test.exs index 3da896f9..be602a09 100644 --- a/test/grpc/integration/service_test.exs +++ b/test/grpc/integration/service_test.exs @@ -132,7 +132,7 @@ defmodule GRPC.Integration.ServiceTest do FeatureServer, fn port -> {:ok, channel} = GRPC.Stub.connect("localhost:#{port}") - stream = channel |> Routeguide.RouteGuide.Stub.async_route_chat() + stream = channel |> Routeguide.RouteGuide.Stub.route_chat() task = Task.async(fn -> diff --git a/test/grpc/message/protobuf_test.exs b/test/grpc/message/protobuf_test.exs index 3e1b8dae..9e7ccc1c 100644 --- a/test/grpc/message/protobuf_test.exs +++ b/test/grpc/message/protobuf_test.exs @@ -4,14 +4,12 @@ defmodule GRPC.Message.ProtobufTest do defmodule Helloworld.HelloRequest do use Protobuf - defstruct [:name] field(:name, 1, optional: true, type: :string) end defmodule Helloworld.HelloReply do use Protobuf - defstruct [:message] field(:message, 1, optional: true, type: :string) end diff --git a/test/support/helloworld.pb.ex b/test/support/helloworld.pb.ex index f8758c31..5f309be2 100644 --- a/test/support/helloworld.pb.ex +++ b/test/support/helloworld.pb.ex @@ -1,56 +1,45 @@ defmodule Helloworld.HelloRequest do @moduledoc false - use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - name: String.t() - } - defstruct [:name] + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 field :name, 1, type: :string end defmodule Helloworld.HelloReply do @moduledoc false - use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - message: String.t() - } - defstruct [:message] + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 field :message, 1, type: :string end defmodule Helloworld.HeaderRequest do @moduledoc false - use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{} - defstruct [] + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 end defmodule Helloworld.HeaderReply do @moduledoc false - use Protobuf, syntax: :proto3 - @type t :: %__MODULE__{ - authorization: String.t() - } - defstruct [:authorization] + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 field :authorization, 1, type: :string end defmodule Helloworld.Greeter.Service do @moduledoc false - use GRPC.Service, name: "helloworld.Greeter" + + use GRPC.Service, name: "helloworld.Greeter", protoc_gen_elixir_version: "0.11.0" rpc :SayHello, Helloworld.HelloRequest, Helloworld.HelloReply + rpc :CheckHeaders, Helloworld.HeaderRequest, Helloworld.HeaderReply end defmodule Helloworld.Greeter.Stub do @moduledoc false + use GRPC.Stub, service: Helloworld.Greeter.Service -end +end \ No newline at end of file diff --git a/test/support/route_guide.pb.ex b/test/support/route_guide.pb.ex index 6ad6f559..a2494747 100644 --- a/test/support/route_guide.pb.ex +++ b/test/support/route_guide.pb.ex @@ -1,82 +1,66 @@ defmodule Routeguide.Point do - use Protobuf + @moduledoc false - @type t :: %__MODULE__{ - latitude: integer, - longitude: integer - } - defstruct [:latitude, :longitude] + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 - field :latitude, 1, optional: true, type: :int32 - field :longitude, 2, optional: true, type: :int32 + field :latitude, 1, type: :int32 + field :longitude, 2, type: :int32 end defmodule Routeguide.Rectangle do - use Protobuf + @moduledoc false - @type t :: %__MODULE__{ - lo: Routeguide.Point.t(), - hi: Routeguide.Point.t() - } - defstruct [:lo, :hi] + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 - field :lo, 1, optional: true, type: Routeguide.Point - field :hi, 2, optional: true, type: Routeguide.Point + field :lo, 1, type: Routeguide.Point + field :hi, 2, type: Routeguide.Point end defmodule Routeguide.Feature do - use Protobuf + @moduledoc false - @type t :: %__MODULE__{ - name: String.t(), - location: Routeguide.Point.t() - } - defstruct [:name, :location] + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 - field :name, 1, optional: true, type: :string - field :location, 2, optional: true, type: Routeguide.Point + field :name, 1, type: :string + field :location, 2, type: Routeguide.Point end defmodule Routeguide.RouteNote do - use Protobuf + @moduledoc false - @type t :: %__MODULE__{ - location: Routeguide.Point.t(), - message: String.t() - } - defstruct [:location, :message] + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 - field :location, 1, optional: true, type: Routeguide.Point - field :message, 2, optional: true, type: :string + field :location, 1, type: Routeguide.Point + field :message, 2, type: :string end defmodule Routeguide.RouteSummary do - use Protobuf - - @type t :: %__MODULE__{ - point_count: integer, - feature_count: integer, - distance: integer, - elapsed_time: integer - } - defstruct [:point_count, :feature_count, :distance, :elapsed_time] - - field :point_count, 1, optional: true, type: :int32 - field :feature_count, 2, optional: true, type: :int32 - field :distance, 3, optional: true, type: :int32 - field :elapsed_time, 4, optional: true, type: :int32 + @moduledoc false + + use Protobuf, protoc_gen_elixir_version: "0.11.0", syntax: :proto3 + + field :point_count, 1, type: :int32, json_name: "pointCount" + field :feature_count, 2, type: :int32, json_name: "featureCount" + field :distance, 3, type: :int32 + field :elapsed_time, 4, type: :int32, json_name: "elapsedTime" end defmodule Routeguide.RouteGuide.Service do - use GRPC.Service, name: "routeguide.RouteGuide" + @moduledoc false + + use GRPC.Service, name: "routeguide.RouteGuide", protoc_gen_elixir_version: "0.11.0" rpc :GetFeature, Routeguide.Point, Routeguide.Feature + rpc :ListFeatures, Routeguide.Rectangle, stream(Routeguide.Feature) + rpc :RecordRoute, stream(Routeguide.Point), Routeguide.RouteSummary + rpc :RouteChat, stream(Routeguide.RouteNote), stream(Routeguide.RouteNote) - rpc :AsyncRouteChat, stream(Routeguide.RouteNote), stream(Routeguide.RouteNote) end defmodule Routeguide.RouteGuide.Stub do + @moduledoc false + use GRPC.Stub, service: Routeguide.RouteGuide.Service -end +end \ No newline at end of file