diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_attachment.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_attachment.ex new file mode 100644 index 0000000000..473ba44645 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_attachment.ex @@ -0,0 +1,193 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.Attachment) do + @moduledoc(false) + ( + defstruct(source: nil, test_step_id: "", test_case_started_id: "", body: "", media_type: "", content_encoding: :IDENTITY, __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_source(msg) |> encode_test_step_id(msg) |> encode_test_case_started_id(msg) |> encode_body(msg) |> encode_media_type(msg) |> encode_content_encoding(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_source(acc, msg)) do + field_value = msg.source() + if(field_value == nil) do + acc + else + [acc, "\n", Protox.Encode.encode_message(field_value)] + end + end, defp(encode_test_step_id(acc, msg)) do + field_value = msg.test_step_id() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_test_case_started_id(acc, msg)) do + field_value = msg.test_case_started_id() + if(field_value == "") do + acc + else + [acc, <<26>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_body(acc, msg)) do + field_value = msg.body() + if(field_value == "") do + acc + else + [acc, "\"", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_media_type(acc, msg)) do + field_value = msg.media_type() + if(field_value == "") do + acc + else + [acc, "*", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_content_encoding(acc, msg)) do + field_value = msg.content_encoding() + if(field_value == :IDENTITY) do + acc + else + [acc, "0", field_value |> CucumberMessages.Attachment.ContentEncoding.encode() |> Protox.Encode.encode_enum()] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.Attachment)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.SourceReference.decode!(delimited) + field = {:source, Protox.Message.merge(msg.source(), value)} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:test_step_id, value} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:test_case_started_id, value} + {field, rest} + {4, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:body, value} + {field, rest} + {5, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:media_type, value} + {field, rest} + {6, _, bytes} -> + {value, rest} = Protox.Decode.parse_enum(bytes, CucumberMessages.Attachment.ContentEncoding) + field = {:content_encoding, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:source, {:default, nil}, {:message, CucumberMessages.SourceReference}}, 2 => {:test_step_id, {:default, ""}, :string}, 3 => {:test_case_started_id, {:default, ""}, :string}, 4 => {:body, {:default, ""}, :string}, 5 => {:media_type, {:default, ""}, :string}, 6 => {:content_encoding, {:default, :IDENTITY}, {:enum, CucumberMessages.Attachment.ContentEncoding}}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{body: {4, {:default, ""}, :string}, content_encoding: {6, {:default, :IDENTITY}, {:enum, CucumberMessages.Attachment.ContentEncoding}}, media_type: {5, {:default, ""}, :string}, source: {1, {:default, nil}, {:message, CucumberMessages.SourceReference}}, test_case_started_id: {3, {:default, ""}, :string}, test_step_id: {2, {:default, ""}, :string}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:source)) do + {:ok, nil} + end, def(default(:test_step_id)) do + {:ok, ""} + end, def(default(:test_case_started_id)) do + {:ok, ""} + end, def(default(:body)) do + {:ok, ""} + end, def(default(:media_type)) do + {:ok, ""} + end, def(default(:content_encoding)) do + {:ok, :IDENTITY} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_attachment_content_encoding.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_attachment_content_encoding.ex new file mode 100644 index 0000000000..0ce4d9a680 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_attachment_content_encoding.ex @@ -0,0 +1,35 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.Attachment.ContentEncoding) do + @moduledoc(false) + ( + ( + @spec(default() :: :IDENTITY) + def(default()) do + :IDENTITY + end + ) + @spec(encode(atom) :: integer | atom) + [def(encode(:IDENTITY)) do + 0 + end, def(encode(:BASE64)) do + 1 + end] + def(encode(x)) do + x + end + @spec(decode(integer) :: atom | integer) + [def(decode(0)) do + :IDENTITY + end, def(decode(1)) do + :BASE64 + end] + def(decode(x)) do + x + end + @spec(constants() :: [{integer, atom}]) + def(constants()) do + [{0, :IDENTITY}, {1, :BASE64}] + end + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_duration.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_duration.ex new file mode 100644 index 0000000000..228c2504d6 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_duration.ex @@ -0,0 +1,131 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.Duration) do + @moduledoc(false) + ( + defstruct(seconds: 0, nanos: 0, __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_seconds(msg) |> encode_nanos(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_seconds(acc, msg)) do + field_value = msg.seconds() + if(field_value == 0) do + acc + else + [acc, "\b", Protox.Encode.encode_int64(field_value)] + end + end, defp(encode_nanos(acc, msg)) do + field_value = msg.nanos() + if(field_value == 0) do + acc + else + [acc, <<16>>, Protox.Encode.encode_int32(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.Duration)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {value, rest} = Protox.Decode.parse_int64(bytes) + field = {:seconds, value} + {field, rest} + {2, _, bytes} -> + {value, rest} = Protox.Decode.parse_int32(bytes) + field = {:nanos, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:seconds, {:default, 0}, :int64}, 2 => {:nanos, {:default, 0}, :int32}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{nanos: {2, {:default, 0}, :int32}, seconds: {1, {:default, 0}, :int64}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:seconds)) do + {:ok, 0} + end, def(default(:nanos)) do + {:ok, 0} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_envelope.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_envelope.ex new file mode 100644 index 0000000000..340efd184b --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_envelope.ex @@ -0,0 +1,416 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.Envelope) do + @moduledoc(false) + ( + defstruct(message: nil, __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_message(msg) |> encode_unknown_fields(msg) + end + [defp(encode_message(acc, msg)) do + case(msg.message()) do + nil -> + acc + {:source, _field_value} -> + encode_source(acc, msg) + {:gherkin_document, _field_value} -> + encode_gherkin_document(acc, msg) + {:pickle, _field_value} -> + encode_pickle(acc, msg) + {:step_definition, _field_value} -> + encode_step_definition(acc, msg) + {:hook, _field_value} -> + encode_hook(acc, msg) + {:parameter_type, _field_value} -> + encode_parameter_type(acc, msg) + {:test_case, _field_value} -> + encode_test_case(acc, msg) + {:undefined_parameter_type, _field_value} -> + encode_undefined_parameter_type(acc, msg) + {:test_run_started, _field_value} -> + encode_test_run_started(acc, msg) + {:test_case_started, _field_value} -> + encode_test_case_started(acc, msg) + {:test_step_started, _field_value} -> + encode_test_step_started(acc, msg) + {:attachment, _field_value} -> + encode_attachment(acc, msg) + {:test_step_finished, _field_value} -> + encode_test_step_finished(acc, msg) + {:test_case_finished, _field_value} -> + encode_test_case_finished(acc, msg) + {:test_run_finished, _field_value} -> + encode_test_run_finished(acc, msg) + {:parse_error, _field_value} -> + encode_parse_error(acc, msg) + {:meta, _field_value} -> + encode_meta(acc, msg) + end + end] + [defp(encode_source(acc, msg)) do + {_, field_value} = msg.message() + [acc, "\n", Protox.Encode.encode_message(field_value)] + end, defp(encode_gherkin_document(acc, msg)) do + {_, field_value} = msg.message() + [acc, <<18>>, Protox.Encode.encode_message(field_value)] + end, defp(encode_pickle(acc, msg)) do + {_, field_value} = msg.message() + [acc, <<26>>, Protox.Encode.encode_message(field_value)] + end, defp(encode_step_definition(acc, msg)) do + {_, field_value} = msg.message() + [acc, "\"", Protox.Encode.encode_message(field_value)] + end, defp(encode_hook(acc, msg)) do + {_, field_value} = msg.message() + [acc, "*", Protox.Encode.encode_message(field_value)] + end, defp(encode_parameter_type(acc, msg)) do + {_, field_value} = msg.message() + [acc, "2", Protox.Encode.encode_message(field_value)] + end, defp(encode_test_case(acc, msg)) do + {_, field_value} = msg.message() + [acc, ":", Protox.Encode.encode_message(field_value)] + end, defp(encode_undefined_parameter_type(acc, msg)) do + {_, field_value} = msg.message() + [acc, "B", Protox.Encode.encode_message(field_value)] + end, defp(encode_test_run_started(acc, msg)) do + {_, field_value} = msg.message() + [acc, "J", Protox.Encode.encode_message(field_value)] + end, defp(encode_test_case_started(acc, msg)) do + {_, field_value} = msg.message() + [acc, "R", Protox.Encode.encode_message(field_value)] + end, defp(encode_test_step_started(acc, msg)) do + {_, field_value} = msg.message() + [acc, "Z", Protox.Encode.encode_message(field_value)] + end, defp(encode_attachment(acc, msg)) do + {_, field_value} = msg.message() + [acc, "b", Protox.Encode.encode_message(field_value)] + end, defp(encode_test_step_finished(acc, msg)) do + {_, field_value} = msg.message() + [acc, "j", Protox.Encode.encode_message(field_value)] + end, defp(encode_test_case_finished(acc, msg)) do + {_, field_value} = msg.message() + [acc, "r", Protox.Encode.encode_message(field_value)] + end, defp(encode_test_run_finished(acc, msg)) do + {_, field_value} = msg.message() + [acc, "z", Protox.Encode.encode_message(field_value)] + end, defp(encode_parse_error(acc, msg)) do + {_, field_value} = msg.message() + [acc, [<<130>>, <<1>>], Protox.Encode.encode_message(field_value)] + end, defp(encode_meta(acc, msg)) do + {_, field_value} = msg.message() + [acc, [<<138>>, <<1>>], Protox.Encode.encode_message(field_value)] + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.Envelope)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Source.decode!(delimited) + field = case(msg.message()) do + {:source, previous_value} -> + {:message, {:source, Protox.Message.merge(previous_value, value)}} + _ -> + {:message, {:source, value}} + end + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.GherkinDocument.decode!(delimited) + field = case(msg.message()) do + {:gherkin_document, previous_value} -> + {:message, {:gherkin_document, Protox.Message.merge(previous_value, value)}} + _ -> + {:message, {:gherkin_document, value}} + end + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Pickle.decode!(delimited) + field = case(msg.message()) do + {:pickle, previous_value} -> + {:message, {:pickle, Protox.Message.merge(previous_value, value)}} + _ -> + {:message, {:pickle, value}} + end + {field, rest} + {4, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.StepDefinition.decode!(delimited) + field = case(msg.message()) do + {:step_definition, previous_value} -> + {:message, {:step_definition, Protox.Message.merge(previous_value, value)}} + _ -> + {:message, {:step_definition, value}} + end + {field, rest} + {5, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Hook.decode!(delimited) + field = case(msg.message()) do + {:hook, previous_value} -> + {:message, {:hook, Protox.Message.merge(previous_value, value)}} + _ -> + {:message, {:hook, value}} + end + {field, rest} + {6, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.ParameterType.decode!(delimited) + field = case(msg.message()) do + {:parameter_type, previous_value} -> + {:message, {:parameter_type, Protox.Message.merge(previous_value, value)}} + _ -> + {:message, {:parameter_type, value}} + end + {field, rest} + {7, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.TestCase.decode!(delimited) + field = case(msg.message()) do + {:test_case, previous_value} -> + {:message, {:test_case, Protox.Message.merge(previous_value, value)}} + _ -> + {:message, {:test_case, value}} + end + {field, rest} + {8, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.UndefinedParameterType.decode!(delimited) + field = case(msg.message()) do + {:undefined_parameter_type, previous_value} -> + {:message, {:undefined_parameter_type, Protox.Message.merge(previous_value, value)}} + _ -> + {:message, {:undefined_parameter_type, value}} + end + {field, rest} + {9, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.TestRunStarted.decode!(delimited) + field = case(msg.message()) do + {:test_run_started, previous_value} -> + {:message, {:test_run_started, Protox.Message.merge(previous_value, value)}} + _ -> + {:message, {:test_run_started, value}} + end + {field, rest} + {10, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.TestCaseStarted.decode!(delimited) + field = case(msg.message()) do + {:test_case_started, previous_value} -> + {:message, {:test_case_started, Protox.Message.merge(previous_value, value)}} + _ -> + {:message, {:test_case_started, value}} + end + {field, rest} + {11, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.TestStepStarted.decode!(delimited) + field = case(msg.message()) do + {:test_step_started, previous_value} -> + {:message, {:test_step_started, Protox.Message.merge(previous_value, value)}} + _ -> + {:message, {:test_step_started, value}} + end + {field, rest} + {12, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Attachment.decode!(delimited) + field = case(msg.message()) do + {:attachment, previous_value} -> + {:message, {:attachment, Protox.Message.merge(previous_value, value)}} + _ -> + {:message, {:attachment, value}} + end + {field, rest} + {13, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.TestStepFinished.decode!(delimited) + field = case(msg.message()) do + {:test_step_finished, previous_value} -> + {:message, {:test_step_finished, Protox.Message.merge(previous_value, value)}} + _ -> + {:message, {:test_step_finished, value}} + end + {field, rest} + {14, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.TestCaseFinished.decode!(delimited) + field = case(msg.message()) do + {:test_case_finished, previous_value} -> + {:message, {:test_case_finished, Protox.Message.merge(previous_value, value)}} + _ -> + {:message, {:test_case_finished, value}} + end + {field, rest} + {15, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.TestRunFinished.decode!(delimited) + field = case(msg.message()) do + {:test_run_finished, previous_value} -> + {:message, {:test_run_finished, Protox.Message.merge(previous_value, value)}} + _ -> + {:message, {:test_run_finished, value}} + end + {field, rest} + {16, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.ParseError.decode!(delimited) + field = case(msg.message()) do + {:parse_error, previous_value} -> + {:message, {:parse_error, Protox.Message.merge(previous_value, value)}} + _ -> + {:message, {:parse_error, value}} + end + {field, rest} + {17, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Meta.decode!(delimited) + field = case(msg.message()) do + {:meta, previous_value} -> + {:message, {:meta, Protox.Message.merge(previous_value, value)}} + _ -> + {:message, {:meta, value}} + end + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:source, {:oneof, :message}, {:message, CucumberMessages.Source}}, 2 => {:gherkin_document, {:oneof, :message}, {:message, CucumberMessages.GherkinDocument}}, 3 => {:pickle, {:oneof, :message}, {:message, CucumberMessages.Pickle}}, 4 => {:step_definition, {:oneof, :message}, {:message, CucumberMessages.StepDefinition}}, 5 => {:hook, {:oneof, :message}, {:message, CucumberMessages.Hook}}, 6 => {:parameter_type, {:oneof, :message}, {:message, CucumberMessages.ParameterType}}, 7 => {:test_case, {:oneof, :message}, {:message, CucumberMessages.TestCase}}, 8 => {:undefined_parameter_type, {:oneof, :message}, {:message, CucumberMessages.UndefinedParameterType}}, 9 => {:test_run_started, {:oneof, :message}, {:message, CucumberMessages.TestRunStarted}}, 10 => {:test_case_started, {:oneof, :message}, {:message, CucumberMessages.TestCaseStarted}}, 11 => {:test_step_started, {:oneof, :message}, {:message, CucumberMessages.TestStepStarted}}, 12 => {:attachment, {:oneof, :message}, {:message, CucumberMessages.Attachment}}, 13 => {:test_step_finished, {:oneof, :message}, {:message, CucumberMessages.TestStepFinished}}, 14 => {:test_case_finished, {:oneof, :message}, {:message, CucumberMessages.TestCaseFinished}}, 15 => {:test_run_finished, {:oneof, :message}, {:message, CucumberMessages.TestRunFinished}}, 16 => {:parse_error, {:oneof, :message}, {:message, CucumberMessages.ParseError}}, 17 => {:meta, {:oneof, :message}, {:message, CucumberMessages.Meta}}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{attachment: {12, {:oneof, :message}, {:message, CucumberMessages.Attachment}}, gherkin_document: {2, {:oneof, :message}, {:message, CucumberMessages.GherkinDocument}}, hook: {5, {:oneof, :message}, {:message, CucumberMessages.Hook}}, meta: {17, {:oneof, :message}, {:message, CucumberMessages.Meta}}, parameter_type: {6, {:oneof, :message}, {:message, CucumberMessages.ParameterType}}, parse_error: {16, {:oneof, :message}, {:message, CucumberMessages.ParseError}}, pickle: {3, {:oneof, :message}, {:message, CucumberMessages.Pickle}}, source: {1, {:oneof, :message}, {:message, CucumberMessages.Source}}, step_definition: {4, {:oneof, :message}, {:message, CucumberMessages.StepDefinition}}, test_case: {7, {:oneof, :message}, {:message, CucumberMessages.TestCase}}, test_case_finished: {14, {:oneof, :message}, {:message, CucumberMessages.TestCaseFinished}}, test_case_started: {10, {:oneof, :message}, {:message, CucumberMessages.TestCaseStarted}}, test_run_finished: {15, {:oneof, :message}, {:message, CucumberMessages.TestRunFinished}}, test_run_started: {9, {:oneof, :message}, {:message, CucumberMessages.TestRunStarted}}, test_step_finished: {13, {:oneof, :message}, {:message, CucumberMessages.TestStepFinished}}, test_step_started: {11, {:oneof, :message}, {:message, CucumberMessages.TestStepStarted}}, undefined_parameter_type: {8, {:oneof, :message}, {:message, CucumberMessages.UndefinedParameterType}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:source)) do + {:error, :no_default_value} + end, def(default(:gherkin_document)) do + {:error, :no_default_value} + end, def(default(:pickle)) do + {:error, :no_default_value} + end, def(default(:step_definition)) do + {:error, :no_default_value} + end, def(default(:hook)) do + {:error, :no_default_value} + end, def(default(:parameter_type)) do + {:error, :no_default_value} + end, def(default(:test_case)) do + {:error, :no_default_value} + end, def(default(:undefined_parameter_type)) do + {:error, :no_default_value} + end, def(default(:test_run_started)) do + {:error, :no_default_value} + end, def(default(:test_case_started)) do + {:error, :no_default_value} + end, def(default(:test_step_started)) do + {:error, :no_default_value} + end, def(default(:attachment)) do + {:error, :no_default_value} + end, def(default(:test_step_finished)) do + {:error, :no_default_value} + end, def(default(:test_case_finished)) do + {:error, :no_default_value} + end, def(default(:test_run_finished)) do + {:error, :no_default_value} + end, def(default(:parse_error)) do + {:error, :no_default_value} + end, def(default(:meta)) do + {:error, :no_default_value} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document.ex new file mode 100644 index 0000000000..36ba4f36cd --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document.ex @@ -0,0 +1,150 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.GherkinDocument) do + @moduledoc(false) + ( + defstruct(uri: "", feature: nil, comments: [], __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_uri(msg) |> encode_feature(msg) |> encode_comments(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_uri(acc, msg)) do + field_value = msg.uri() + if(field_value == "") do + acc + else + [acc, "\n", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_feature(acc, msg)) do + field_value = msg.feature() + if(field_value == nil) do + acc + else + [acc, <<18>>, Protox.Encode.encode_message(field_value)] + end + end, defp(encode_comments(acc, msg)) do + case(msg.comments()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, <<26>>, Protox.Encode.encode_message(value)] end)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.GherkinDocument)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:uri, value} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.GherkinDocument.Feature.decode!(delimited) + field = {:feature, Protox.Message.merge(msg.feature(), value)} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.GherkinDocument.Comment.decode!(delimited) + field = {:comments, msg.comments() ++ List.wrap(value)} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:uri, {:default, ""}, :string}, 2 => {:feature, {:default, nil}, {:message, CucumberMessages.GherkinDocument.Feature}}, 3 => {:comments, :unpacked, {:message, CucumberMessages.GherkinDocument.Comment}}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{comments: {3, :unpacked, {:message, CucumberMessages.GherkinDocument.Comment}}, feature: {2, {:default, nil}, {:message, CucumberMessages.GherkinDocument.Feature}}, uri: {1, {:default, ""}, :string}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:uri)) do + {:ok, ""} + end, def(default(:feature)) do + {:ok, nil} + end, def(default(:comments)) do + {:error, :no_default_value} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_comment.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_comment.ex new file mode 100644 index 0000000000..b3b80a5d37 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_comment.ex @@ -0,0 +1,135 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.GherkinDocument.Comment) do + @moduledoc(false) + ( + defstruct(location: nil, text: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_location(msg) |> encode_text(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_location(acc, msg)) do + field_value = msg.location() + if(field_value == nil) do + acc + else + [acc, "\n", Protox.Encode.encode_message(field_value)] + end + end, defp(encode_text(acc, msg)) do + field_value = msg.text() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.GherkinDocument.Comment)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Location.decode!(delimited) + field = {:location, Protox.Message.merge(msg.location(), value)} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:text, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, 2 => {:text, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{location: {1, {:default, nil}, {:message, CucumberMessages.Location}}, text: {2, {:default, ""}, :string}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:location)) do + {:ok, nil} + end, def(default(:text)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature.ex new file mode 100644 index 0000000000..0779e30981 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature.ex @@ -0,0 +1,210 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.GherkinDocument.Feature) do + @moduledoc(false) + ( + defstruct(location: nil, tags: [], language: "", keyword: "", name: "", description: "", children: [], __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_location(msg) |> encode_tags(msg) |> encode_language(msg) |> encode_keyword(msg) |> encode_name(msg) |> encode_description(msg) |> encode_children(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_location(acc, msg)) do + field_value = msg.location() + if(field_value == nil) do + acc + else + [acc, "\n", Protox.Encode.encode_message(field_value)] + end + end, defp(encode_tags(acc, msg)) do + case(msg.tags()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, <<18>>, Protox.Encode.encode_message(value)] end)] + end + end, defp(encode_language(acc, msg)) do + field_value = msg.language() + if(field_value == "") do + acc + else + [acc, <<26>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_keyword(acc, msg)) do + field_value = msg.keyword() + if(field_value == "") do + acc + else + [acc, "\"", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_name(acc, msg)) do + field_value = msg.name() + if(field_value == "") do + acc + else + [acc, "*", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_description(acc, msg)) do + field_value = msg.description() + if(field_value == "") do + acc + else + [acc, "2", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_children(acc, msg)) do + case(msg.children()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, ":", Protox.Encode.encode_message(value)] end)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.GherkinDocument.Feature)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Location.decode!(delimited) + field = {:location, Protox.Message.merge(msg.location(), value)} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.GherkinDocument.Feature.Tag.decode!(delimited) + field = {:tags, msg.tags() ++ List.wrap(value)} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:language, value} + {field, rest} + {4, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:keyword, value} + {field, rest} + {5, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:name, value} + {field, rest} + {6, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:description, value} + {field, rest} + {7, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.GherkinDocument.Feature.FeatureChild.decode!(delimited) + field = {:children, msg.children() ++ List.wrap(value)} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, 2 => {:tags, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Tag}}, 3 => {:language, {:default, ""}, :string}, 4 => {:keyword, {:default, ""}, :string}, 5 => {:name, {:default, ""}, :string}, 6 => {:description, {:default, ""}, :string}, 7 => {:children, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.FeatureChild}}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{children: {7, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.FeatureChild}}, description: {6, {:default, ""}, :string}, keyword: {4, {:default, ""}, :string}, language: {3, {:default, ""}, :string}, location: {1, {:default, nil}, {:message, CucumberMessages.Location}}, name: {5, {:default, ""}, :string}, tags: {2, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Tag}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:location)) do + {:ok, nil} + end, def(default(:tags)) do + {:error, :no_default_value} + end, def(default(:language)) do + {:ok, ""} + end, def(default(:keyword)) do + {:ok, ""} + end, def(default(:name)) do + {:ok, ""} + end, def(default(:description)) do + {:ok, ""} + end, def(default(:children)) do + {:error, :no_default_value} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_background.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_background.ex new file mode 100644 index 0000000000..a6b24fa759 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_background.ex @@ -0,0 +1,195 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.GherkinDocument.Feature.Background) do + @moduledoc(false) + ( + defstruct(location: nil, keyword: "", name: "", description: "", steps: [], id: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_location(msg) |> encode_keyword(msg) |> encode_name(msg) |> encode_description(msg) |> encode_steps(msg) |> encode_id(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_location(acc, msg)) do + field_value = msg.location() + if(field_value == nil) do + acc + else + [acc, "\n", Protox.Encode.encode_message(field_value)] + end + end, defp(encode_keyword(acc, msg)) do + field_value = msg.keyword() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_name(acc, msg)) do + field_value = msg.name() + if(field_value == "") do + acc + else + [acc, <<26>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_description(acc, msg)) do + field_value = msg.description() + if(field_value == "") do + acc + else + [acc, "\"", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_steps(acc, msg)) do + case(msg.steps()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, "*", Protox.Encode.encode_message(value)] end)] + end + end, defp(encode_id(acc, msg)) do + field_value = msg.id() + if(field_value == "") do + acc + else + [acc, "2", Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.GherkinDocument.Feature.Background)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Location.decode!(delimited) + field = {:location, Protox.Message.merge(msg.location(), value)} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:keyword, value} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:name, value} + {field, rest} + {4, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:description, value} + {field, rest} + {5, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.GherkinDocument.Feature.Step.decode!(delimited) + field = {:steps, msg.steps() ++ List.wrap(value)} + {field, rest} + {6, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:id, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, 2 => {:keyword, {:default, ""}, :string}, 3 => {:name, {:default, ""}, :string}, 4 => {:description, {:default, ""}, :string}, 5 => {:steps, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Step}}, 6 => {:id, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{description: {4, {:default, ""}, :string}, id: {6, {:default, ""}, :string}, keyword: {2, {:default, ""}, :string}, location: {1, {:default, nil}, {:message, CucumberMessages.Location}}, name: {3, {:default, ""}, :string}, steps: {5, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Step}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:location)) do + {:ok, nil} + end, def(default(:keyword)) do + {:ok, ""} + end, def(default(:name)) do + {:ok, ""} + end, def(default(:description)) do + {:ok, ""} + end, def(default(:steps)) do + {:error, :no_default_value} + end, def(default(:id)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_feature_child.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_feature_child.ex new file mode 100644 index 0000000000..4f5f54768a --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_feature_child.ex @@ -0,0 +1,164 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.GherkinDocument.Feature.FeatureChild) do + @moduledoc(false) + ( + defstruct(value: nil, __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_value(msg) |> encode_unknown_fields(msg) + end + [defp(encode_value(acc, msg)) do + case(msg.value()) do + nil -> + acc + {:rule, _field_value} -> + encode_rule(acc, msg) + {:background, _field_value} -> + encode_background(acc, msg) + {:scenario, _field_value} -> + encode_scenario(acc, msg) + end + end] + [defp(encode_rule(acc, msg)) do + {_, field_value} = msg.value() + [acc, "\n", Protox.Encode.encode_message(field_value)] + end, defp(encode_background(acc, msg)) do + {_, field_value} = msg.value() + [acc, <<18>>, Protox.Encode.encode_message(field_value)] + end, defp(encode_scenario(acc, msg)) do + {_, field_value} = msg.value() + [acc, <<26>>, Protox.Encode.encode_message(field_value)] + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.GherkinDocument.Feature.FeatureChild)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.GherkinDocument.Feature.FeatureChild.Rule.decode!(delimited) + field = case(msg.value()) do + {:rule, previous_value} -> + {:value, {:rule, Protox.Message.merge(previous_value, value)}} + _ -> + {:value, {:rule, value}} + end + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.GherkinDocument.Feature.Background.decode!(delimited) + field = case(msg.value()) do + {:background, previous_value} -> + {:value, {:background, Protox.Message.merge(previous_value, value)}} + _ -> + {:value, {:background, value}} + end + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.GherkinDocument.Feature.Scenario.decode!(delimited) + field = case(msg.value()) do + {:scenario, previous_value} -> + {:value, {:scenario, Protox.Message.merge(previous_value, value)}} + _ -> + {:value, {:scenario, value}} + end + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:rule, {:oneof, :value}, {:message, CucumberMessages.GherkinDocument.Feature.FeatureChild.Rule}}, 2 => {:background, {:oneof, :value}, {:message, CucumberMessages.GherkinDocument.Feature.Background}}, 3 => {:scenario, {:oneof, :value}, {:message, CucumberMessages.GherkinDocument.Feature.Scenario}}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{background: {2, {:oneof, :value}, {:message, CucumberMessages.GherkinDocument.Feature.Background}}, rule: {1, {:oneof, :value}, {:message, CucumberMessages.GherkinDocument.Feature.FeatureChild.Rule}}, scenario: {3, {:oneof, :value}, {:message, CucumberMessages.GherkinDocument.Feature.Scenario}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:rule)) do + {:error, :no_default_value} + end, def(default(:background)) do + {:error, :no_default_value} + end, def(default(:scenario)) do + {:error, :no_default_value} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_feature_child_rule.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_feature_child_rule.ex new file mode 100644 index 0000000000..a18fb350fa --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_feature_child_rule.ex @@ -0,0 +1,195 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.GherkinDocument.Feature.FeatureChild.Rule) do + @moduledoc(false) + ( + defstruct(location: nil, keyword: "", name: "", description: "", children: [], id: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_location(msg) |> encode_keyword(msg) |> encode_name(msg) |> encode_description(msg) |> encode_children(msg) |> encode_id(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_location(acc, msg)) do + field_value = msg.location() + if(field_value == nil) do + acc + else + [acc, "\n", Protox.Encode.encode_message(field_value)] + end + end, defp(encode_keyword(acc, msg)) do + field_value = msg.keyword() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_name(acc, msg)) do + field_value = msg.name() + if(field_value == "") do + acc + else + [acc, <<26>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_description(acc, msg)) do + field_value = msg.description() + if(field_value == "") do + acc + else + [acc, "\"", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_children(acc, msg)) do + case(msg.children()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, "*", Protox.Encode.encode_message(value)] end)] + end + end, defp(encode_id(acc, msg)) do + field_value = msg.id() + if(field_value == "") do + acc + else + [acc, "2", Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.GherkinDocument.Feature.FeatureChild.Rule)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Location.decode!(delimited) + field = {:location, Protox.Message.merge(msg.location(), value)} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:keyword, value} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:name, value} + {field, rest} + {4, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:description, value} + {field, rest} + {5, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.GherkinDocument.Feature.FeatureChild.RuleChild.decode!(delimited) + field = {:children, msg.children() ++ List.wrap(value)} + {field, rest} + {6, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:id, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, 2 => {:keyword, {:default, ""}, :string}, 3 => {:name, {:default, ""}, :string}, 4 => {:description, {:default, ""}, :string}, 5 => {:children, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.FeatureChild.RuleChild}}, 6 => {:id, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{children: {5, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.FeatureChild.RuleChild}}, description: {4, {:default, ""}, :string}, id: {6, {:default, ""}, :string}, keyword: {2, {:default, ""}, :string}, location: {1, {:default, nil}, {:message, CucumberMessages.Location}}, name: {3, {:default, ""}, :string}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:location)) do + {:ok, nil} + end, def(default(:keyword)) do + {:ok, ""} + end, def(default(:name)) do + {:ok, ""} + end, def(default(:description)) do + {:ok, ""} + end, def(default(:children)) do + {:error, :no_default_value} + end, def(default(:id)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_feature_child_rule_child.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_feature_child_rule_child.ex new file mode 100644 index 0000000000..9655ec61f3 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_feature_child_rule_child.ex @@ -0,0 +1,146 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.GherkinDocument.Feature.FeatureChild.RuleChild) do + @moduledoc(false) + ( + defstruct(value: nil, __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_value(msg) |> encode_unknown_fields(msg) + end + [defp(encode_value(acc, msg)) do + case(msg.value()) do + nil -> + acc + {:background, _field_value} -> + encode_background(acc, msg) + {:scenario, _field_value} -> + encode_scenario(acc, msg) + end + end] + [defp(encode_background(acc, msg)) do + {_, field_value} = msg.value() + [acc, "\n", Protox.Encode.encode_message(field_value)] + end, defp(encode_scenario(acc, msg)) do + {_, field_value} = msg.value() + [acc, <<18>>, Protox.Encode.encode_message(field_value)] + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.GherkinDocument.Feature.FeatureChild.RuleChild)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.GherkinDocument.Feature.Background.decode!(delimited) + field = case(msg.value()) do + {:background, previous_value} -> + {:value, {:background, Protox.Message.merge(previous_value, value)}} + _ -> + {:value, {:background, value}} + end + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.GherkinDocument.Feature.Scenario.decode!(delimited) + field = case(msg.value()) do + {:scenario, previous_value} -> + {:value, {:scenario, Protox.Message.merge(previous_value, value)}} + _ -> + {:value, {:scenario, value}} + end + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:background, {:oneof, :value}, {:message, CucumberMessages.GherkinDocument.Feature.Background}}, 2 => {:scenario, {:oneof, :value}, {:message, CucumberMessages.GherkinDocument.Feature.Scenario}}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{background: {1, {:oneof, :value}, {:message, CucumberMessages.GherkinDocument.Feature.Background}}, scenario: {2, {:oneof, :value}, {:message, CucumberMessages.GherkinDocument.Feature.Scenario}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:background)) do + {:error, :no_default_value} + end, def(default(:scenario)) do + {:error, :no_default_value} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_scenario.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_scenario.ex new file mode 100644 index 0000000000..6033f634c2 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_scenario.ex @@ -0,0 +1,225 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.GherkinDocument.Feature.Scenario) do + @moduledoc(false) + ( + defstruct(location: nil, tags: [], keyword: "", name: "", description: "", steps: [], examples: [], id: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_location(msg) |> encode_tags(msg) |> encode_keyword(msg) |> encode_name(msg) |> encode_description(msg) |> encode_steps(msg) |> encode_examples(msg) |> encode_id(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_location(acc, msg)) do + field_value = msg.location() + if(field_value == nil) do + acc + else + [acc, "\n", Protox.Encode.encode_message(field_value)] + end + end, defp(encode_tags(acc, msg)) do + case(msg.tags()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, <<18>>, Protox.Encode.encode_message(value)] end)] + end + end, defp(encode_keyword(acc, msg)) do + field_value = msg.keyword() + if(field_value == "") do + acc + else + [acc, <<26>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_name(acc, msg)) do + field_value = msg.name() + if(field_value == "") do + acc + else + [acc, "\"", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_description(acc, msg)) do + field_value = msg.description() + if(field_value == "") do + acc + else + [acc, "*", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_steps(acc, msg)) do + case(msg.steps()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, "2", Protox.Encode.encode_message(value)] end)] + end + end, defp(encode_examples(acc, msg)) do + case(msg.examples()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, ":", Protox.Encode.encode_message(value)] end)] + end + end, defp(encode_id(acc, msg)) do + field_value = msg.id() + if(field_value == "") do + acc + else + [acc, "B", Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.GherkinDocument.Feature.Scenario)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Location.decode!(delimited) + field = {:location, Protox.Message.merge(msg.location(), value)} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.GherkinDocument.Feature.Tag.decode!(delimited) + field = {:tags, msg.tags() ++ List.wrap(value)} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:keyword, value} + {field, rest} + {4, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:name, value} + {field, rest} + {5, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:description, value} + {field, rest} + {6, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.GherkinDocument.Feature.Step.decode!(delimited) + field = {:steps, msg.steps() ++ List.wrap(value)} + {field, rest} + {7, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.GherkinDocument.Feature.Scenario.Examples.decode!(delimited) + field = {:examples, msg.examples() ++ List.wrap(value)} + {field, rest} + {8, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:id, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, 2 => {:tags, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Tag}}, 3 => {:keyword, {:default, ""}, :string}, 4 => {:name, {:default, ""}, :string}, 5 => {:description, {:default, ""}, :string}, 6 => {:steps, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Step}}, 7 => {:examples, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Scenario.Examples}}, 8 => {:id, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{description: {5, {:default, ""}, :string}, examples: {7, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Scenario.Examples}}, id: {8, {:default, ""}, :string}, keyword: {3, {:default, ""}, :string}, location: {1, {:default, nil}, {:message, CucumberMessages.Location}}, name: {4, {:default, ""}, :string}, steps: {6, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Step}}, tags: {2, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Tag}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:location)) do + {:ok, nil} + end, def(default(:tags)) do + {:error, :no_default_value} + end, def(default(:keyword)) do + {:ok, ""} + end, def(default(:name)) do + {:ok, ""} + end, def(default(:description)) do + {:ok, ""} + end, def(default(:steps)) do + {:error, :no_default_value} + end, def(default(:examples)) do + {:error, :no_default_value} + end, def(default(:id)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_scenario_examples.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_scenario_examples.ex new file mode 100644 index 0000000000..480be33825 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_scenario_examples.ex @@ -0,0 +1,225 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.GherkinDocument.Feature.Scenario.Examples) do + @moduledoc(false) + ( + defstruct(location: nil, tags: [], keyword: "", name: "", description: "", table_header: nil, table_body: [], id: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_location(msg) |> encode_tags(msg) |> encode_keyword(msg) |> encode_name(msg) |> encode_description(msg) |> encode_table_header(msg) |> encode_table_body(msg) |> encode_id(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_location(acc, msg)) do + field_value = msg.location() + if(field_value == nil) do + acc + else + [acc, "\n", Protox.Encode.encode_message(field_value)] + end + end, defp(encode_tags(acc, msg)) do + case(msg.tags()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, <<18>>, Protox.Encode.encode_message(value)] end)] + end + end, defp(encode_keyword(acc, msg)) do + field_value = msg.keyword() + if(field_value == "") do + acc + else + [acc, <<26>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_name(acc, msg)) do + field_value = msg.name() + if(field_value == "") do + acc + else + [acc, "\"", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_description(acc, msg)) do + field_value = msg.description() + if(field_value == "") do + acc + else + [acc, "*", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_table_header(acc, msg)) do + field_value = msg.table_header() + if(field_value == nil) do + acc + else + [acc, "2", Protox.Encode.encode_message(field_value)] + end + end, defp(encode_table_body(acc, msg)) do + case(msg.table_body()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, ":", Protox.Encode.encode_message(value)] end)] + end + end, defp(encode_id(acc, msg)) do + field_value = msg.id() + if(field_value == "") do + acc + else + [acc, "B", Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.GherkinDocument.Feature.Scenario.Examples)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Location.decode!(delimited) + field = {:location, Protox.Message.merge(msg.location(), value)} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.GherkinDocument.Feature.Tag.decode!(delimited) + field = {:tags, msg.tags() ++ List.wrap(value)} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:keyword, value} + {field, rest} + {4, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:name, value} + {field, rest} + {5, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:description, value} + {field, rest} + {6, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.GherkinDocument.Feature.TableRow.decode!(delimited) + field = {:table_header, Protox.Message.merge(msg.table_header(), value)} + {field, rest} + {7, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.GherkinDocument.Feature.TableRow.decode!(delimited) + field = {:table_body, msg.table_body() ++ List.wrap(value)} + {field, rest} + {8, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:id, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, 2 => {:tags, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Tag}}, 3 => {:keyword, {:default, ""}, :string}, 4 => {:name, {:default, ""}, :string}, 5 => {:description, {:default, ""}, :string}, 6 => {:table_header, {:default, nil}, {:message, CucumberMessages.GherkinDocument.Feature.TableRow}}, 7 => {:table_body, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.TableRow}}, 8 => {:id, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{description: {5, {:default, ""}, :string}, id: {8, {:default, ""}, :string}, keyword: {3, {:default, ""}, :string}, location: {1, {:default, nil}, {:message, CucumberMessages.Location}}, name: {4, {:default, ""}, :string}, table_body: {7, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.TableRow}}, table_header: {6, {:default, nil}, {:message, CucumberMessages.GherkinDocument.Feature.TableRow}}, tags: {2, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Tag}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:location)) do + {:ok, nil} + end, def(default(:tags)) do + {:error, :no_default_value} + end, def(default(:keyword)) do + {:ok, ""} + end, def(default(:name)) do + {:ok, ""} + end, def(default(:description)) do + {:ok, ""} + end, def(default(:table_header)) do + {:ok, nil} + end, def(default(:table_body)) do + {:error, :no_default_value} + end, def(default(:id)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_step.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_step.ex new file mode 100644 index 0000000000..1e8b01ed28 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_step.ex @@ -0,0 +1,206 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.GherkinDocument.Feature.Step) do + @moduledoc(false) + ( + defstruct(location: nil, keyword: "", text: "", argument: nil, id: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_argument(msg) |> encode_location(msg) |> encode_keyword(msg) |> encode_text(msg) |> encode_id(msg) |> encode_unknown_fields(msg) + end + [defp(encode_argument(acc, msg)) do + case(msg.argument()) do + nil -> + acc + {:doc_string, _field_value} -> + encode_doc_string(acc, msg) + {:data_table, _field_value} -> + encode_data_table(acc, msg) + end + end] + [defp(encode_location(acc, msg)) do + field_value = msg.location() + if(field_value == nil) do + acc + else + [acc, "\n", Protox.Encode.encode_message(field_value)] + end + end, defp(encode_keyword(acc, msg)) do + field_value = msg.keyword() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_text(acc, msg)) do + field_value = msg.text() + if(field_value == "") do + acc + else + [acc, <<26>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_doc_string(acc, msg)) do + {_, field_value} = msg.argument() + [acc, "\"", Protox.Encode.encode_message(field_value)] + end, defp(encode_data_table(acc, msg)) do + {_, field_value} = msg.argument() + [acc, "*", Protox.Encode.encode_message(field_value)] + end, defp(encode_id(acc, msg)) do + field_value = msg.id() + if(field_value == "") do + acc + else + [acc, "2", Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.GherkinDocument.Feature.Step)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Location.decode!(delimited) + field = {:location, Protox.Message.merge(msg.location(), value)} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:keyword, value} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:text, value} + {field, rest} + {4, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.GherkinDocument.Feature.Step.DocString.decode!(delimited) + field = case(msg.argument()) do + {:doc_string, previous_value} -> + {:argument, {:doc_string, Protox.Message.merge(previous_value, value)}} + _ -> + {:argument, {:doc_string, value}} + end + {field, rest} + {5, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.GherkinDocument.Feature.Step.DataTable.decode!(delimited) + field = case(msg.argument()) do + {:data_table, previous_value} -> + {:argument, {:data_table, Protox.Message.merge(previous_value, value)}} + _ -> + {:argument, {:data_table, value}} + end + {field, rest} + {6, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:id, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, 2 => {:keyword, {:default, ""}, :string}, 3 => {:text, {:default, ""}, :string}, 4 => {:doc_string, {:oneof, :argument}, {:message, CucumberMessages.GherkinDocument.Feature.Step.DocString}}, 5 => {:data_table, {:oneof, :argument}, {:message, CucumberMessages.GherkinDocument.Feature.Step.DataTable}}, 6 => {:id, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{data_table: {5, {:oneof, :argument}, {:message, CucumberMessages.GherkinDocument.Feature.Step.DataTable}}, doc_string: {4, {:oneof, :argument}, {:message, CucumberMessages.GherkinDocument.Feature.Step.DocString}}, id: {6, {:default, ""}, :string}, keyword: {2, {:default, ""}, :string}, location: {1, {:default, nil}, {:message, CucumberMessages.Location}}, text: {3, {:default, ""}, :string}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:location)) do + {:ok, nil} + end, def(default(:keyword)) do + {:ok, ""} + end, def(default(:text)) do + {:ok, ""} + end, def(default(:doc_string)) do + {:error, :no_default_value} + end, def(default(:data_table)) do + {:error, :no_default_value} + end, def(default(:id)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_step_data_table.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_step_data_table.ex new file mode 100644 index 0000000000..f3873d0761 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_step_data_table.ex @@ -0,0 +1,135 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.GherkinDocument.Feature.Step.DataTable) do + @moduledoc(false) + ( + defstruct(location: nil, rows: [], __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_location(msg) |> encode_rows(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_location(acc, msg)) do + field_value = msg.location() + if(field_value == nil) do + acc + else + [acc, "\n", Protox.Encode.encode_message(field_value)] + end + end, defp(encode_rows(acc, msg)) do + case(msg.rows()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, <<18>>, Protox.Encode.encode_message(value)] end)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.GherkinDocument.Feature.Step.DataTable)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Location.decode!(delimited) + field = {:location, Protox.Message.merge(msg.location(), value)} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.GherkinDocument.Feature.TableRow.decode!(delimited) + field = {:rows, msg.rows() ++ List.wrap(value)} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, 2 => {:rows, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.TableRow}}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{location: {1, {:default, nil}, {:message, CucumberMessages.Location}}, rows: {2, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.TableRow}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:location)) do + {:ok, nil} + end, def(default(:rows)) do + {:error, :no_default_value} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_step_doc_string.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_step_doc_string.ex new file mode 100644 index 0000000000..cb918375ae --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_step_doc_string.ex @@ -0,0 +1,165 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.GherkinDocument.Feature.Step.DocString) do + @moduledoc(false) + ( + defstruct(location: nil, media_type: "", content: "", delimiter: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_location(msg) |> encode_media_type(msg) |> encode_content(msg) |> encode_delimiter(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_location(acc, msg)) do + field_value = msg.location() + if(field_value == nil) do + acc + else + [acc, "\n", Protox.Encode.encode_message(field_value)] + end + end, defp(encode_media_type(acc, msg)) do + field_value = msg.media_type() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_content(acc, msg)) do + field_value = msg.content() + if(field_value == "") do + acc + else + [acc, <<26>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_delimiter(acc, msg)) do + field_value = msg.delimiter() + if(field_value == "") do + acc + else + [acc, "\"", Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.GherkinDocument.Feature.Step.DocString)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Location.decode!(delimited) + field = {:location, Protox.Message.merge(msg.location(), value)} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:media_type, value} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:content, value} + {field, rest} + {4, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:delimiter, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, 2 => {:media_type, {:default, ""}, :string}, 3 => {:content, {:default, ""}, :string}, 4 => {:delimiter, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{content: {3, {:default, ""}, :string}, delimiter: {4, {:default, ""}, :string}, location: {1, {:default, nil}, {:message, CucumberMessages.Location}}, media_type: {2, {:default, ""}, :string}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:location)) do + {:ok, nil} + end, def(default(:media_type)) do + {:ok, ""} + end, def(default(:content)) do + {:ok, ""} + end, def(default(:delimiter)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_table_row.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_table_row.ex new file mode 100644 index 0000000000..8226b57a84 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_table_row.ex @@ -0,0 +1,150 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.GherkinDocument.Feature.TableRow) do + @moduledoc(false) + ( + defstruct(location: nil, cells: [], id: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_location(msg) |> encode_cells(msg) |> encode_id(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_location(acc, msg)) do + field_value = msg.location() + if(field_value == nil) do + acc + else + [acc, "\n", Protox.Encode.encode_message(field_value)] + end + end, defp(encode_cells(acc, msg)) do + case(msg.cells()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, <<18>>, Protox.Encode.encode_message(value)] end)] + end + end, defp(encode_id(acc, msg)) do + field_value = msg.id() + if(field_value == "") do + acc + else + [acc, <<26>>, Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.GherkinDocument.Feature.TableRow)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Location.decode!(delimited) + field = {:location, Protox.Message.merge(msg.location(), value)} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.GherkinDocument.Feature.TableRow.TableCell.decode!(delimited) + field = {:cells, msg.cells() ++ List.wrap(value)} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:id, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, 2 => {:cells, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.TableRow.TableCell}}, 3 => {:id, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{cells: {2, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.TableRow.TableCell}}, id: {3, {:default, ""}, :string}, location: {1, {:default, nil}, {:message, CucumberMessages.Location}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:location)) do + {:ok, nil} + end, def(default(:cells)) do + {:error, :no_default_value} + end, def(default(:id)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_table_row_table_cell.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_table_row_table_cell.ex new file mode 100644 index 0000000000..88f4c5d49f --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_table_row_table_cell.ex @@ -0,0 +1,135 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.GherkinDocument.Feature.TableRow.TableCell) do + @moduledoc(false) + ( + defstruct(location: nil, value: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_location(msg) |> encode_value(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_location(acc, msg)) do + field_value = msg.location() + if(field_value == nil) do + acc + else + [acc, "\n", Protox.Encode.encode_message(field_value)] + end + end, defp(encode_value(acc, msg)) do + field_value = msg.value() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.GherkinDocument.Feature.TableRow.TableCell)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Location.decode!(delimited) + field = {:location, Protox.Message.merge(msg.location(), value)} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:value, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, 2 => {:value, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{location: {1, {:default, nil}, {:message, CucumberMessages.Location}}, value: {2, {:default, ""}, :string}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:location)) do + {:ok, nil} + end, def(default(:value)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_tag.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_tag.ex new file mode 100644 index 0000000000..d8835c038b --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_gherkin_document_feature_tag.ex @@ -0,0 +1,150 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.GherkinDocument.Feature.Tag) do + @moduledoc(false) + ( + defstruct(location: nil, name: "", id: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_location(msg) |> encode_name(msg) |> encode_id(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_location(acc, msg)) do + field_value = msg.location() + if(field_value == nil) do + acc + else + [acc, "\n", Protox.Encode.encode_message(field_value)] + end + end, defp(encode_name(acc, msg)) do + field_value = msg.name() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_id(acc, msg)) do + field_value = msg.id() + if(field_value == "") do + acc + else + [acc, <<26>>, Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.GherkinDocument.Feature.Tag)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Location.decode!(delimited) + field = {:location, Protox.Message.merge(msg.location(), value)} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:name, value} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:id, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, 2 => {:name, {:default, ""}, :string}, 3 => {:id, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{id: {3, {:default, ""}, :string}, location: {1, {:default, nil}, {:message, CucumberMessages.Location}}, name: {2, {:default, ""}, :string}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:location)) do + {:ok, nil} + end, def(default(:name)) do + {:ok, ""} + end, def(default(:id)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_hook.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_hook.ex new file mode 100644 index 0000000000..4a438f4787 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_hook.ex @@ -0,0 +1,150 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.Hook) do + @moduledoc(false) + ( + defstruct(id: "", tag_expression: "", source_reference: nil, __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_id(msg) |> encode_tag_expression(msg) |> encode_source_reference(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_id(acc, msg)) do + field_value = msg.id() + if(field_value == "") do + acc + else + [acc, "\n", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_tag_expression(acc, msg)) do + field_value = msg.tag_expression() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_source_reference(acc, msg)) do + field_value = msg.source_reference() + if(field_value == nil) do + acc + else + [acc, <<26>>, Protox.Encode.encode_message(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.Hook)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:id, value} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:tag_expression, value} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.SourceReference.decode!(delimited) + field = {:source_reference, Protox.Message.merge(msg.source_reference(), value)} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:id, {:default, ""}, :string}, 2 => {:tag_expression, {:default, ""}, :string}, 3 => {:source_reference, {:default, nil}, {:message, CucumberMessages.SourceReference}}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{id: {1, {:default, ""}, :string}, source_reference: {3, {:default, nil}, {:message, CucumberMessages.SourceReference}}, tag_expression: {2, {:default, ""}, :string}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:id)) do + {:ok, ""} + end, def(default(:tag_expression)) do + {:ok, ""} + end, def(default(:source_reference)) do + {:ok, nil} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_location.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_location.ex new file mode 100644 index 0000000000..c8f8f63bff --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_location.ex @@ -0,0 +1,131 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.Location) do + @moduledoc(false) + ( + defstruct(line: 0, column: 0, __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_line(msg) |> encode_column(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_line(acc, msg)) do + field_value = msg.line() + if(field_value == 0) do + acc + else + [acc, "\b", Protox.Encode.encode_uint32(field_value)] + end + end, defp(encode_column(acc, msg)) do + field_value = msg.column() + if(field_value == 0) do + acc + else + [acc, <<16>>, Protox.Encode.encode_uint32(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.Location)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {value, rest} = Protox.Decode.parse_uint32(bytes) + field = {:line, value} + {field, rest} + {2, _, bytes} -> + {value, rest} = Protox.Decode.parse_uint32(bytes) + field = {:column, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:line, {:default, 0}, :uint32}, 2 => {:column, {:default, 0}, :uint32}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{column: {2, {:default, 0}, :uint32}, line: {1, {:default, 0}, :uint32}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:line)) do + {:ok, 0} + end, def(default(:column)) do + {:ok, 0} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_meta.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_meta.ex new file mode 100644 index 0000000000..0c518ff314 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_meta.ex @@ -0,0 +1,195 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.Meta) do + @moduledoc(false) + ( + defstruct(protocol_version: "", implementation: nil, runtime: nil, os: nil, cpu: nil, ci: nil, __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_protocol_version(msg) |> encode_implementation(msg) |> encode_runtime(msg) |> encode_os(msg) |> encode_cpu(msg) |> encode_ci(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_protocol_version(acc, msg)) do + field_value = msg.protocol_version() + if(field_value == "") do + acc + else + [acc, "\n", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_implementation(acc, msg)) do + field_value = msg.implementation() + if(field_value == nil) do + acc + else + [acc, <<18>>, Protox.Encode.encode_message(field_value)] + end + end, defp(encode_runtime(acc, msg)) do + field_value = msg.runtime() + if(field_value == nil) do + acc + else + [acc, <<26>>, Protox.Encode.encode_message(field_value)] + end + end, defp(encode_os(acc, msg)) do + field_value = msg.os() + if(field_value == nil) do + acc + else + [acc, "\"", Protox.Encode.encode_message(field_value)] + end + end, defp(encode_cpu(acc, msg)) do + field_value = msg.cpu() + if(field_value == nil) do + acc + else + [acc, "*", Protox.Encode.encode_message(field_value)] + end + end, defp(encode_ci(acc, msg)) do + field_value = msg.ci() + if(field_value == nil) do + acc + else + [acc, "2", Protox.Encode.encode_message(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.Meta)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:protocol_version, value} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Meta.Product.decode!(delimited) + field = {:implementation, Protox.Message.merge(msg.implementation(), value)} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Meta.Product.decode!(delimited) + field = {:runtime, Protox.Message.merge(msg.runtime(), value)} + {field, rest} + {4, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Meta.Product.decode!(delimited) + field = {:os, Protox.Message.merge(msg.os(), value)} + {field, rest} + {5, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Meta.Product.decode!(delimited) + field = {:cpu, Protox.Message.merge(msg.cpu(), value)} + {field, rest} + {6, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Meta.CI.decode!(delimited) + field = {:ci, Protox.Message.merge(msg.ci(), value)} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:protocol_version, {:default, ""}, :string}, 2 => {:implementation, {:default, nil}, {:message, CucumberMessages.Meta.Product}}, 3 => {:runtime, {:default, nil}, {:message, CucumberMessages.Meta.Product}}, 4 => {:os, {:default, nil}, {:message, CucumberMessages.Meta.Product}}, 5 => {:cpu, {:default, nil}, {:message, CucumberMessages.Meta.Product}}, 6 => {:ci, {:default, nil}, {:message, CucumberMessages.Meta.CI}}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{ci: {6, {:default, nil}, {:message, CucumberMessages.Meta.CI}}, cpu: {5, {:default, nil}, {:message, CucumberMessages.Meta.Product}}, implementation: {2, {:default, nil}, {:message, CucumberMessages.Meta.Product}}, os: {4, {:default, nil}, {:message, CucumberMessages.Meta.Product}}, protocol_version: {1, {:default, ""}, :string}, runtime: {3, {:default, nil}, {:message, CucumberMessages.Meta.Product}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:protocol_version)) do + {:ok, ""} + end, def(default(:implementation)) do + {:ok, nil} + end, def(default(:runtime)) do + {:ok, nil} + end, def(default(:os)) do + {:ok, nil} + end, def(default(:cpu)) do + {:ok, nil} + end, def(default(:ci)) do + {:ok, nil} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_meta_ci.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_meta_ci.ex new file mode 100644 index 0000000000..30e453f902 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_meta_ci.ex @@ -0,0 +1,150 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.Meta.CI) do + @moduledoc(false) + ( + defstruct(name: "", url: "", git: nil, __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_name(msg) |> encode_url(msg) |> encode_git(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_name(acc, msg)) do + field_value = msg.name() + if(field_value == "") do + acc + else + [acc, "\n", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_url(acc, msg)) do + field_value = msg.url() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_git(acc, msg)) do + field_value = msg.git() + if(field_value == nil) do + acc + else + [acc, <<26>>, Protox.Encode.encode_message(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.Meta.CI)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:name, value} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:url, value} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Meta.CI.Git.decode!(delimited) + field = {:git, Protox.Message.merge(msg.git(), value)} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:name, {:default, ""}, :string}, 2 => {:url, {:default, ""}, :string}, 3 => {:git, {:default, nil}, {:message, CucumberMessages.Meta.CI.Git}}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{git: {3, {:default, nil}, {:message, CucumberMessages.Meta.CI.Git}}, name: {1, {:default, ""}, :string}, url: {2, {:default, ""}, :string}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:name)) do + {:ok, ""} + end, def(default(:url)) do + {:ok, ""} + end, def(default(:git)) do + {:ok, nil} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_meta_ci_git.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_meta_ci_git.ex new file mode 100644 index 0000000000..31f91983c8 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_meta_ci_git.ex @@ -0,0 +1,165 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.Meta.CI.Git) do + @moduledoc(false) + ( + defstruct(remote: "", revision: "", branch: "", tag: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_remote(msg) |> encode_revision(msg) |> encode_branch(msg) |> encode_tag(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_remote(acc, msg)) do + field_value = msg.remote() + if(field_value == "") do + acc + else + [acc, "\n", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_revision(acc, msg)) do + field_value = msg.revision() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_branch(acc, msg)) do + field_value = msg.branch() + if(field_value == "") do + acc + else + [acc, <<26>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_tag(acc, msg)) do + field_value = msg.tag() + if(field_value == "") do + acc + else + [acc, "\"", Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.Meta.CI.Git)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:remote, value} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:revision, value} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:branch, value} + {field, rest} + {4, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:tag, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:remote, {:default, ""}, :string}, 2 => {:revision, {:default, ""}, :string}, 3 => {:branch, {:default, ""}, :string}, 4 => {:tag, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{branch: {3, {:default, ""}, :string}, remote: {1, {:default, ""}, :string}, revision: {2, {:default, ""}, :string}, tag: {4, {:default, ""}, :string}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:remote)) do + {:ok, ""} + end, def(default(:revision)) do + {:ok, ""} + end, def(default(:branch)) do + {:ok, ""} + end, def(default(:tag)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_meta_product.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_meta_product.ex new file mode 100644 index 0000000000..5f3f2a6962 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_meta_product.ex @@ -0,0 +1,135 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.Meta.Product) do + @moduledoc(false) + ( + defstruct(name: "", version: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_name(msg) |> encode_version(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_name(acc, msg)) do + field_value = msg.name() + if(field_value == "") do + acc + else + [acc, "\n", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_version(acc, msg)) do + field_value = msg.version() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.Meta.Product)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:name, value} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:version, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:name, {:default, ""}, :string}, 2 => {:version, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{name: {1, {:default, ""}, :string}, version: {2, {:default, ""}, :string}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:name)) do + {:ok, ""} + end, def(default(:version)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_parameter_type.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_parameter_type.ex new file mode 100644 index 0000000000..2471545bcb --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_parameter_type.ex @@ -0,0 +1,176 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.ParameterType) do + @moduledoc(false) + ( + defstruct(name: "", regular_expressions: [], prefer_for_regular_expression_match: false, use_for_snippets: false, id: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_name(msg) |> encode_regular_expressions(msg) |> encode_prefer_for_regular_expression_match(msg) |> encode_use_for_snippets(msg) |> encode_id(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_name(acc, msg)) do + field_value = msg.name() + if(field_value == "") do + acc + else + [acc, "\n", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_regular_expressions(acc, msg)) do + case(msg.regular_expressions()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, <<18>>, Protox.Encode.encode_string(value)] end)] + end + end, defp(encode_prefer_for_regular_expression_match(acc, msg)) do + field_value = msg.prefer_for_regular_expression_match() + if(field_value == false) do + acc + else + [acc, <<24>>, Protox.Encode.encode_bool(field_value)] + end + end, defp(encode_use_for_snippets(acc, msg)) do + field_value = msg.use_for_snippets() + if(field_value == false) do + acc + else + [acc, " ", Protox.Encode.encode_bool(field_value)] + end + end, defp(encode_id(acc, msg)) do + field_value = msg.id() + if(field_value == "") do + acc + else + [acc, "*", Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.ParameterType)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:name, value} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:regular_expressions, msg.regular_expressions() ++ List.wrap(value)} + {field, rest} + {3, _, bytes} -> + {value, rest} = Protox.Decode.parse_bool(bytes) + field = {:prefer_for_regular_expression_match, value} + {field, rest} + {4, _, bytes} -> + {value, rest} = Protox.Decode.parse_bool(bytes) + field = {:use_for_snippets, value} + {field, rest} + {5, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:id, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:name, {:default, ""}, :string}, 2 => {:regular_expressions, :unpacked, :string}, 3 => {:prefer_for_regular_expression_match, {:default, false}, :bool}, 4 => {:use_for_snippets, {:default, false}, :bool}, 5 => {:id, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{id: {5, {:default, ""}, :string}, name: {1, {:default, ""}, :string}, prefer_for_regular_expression_match: {3, {:default, false}, :bool}, regular_expressions: {2, :unpacked, :string}, use_for_snippets: {4, {:default, false}, :bool}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:name)) do + {:ok, ""} + end, def(default(:regular_expressions)) do + {:error, :no_default_value} + end, def(default(:prefer_for_regular_expression_match)) do + {:ok, false} + end, def(default(:use_for_snippets)) do + {:ok, false} + end, def(default(:id)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_parse_error.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_parse_error.ex new file mode 100644 index 0000000000..1b9e5ad87a --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_parse_error.ex @@ -0,0 +1,135 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.ParseError) do + @moduledoc(false) + ( + defstruct(source: nil, message: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_source(msg) |> encode_message(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_source(acc, msg)) do + field_value = msg.source() + if(field_value == nil) do + acc + else + [acc, "\n", Protox.Encode.encode_message(field_value)] + end + end, defp(encode_message(acc, msg)) do + field_value = msg.message() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.ParseError)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.SourceReference.decode!(delimited) + field = {:source, Protox.Message.merge(msg.source(), value)} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:message, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:source, {:default, nil}, {:message, CucumberMessages.SourceReference}}, 2 => {:message, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{message: {2, {:default, ""}, :string}, source: {1, {:default, nil}, {:message, CucumberMessages.SourceReference}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:source)) do + {:ok, nil} + end, def(default(:message)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle.ex new file mode 100644 index 0000000000..0fc744db5a --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle.ex @@ -0,0 +1,210 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.Pickle) do + @moduledoc(false) + ( + defstruct(id: "", uri: "", name: "", language: "", steps: [], tags: [], ast_node_ids: [], __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_id(msg) |> encode_uri(msg) |> encode_name(msg) |> encode_language(msg) |> encode_steps(msg) |> encode_tags(msg) |> encode_ast_node_ids(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_id(acc, msg)) do + field_value = msg.id() + if(field_value == "") do + acc + else + [acc, "\n", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_uri(acc, msg)) do + field_value = msg.uri() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_name(acc, msg)) do + field_value = msg.name() + if(field_value == "") do + acc + else + [acc, <<26>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_language(acc, msg)) do + field_value = msg.language() + if(field_value == "") do + acc + else + [acc, "\"", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_steps(acc, msg)) do + case(msg.steps()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, "*", Protox.Encode.encode_message(value)] end)] + end + end, defp(encode_tags(acc, msg)) do + case(msg.tags()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, "2", Protox.Encode.encode_message(value)] end)] + end + end, defp(encode_ast_node_ids(acc, msg)) do + case(msg.ast_node_ids()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, ":", Protox.Encode.encode_string(value)] end)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.Pickle)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:id, value} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:uri, value} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:name, value} + {field, rest} + {4, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:language, value} + {field, rest} + {5, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Pickle.PickleStep.decode!(delimited) + field = {:steps, msg.steps() ++ List.wrap(value)} + {field, rest} + {6, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Pickle.PickleTag.decode!(delimited) + field = {:tags, msg.tags() ++ List.wrap(value)} + {field, rest} + {7, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:ast_node_ids, msg.ast_node_ids() ++ List.wrap(value)} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:id, {:default, ""}, :string}, 2 => {:uri, {:default, ""}, :string}, 3 => {:name, {:default, ""}, :string}, 4 => {:language, {:default, ""}, :string}, 5 => {:steps, :unpacked, {:message, CucumberMessages.Pickle.PickleStep}}, 6 => {:tags, :unpacked, {:message, CucumberMessages.Pickle.PickleTag}}, 7 => {:ast_node_ids, :unpacked, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{ast_node_ids: {7, :unpacked, :string}, id: {1, {:default, ""}, :string}, language: {4, {:default, ""}, :string}, name: {3, {:default, ""}, :string}, steps: {5, :unpacked, {:message, CucumberMessages.Pickle.PickleStep}}, tags: {6, :unpacked, {:message, CucumberMessages.Pickle.PickleTag}}, uri: {2, {:default, ""}, :string}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:id)) do + {:ok, ""} + end, def(default(:uri)) do + {:ok, ""} + end, def(default(:name)) do + {:ok, ""} + end, def(default(:language)) do + {:ok, ""} + end, def(default(:steps)) do + {:error, :no_default_value} + end, def(default(:tags)) do + {:error, :no_default_value} + end, def(default(:ast_node_ids)) do + {:error, :no_default_value} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle_pickle_step.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle_pickle_step.ex new file mode 100644 index 0000000000..cb6830b077 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle_pickle_step.ex @@ -0,0 +1,165 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.Pickle.PickleStep) do + @moduledoc(false) + ( + defstruct(text: "", argument: nil, id: "", ast_node_ids: [], __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_text(msg) |> encode_argument(msg) |> encode_id(msg) |> encode_ast_node_ids(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_text(acc, msg)) do + field_value = msg.text() + if(field_value == "") do + acc + else + [acc, "\n", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_argument(acc, msg)) do + field_value = msg.argument() + if(field_value == nil) do + acc + else + [acc, <<18>>, Protox.Encode.encode_message(field_value)] + end + end, defp(encode_id(acc, msg)) do + field_value = msg.id() + if(field_value == "") do + acc + else + [acc, <<26>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_ast_node_ids(acc, msg)) do + case(msg.ast_node_ids()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, "\"", Protox.Encode.encode_string(value)] end)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.Pickle.PickleStep)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:text, value} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.PickleStepArgument.decode!(delimited) + field = {:argument, Protox.Message.merge(msg.argument(), value)} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:id, value} + {field, rest} + {4, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:ast_node_ids, msg.ast_node_ids() ++ List.wrap(value)} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:text, {:default, ""}, :string}, 2 => {:argument, {:default, nil}, {:message, CucumberMessages.PickleStepArgument}}, 3 => {:id, {:default, ""}, :string}, 4 => {:ast_node_ids, :unpacked, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{argument: {2, {:default, nil}, {:message, CucumberMessages.PickleStepArgument}}, ast_node_ids: {4, :unpacked, :string}, id: {3, {:default, ""}, :string}, text: {1, {:default, ""}, :string}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:text)) do + {:ok, ""} + end, def(default(:argument)) do + {:ok, nil} + end, def(default(:id)) do + {:ok, ""} + end, def(default(:ast_node_ids)) do + {:error, :no_default_value} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle_pickle_tag.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle_pickle_tag.ex new file mode 100644 index 0000000000..a439bae163 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle_pickle_tag.ex @@ -0,0 +1,135 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.Pickle.PickleTag) do + @moduledoc(false) + ( + defstruct(name: "", ast_node_id: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_name(msg) |> encode_ast_node_id(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_name(acc, msg)) do + field_value = msg.name() + if(field_value == "") do + acc + else + [acc, "\n", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_ast_node_id(acc, msg)) do + field_value = msg.ast_node_id() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.Pickle.PickleTag)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:name, value} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:ast_node_id, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:name, {:default, ""}, :string}, 2 => {:ast_node_id, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{ast_node_id: {2, {:default, ""}, :string}, name: {1, {:default, ""}, :string}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:name)) do + {:ok, ""} + end, def(default(:ast_node_id)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle_step_argument.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle_step_argument.ex new file mode 100644 index 0000000000..2ed426a982 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle_step_argument.ex @@ -0,0 +1,146 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.PickleStepArgument) do + @moduledoc(false) + ( + defstruct(message: nil, __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_message(msg) |> encode_unknown_fields(msg) + end + [defp(encode_message(acc, msg)) do + case(msg.message()) do + nil -> + acc + {:doc_string, _field_value} -> + encode_doc_string(acc, msg) + {:data_table, _field_value} -> + encode_data_table(acc, msg) + end + end] + [defp(encode_doc_string(acc, msg)) do + {_, field_value} = msg.message() + [acc, "\n", Protox.Encode.encode_message(field_value)] + end, defp(encode_data_table(acc, msg)) do + {_, field_value} = msg.message() + [acc, <<18>>, Protox.Encode.encode_message(field_value)] + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.PickleStepArgument)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.PickleStepArgument.PickleDocString.decode!(delimited) + field = case(msg.message()) do + {:doc_string, previous_value} -> + {:message, {:doc_string, Protox.Message.merge(previous_value, value)}} + _ -> + {:message, {:doc_string, value}} + end + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.PickleStepArgument.PickleTable.decode!(delimited) + field = case(msg.message()) do + {:data_table, previous_value} -> + {:message, {:data_table, Protox.Message.merge(previous_value, value)}} + _ -> + {:message, {:data_table, value}} + end + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:doc_string, {:oneof, :message}, {:message, CucumberMessages.PickleStepArgument.PickleDocString}}, 2 => {:data_table, {:oneof, :message}, {:message, CucumberMessages.PickleStepArgument.PickleTable}}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{data_table: {2, {:oneof, :message}, {:message, CucumberMessages.PickleStepArgument.PickleTable}}, doc_string: {1, {:oneof, :message}, {:message, CucumberMessages.PickleStepArgument.PickleDocString}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:doc_string)) do + {:error, :no_default_value} + end, def(default(:data_table)) do + {:error, :no_default_value} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle_step_argument_pickle_doc_string.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle_step_argument_pickle_doc_string.ex new file mode 100644 index 0000000000..75c1cf1981 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle_step_argument_pickle_doc_string.ex @@ -0,0 +1,135 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.PickleStepArgument.PickleDocString) do + @moduledoc(false) + ( + defstruct(media_type: "", content: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_media_type(msg) |> encode_content(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_media_type(acc, msg)) do + field_value = msg.media_type() + if(field_value == "") do + acc + else + [acc, "\n", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_content(acc, msg)) do + field_value = msg.content() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.PickleStepArgument.PickleDocString)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:media_type, value} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:content, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:media_type, {:default, ""}, :string}, 2 => {:content, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{content: {2, {:default, ""}, :string}, media_type: {1, {:default, ""}, :string}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:media_type)) do + {:ok, ""} + end, def(default(:content)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle_step_argument_pickle_table.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle_step_argument_pickle_table.ex new file mode 100644 index 0000000000..7e92769b68 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle_step_argument_pickle_table.ex @@ -0,0 +1,120 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.PickleStepArgument.PickleTable) do + @moduledoc(false) + ( + defstruct(rows: [], __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_rows(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_rows(acc, msg)) do + case(msg.rows()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, "\n", Protox.Encode.encode_message(value)] end)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.PickleStepArgument.PickleTable)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.PickleStepArgument.PickleTable.PickleTableRow.decode!(delimited) + field = {:rows, msg.rows() ++ List.wrap(value)} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:rows, :unpacked, {:message, CucumberMessages.PickleStepArgument.PickleTable.PickleTableRow}}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{rows: {1, :unpacked, {:message, CucumberMessages.PickleStepArgument.PickleTable.PickleTableRow}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:rows)) do + {:error, :no_default_value} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle_step_argument_pickle_table_pickle_table_row.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle_step_argument_pickle_table_pickle_table_row.ex new file mode 100644 index 0000000000..f53b123c4f --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle_step_argument_pickle_table_pickle_table_row.ex @@ -0,0 +1,120 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.PickleStepArgument.PickleTable.PickleTableRow) do + @moduledoc(false) + ( + defstruct(cells: [], __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_cells(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_cells(acc, msg)) do + case(msg.cells()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, "\n", Protox.Encode.encode_message(value)] end)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.PickleStepArgument.PickleTable.PickleTableRow)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.PickleStepArgument.PickleTable.PickleTableRow.PickleTableCell.decode!(delimited) + field = {:cells, msg.cells() ++ List.wrap(value)} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:cells, :unpacked, {:message, CucumberMessages.PickleStepArgument.PickleTable.PickleTableRow.PickleTableCell}}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{cells: {1, :unpacked, {:message, CucumberMessages.PickleStepArgument.PickleTable.PickleTableRow.PickleTableCell}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:cells)) do + {:error, :no_default_value} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle_step_argument_pickle_table_pickle_table_row_pickle_table_cell.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle_step_argument_pickle_table_pickle_table_row_pickle_table_cell.ex new file mode 100644 index 0000000000..db1f05bf7c --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_pickle_step_argument_pickle_table_pickle_table_row_pickle_table_cell.ex @@ -0,0 +1,120 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.PickleStepArgument.PickleTable.PickleTableRow.PickleTableCell) do + @moduledoc(false) + ( + defstruct(value: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_value(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_value(acc, msg)) do + field_value = msg.value() + if(field_value == "") do + acc + else + [acc, "\n", Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.PickleStepArgument.PickleTable.PickleTableRow.PickleTableCell)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:value, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:value, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{value: {1, {:default, ""}, :string}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:value)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_source.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_source.ex new file mode 100644 index 0000000000..ce2f09d3e9 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_source.ex @@ -0,0 +1,150 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.Source) do + @moduledoc(false) + ( + defstruct(uri: "", data: "", media_type: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_uri(msg) |> encode_data(msg) |> encode_media_type(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_uri(acc, msg)) do + field_value = msg.uri() + if(field_value == "") do + acc + else + [acc, "\n", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_data(acc, msg)) do + field_value = msg.data() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_media_type(acc, msg)) do + field_value = msg.media_type() + if(field_value == "") do + acc + else + [acc, <<26>>, Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.Source)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:uri, value} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:data, value} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:media_type, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:uri, {:default, ""}, :string}, 2 => {:data, {:default, ""}, :string}, 3 => {:media_type, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{data: {2, {:default, ""}, :string}, media_type: {3, {:default, ""}, :string}, uri: {1, {:default, ""}, :string}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:uri)) do + {:ok, ""} + end, def(default(:data)) do + {:ok, ""} + end, def(default(:media_type)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_source_reference.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_source_reference.ex new file mode 100644 index 0000000000..8363d2be9b --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_source_reference.ex @@ -0,0 +1,135 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.SourceReference) do + @moduledoc(false) + ( + defstruct(uri: "", location: nil, __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_uri(msg) |> encode_location(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_uri(acc, msg)) do + field_value = msg.uri() + if(field_value == "") do + acc + else + [acc, "\n", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_location(acc, msg)) do + field_value = msg.location() + if(field_value == nil) do + acc + else + [acc, <<18>>, Protox.Encode.encode_message(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.SourceReference)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:uri, value} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Location.decode!(delimited) + field = {:location, Protox.Message.merge(msg.location(), value)} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:uri, {:default, ""}, :string}, 2 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{location: {2, {:default, nil}, {:message, CucumberMessages.Location}}, uri: {1, {:default, ""}, :string}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:uri)) do + {:ok, ""} + end, def(default(:location)) do + {:ok, nil} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_step_definition.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_step_definition.ex new file mode 100644 index 0000000000..7ae35fa92b --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_step_definition.ex @@ -0,0 +1,150 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.StepDefinition) do + @moduledoc(false) + ( + defstruct(id: "", pattern: nil, source_reference: nil, __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_id(msg) |> encode_pattern(msg) |> encode_source_reference(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_id(acc, msg)) do + field_value = msg.id() + if(field_value == "") do + acc + else + [acc, "\n", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_pattern(acc, msg)) do + field_value = msg.pattern() + if(field_value == nil) do + acc + else + [acc, <<18>>, Protox.Encode.encode_message(field_value)] + end + end, defp(encode_source_reference(acc, msg)) do + field_value = msg.source_reference() + if(field_value == nil) do + acc + else + [acc, <<26>>, Protox.Encode.encode_message(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.StepDefinition)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:id, value} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.StepDefinition.StepDefinitionPattern.decode!(delimited) + field = {:pattern, Protox.Message.merge(msg.pattern(), value)} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.SourceReference.decode!(delimited) + field = {:source_reference, Protox.Message.merge(msg.source_reference(), value)} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:id, {:default, ""}, :string}, 2 => {:pattern, {:default, nil}, {:message, CucumberMessages.StepDefinition.StepDefinitionPattern}}, 3 => {:source_reference, {:default, nil}, {:message, CucumberMessages.SourceReference}}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{id: {1, {:default, ""}, :string}, pattern: {2, {:default, nil}, {:message, CucumberMessages.StepDefinition.StepDefinitionPattern}}, source_reference: {3, {:default, nil}, {:message, CucumberMessages.SourceReference}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:id)) do + {:ok, ""} + end, def(default(:pattern)) do + {:ok, nil} + end, def(default(:source_reference)) do + {:ok, nil} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_step_definition_step_definition_pattern.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_step_definition_step_definition_pattern.ex new file mode 100644 index 0000000000..846e11b523 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_step_definition_step_definition_pattern.ex @@ -0,0 +1,133 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.StepDefinition.StepDefinitionPattern) do + @moduledoc(false) + ( + defstruct(source: "", type: :CUCUMBER_EXPRESSION, __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_source(msg) |> encode_type(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_source(acc, msg)) do + field_value = msg.source() + if(field_value == "") do + acc + else + [acc, "\n", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_type(acc, msg)) do + field_value = msg.type() + if(field_value == :CUCUMBER_EXPRESSION) do + acc + else + [acc, <<16>>, field_value |> CucumberMessages.StepDefinition.StepDefinitionPattern.StepDefinitionPatternType.encode() |> Protox.Encode.encode_enum()] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.StepDefinition.StepDefinitionPattern)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:source, value} + {field, rest} + {2, _, bytes} -> + {value, rest} = Protox.Decode.parse_enum(bytes, CucumberMessages.StepDefinition.StepDefinitionPattern.StepDefinitionPatternType) + field = {:type, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:source, {:default, ""}, :string}, 2 => {:type, {:default, :CUCUMBER_EXPRESSION}, {:enum, CucumberMessages.StepDefinition.StepDefinitionPattern.StepDefinitionPatternType}}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{source: {1, {:default, ""}, :string}, type: {2, {:default, :CUCUMBER_EXPRESSION}, {:enum, CucumberMessages.StepDefinition.StepDefinitionPattern.StepDefinitionPatternType}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:source)) do + {:ok, ""} + end, def(default(:type)) do + {:ok, :CUCUMBER_EXPRESSION} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_step_definition_step_definition_pattern_step_definition_pattern_type.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_step_definition_step_definition_pattern_step_definition_pattern_type.ex new file mode 100644 index 0000000000..c069c36b2c --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_step_definition_step_definition_pattern_step_definition_pattern_type.ex @@ -0,0 +1,35 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.StepDefinition.StepDefinitionPattern.StepDefinitionPatternType) do + @moduledoc(false) + ( + ( + @spec(default() :: :CUCUMBER_EXPRESSION) + def(default()) do + :CUCUMBER_EXPRESSION + end + ) + @spec(encode(atom) :: integer | atom) + [def(encode(:CUCUMBER_EXPRESSION)) do + 0 + end, def(encode(:REGULAR_EXPRESSION)) do + 1 + end] + def(encode(x)) do + x + end + @spec(decode(integer) :: atom | integer) + [def(decode(0)) do + :CUCUMBER_EXPRESSION + end, def(decode(1)) do + :REGULAR_EXPRESSION + end] + def(decode(x)) do + x + end + @spec(constants() :: [{integer, atom}]) + def(constants()) do + [{0, :CUCUMBER_EXPRESSION}, {1, :REGULAR_EXPRESSION}] + end + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_case.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_case.ex new file mode 100644 index 0000000000..7aeac03a8c --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_case.ex @@ -0,0 +1,150 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.TestCase) do + @moduledoc(false) + ( + defstruct(id: "", pickle_id: "", test_steps: [], __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_id(msg) |> encode_pickle_id(msg) |> encode_test_steps(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_id(acc, msg)) do + field_value = msg.id() + if(field_value == "") do + acc + else + [acc, "\n", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_pickle_id(acc, msg)) do + field_value = msg.pickle_id() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_test_steps(acc, msg)) do + case(msg.test_steps()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, <<26>>, Protox.Encode.encode_message(value)] end)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.TestCase)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:id, value} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:pickle_id, value} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.TestCase.TestStep.decode!(delimited) + field = {:test_steps, msg.test_steps() ++ List.wrap(value)} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:id, {:default, ""}, :string}, 2 => {:pickle_id, {:default, ""}, :string}, 3 => {:test_steps, :unpacked, {:message, CucumberMessages.TestCase.TestStep}}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{id: {1, {:default, ""}, :string}, pickle_id: {2, {:default, ""}, :string}, test_steps: {3, :unpacked, {:message, CucumberMessages.TestCase.TestStep}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:id)) do + {:ok, ""} + end, def(default(:pickle_id)) do + {:ok, ""} + end, def(default(:test_steps)) do + {:error, :no_default_value} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_case_finished.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_case_finished.ex new file mode 100644 index 0000000000..9cb343d721 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_case_finished.ex @@ -0,0 +1,135 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.TestCaseFinished) do + @moduledoc(false) + ( + defstruct(timestamp: nil, test_case_started_id: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_timestamp(msg) |> encode_test_case_started_id(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_timestamp(acc, msg)) do + field_value = msg.timestamp() + if(field_value == nil) do + acc + else + [acc, "\n", Protox.Encode.encode_message(field_value)] + end + end, defp(encode_test_case_started_id(acc, msg)) do + field_value = msg.test_case_started_id() + if(field_value == "") do + acc + else + [acc, <<26>>, Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.TestCaseFinished)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Timestamp.decode!(delimited) + field = {:timestamp, Protox.Message.merge(msg.timestamp(), value)} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:test_case_started_id, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:timestamp, {:default, nil}, {:message, CucumberMessages.Timestamp}}, 3 => {:test_case_started_id, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{test_case_started_id: {3, {:default, ""}, :string}, timestamp: {1, {:default, nil}, {:message, CucumberMessages.Timestamp}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:timestamp)) do + {:ok, nil} + end, def(default(:test_case_started_id)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_case_started.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_case_started.ex new file mode 100644 index 0000000000..e96454d9eb --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_case_started.ex @@ -0,0 +1,163 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.TestCaseStarted) do + @moduledoc(false) + ( + defstruct(timestamp: nil, attempt: 0, test_case_id: "", id: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_timestamp(msg) |> encode_attempt(msg) |> encode_test_case_id(msg) |> encode_id(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_timestamp(acc, msg)) do + field_value = msg.timestamp() + if(field_value == nil) do + acc + else + [acc, "\n", Protox.Encode.encode_message(field_value)] + end + end, defp(encode_attempt(acc, msg)) do + field_value = msg.attempt() + if(field_value == 0) do + acc + else + [acc, <<24>>, Protox.Encode.encode_uint32(field_value)] + end + end, defp(encode_test_case_id(acc, msg)) do + field_value = msg.test_case_id() + if(field_value == "") do + acc + else + [acc, "\"", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_id(acc, msg)) do + field_value = msg.id() + if(field_value == "") do + acc + else + [acc, "*", Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.TestCaseStarted)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Timestamp.decode!(delimited) + field = {:timestamp, Protox.Message.merge(msg.timestamp(), value)} + {field, rest} + {3, _, bytes} -> + {value, rest} = Protox.Decode.parse_uint32(bytes) + field = {:attempt, value} + {field, rest} + {4, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:test_case_id, value} + {field, rest} + {5, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:id, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:timestamp, {:default, nil}, {:message, CucumberMessages.Timestamp}}, 3 => {:attempt, {:default, 0}, :uint32}, 4 => {:test_case_id, {:default, ""}, :string}, 5 => {:id, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{attempt: {3, {:default, 0}, :uint32}, id: {5, {:default, ""}, :string}, test_case_id: {4, {:default, ""}, :string}, timestamp: {1, {:default, nil}, {:message, CucumberMessages.Timestamp}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:timestamp)) do + {:ok, nil} + end, def(default(:attempt)) do + {:ok, 0} + end, def(default(:test_case_id)) do + {:ok, ""} + end, def(default(:id)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_case_test_step.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_case_test_step.ex new file mode 100644 index 0000000000..2b0680488d --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_case_test_step.ex @@ -0,0 +1,180 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.TestCase.TestStep) do + @moduledoc(false) + ( + defstruct(id: "", pickle_step_id: "", step_definition_ids: [], step_match_arguments_lists: [], hook_id: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_id(msg) |> encode_pickle_step_id(msg) |> encode_step_definition_ids(msg) |> encode_step_match_arguments_lists(msg) |> encode_hook_id(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_id(acc, msg)) do + field_value = msg.id() + if(field_value == "") do + acc + else + [acc, "\n", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_pickle_step_id(acc, msg)) do + field_value = msg.pickle_step_id() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_step_definition_ids(acc, msg)) do + case(msg.step_definition_ids()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, <<26>>, Protox.Encode.encode_string(value)] end)] + end + end, defp(encode_step_match_arguments_lists(acc, msg)) do + case(msg.step_match_arguments_lists()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, "\"", Protox.Encode.encode_message(value)] end)] + end + end, defp(encode_hook_id(acc, msg)) do + field_value = msg.hook_id() + if(field_value == "") do + acc + else + [acc, "*", Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.TestCase.TestStep)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:id, value} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:pickle_step_id, value} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:step_definition_ids, msg.step_definition_ids() ++ List.wrap(value)} + {field, rest} + {4, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.decode!(delimited) + field = {:step_match_arguments_lists, msg.step_match_arguments_lists() ++ List.wrap(value)} + {field, rest} + {5, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:hook_id, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:id, {:default, ""}, :string}, 2 => {:pickle_step_id, {:default, ""}, :string}, 3 => {:step_definition_ids, :unpacked, :string}, 4 => {:step_match_arguments_lists, :unpacked, {:message, CucumberMessages.TestCase.TestStep.StepMatchArgumentsList}}, 5 => {:hook_id, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{hook_id: {5, {:default, ""}, :string}, id: {1, {:default, ""}, :string}, pickle_step_id: {2, {:default, ""}, :string}, step_definition_ids: {3, :unpacked, :string}, step_match_arguments_lists: {4, :unpacked, {:message, CucumberMessages.TestCase.TestStep.StepMatchArgumentsList}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:id)) do + {:ok, ""} + end, def(default(:pickle_step_id)) do + {:ok, ""} + end, def(default(:step_definition_ids)) do + {:error, :no_default_value} + end, def(default(:step_match_arguments_lists)) do + {:error, :no_default_value} + end, def(default(:hook_id)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_case_test_step_step_match_arguments_list.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_case_test_step_step_match_arguments_list.ex new file mode 100644 index 0000000000..8c1cbb21f7 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_case_test_step_step_match_arguments_list.ex @@ -0,0 +1,120 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.TestCase.TestStep.StepMatchArgumentsList) do + @moduledoc(false) + ( + defstruct(step_match_arguments: [], __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_step_match_arguments(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_step_match_arguments(acc, msg)) do + case(msg.step_match_arguments()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, "\n", Protox.Encode.encode_message(value)] end)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.TestCase.TestStep.StepMatchArgumentsList)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument.decode!(delimited) + field = {:step_match_arguments, msg.step_match_arguments() ++ List.wrap(value)} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:step_match_arguments, :unpacked, {:message, CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument}}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{step_match_arguments: {1, :unpacked, {:message, CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:step_match_arguments)) do + {:error, :no_default_value} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_case_test_step_step_match_arguments_list_step_match_argument.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_case_test_step_step_match_arguments_list_step_match_argument.ex new file mode 100644 index 0000000000..4788421612 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_case_test_step_step_match_arguments_list_step_match_argument.ex @@ -0,0 +1,135 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument) do + @moduledoc(false) + ( + defstruct(parameter_type_name: "", group: nil, __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_parameter_type_name(msg) |> encode_group(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_parameter_type_name(acc, msg)) do + field_value = msg.parameter_type_name() + if(field_value == "") do + acc + else + [acc, "\n", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_group(acc, msg)) do + field_value = msg.group() + if(field_value == nil) do + acc + else + [acc, <<18>>, Protox.Encode.encode_message(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:parameter_type_name, value} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument.Group.decode!(delimited) + field = {:group, Protox.Message.merge(msg.group(), value)} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:parameter_type_name, {:default, ""}, :string}, 2 => {:group, {:default, nil}, {:message, CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument.Group}}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{group: {2, {:default, nil}, {:message, CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument.Group}}, parameter_type_name: {1, {:default, ""}, :string}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:parameter_type_name)) do + {:ok, ""} + end, def(default(:group)) do + {:ok, nil} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_case_test_step_step_match_arguments_list_step_match_argument_group.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_case_test_step_step_match_arguments_list_step_match_argument_group.ex new file mode 100644 index 0000000000..94843670ae --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_case_test_step_step_match_arguments_list_step_match_argument_group.ex @@ -0,0 +1,148 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument.Group) do + @moduledoc(false) + ( + defstruct(start: 0, value: "", children: [], __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_start(msg) |> encode_value(msg) |> encode_children(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_start(acc, msg)) do + field_value = msg.start() + if(field_value == 0) do + acc + else + [acc, "\b", Protox.Encode.encode_uint32(field_value)] + end + end, defp(encode_value(acc, msg)) do + field_value = msg.value() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_children(acc, msg)) do + case(msg.children()) do + [] -> + acc + values -> + [acc, Enum.reduce(values, [], fn value, acc -> [acc, <<26>>, Protox.Encode.encode_message(value)] end)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument.Group)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {value, rest} = Protox.Decode.parse_uint32(bytes) + field = {:start, value} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:value, value} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument.Group.decode!(delimited) + field = {:children, msg.children() ++ List.wrap(value)} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:start, {:default, 0}, :uint32}, 2 => {:value, {:default, ""}, :string}, 3 => {:children, :unpacked, {:message, CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument.Group}}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{children: {3, :unpacked, {:message, CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument.Group}}, start: {1, {:default, 0}, :uint32}, value: {2, {:default, ""}, :string}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:start)) do + {:ok, 0} + end, def(default(:value)) do + {:ok, ""} + end, def(default(:children)) do + {:error, :no_default_value} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_run_finished.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_run_finished.ex new file mode 100644 index 0000000000..123d5c0daf --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_run_finished.ex @@ -0,0 +1,148 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.TestRunFinished) do + @moduledoc(false) + ( + defstruct(success: false, timestamp: nil, message: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_success(msg) |> encode_timestamp(msg) |> encode_message(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_success(acc, msg)) do + field_value = msg.success() + if(field_value == false) do + acc + else + [acc, "\b", Protox.Encode.encode_bool(field_value)] + end + end, defp(encode_timestamp(acc, msg)) do + field_value = msg.timestamp() + if(field_value == nil) do + acc + else + [acc, <<18>>, Protox.Encode.encode_message(field_value)] + end + end, defp(encode_message(acc, msg)) do + field_value = msg.message() + if(field_value == "") do + acc + else + [acc, <<26>>, Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.TestRunFinished)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {value, rest} = Protox.Decode.parse_bool(bytes) + field = {:success, value} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Timestamp.decode!(delimited) + field = {:timestamp, Protox.Message.merge(msg.timestamp(), value)} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:message, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:success, {:default, false}, :bool}, 2 => {:timestamp, {:default, nil}, {:message, CucumberMessages.Timestamp}}, 3 => {:message, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{message: {3, {:default, ""}, :string}, success: {1, {:default, false}, :bool}, timestamp: {2, {:default, nil}, {:message, CucumberMessages.Timestamp}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:success)) do + {:ok, false} + end, def(default(:timestamp)) do + {:ok, nil} + end, def(default(:message)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_run_started.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_run_started.ex new file mode 100644 index 0000000000..abad6bc3ab --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_run_started.ex @@ -0,0 +1,120 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.TestRunStarted) do + @moduledoc(false) + ( + defstruct(timestamp: nil, __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_timestamp(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_timestamp(acc, msg)) do + field_value = msg.timestamp() + if(field_value == nil) do + acc + else + [acc, "\n", Protox.Encode.encode_message(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.TestRunStarted)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Timestamp.decode!(delimited) + field = {:timestamp, Protox.Message.merge(msg.timestamp(), value)} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:timestamp, {:default, nil}, {:message, CucumberMessages.Timestamp}}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{timestamp: {1, {:default, nil}, {:message, CucumberMessages.Timestamp}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:timestamp)) do + {:ok, nil} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_step_finished.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_step_finished.ex new file mode 100644 index 0000000000..fc4ebc49b1 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_step_finished.ex @@ -0,0 +1,165 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.TestStepFinished) do + @moduledoc(false) + ( + defstruct(test_step_result: nil, timestamp: nil, test_step_id: "", test_case_started_id: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_test_step_result(msg) |> encode_timestamp(msg) |> encode_test_step_id(msg) |> encode_test_case_started_id(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_test_step_result(acc, msg)) do + field_value = msg.test_step_result() + if(field_value == nil) do + acc + else + [acc, "\n", Protox.Encode.encode_message(field_value)] + end + end, defp(encode_timestamp(acc, msg)) do + field_value = msg.timestamp() + if(field_value == nil) do + acc + else + [acc, <<18>>, Protox.Encode.encode_message(field_value)] + end + end, defp(encode_test_step_id(acc, msg)) do + field_value = msg.test_step_id() + if(field_value == "") do + acc + else + [acc, <<26>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_test_case_started_id(acc, msg)) do + field_value = msg.test_case_started_id() + if(field_value == "") do + acc + else + [acc, "\"", Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.TestStepFinished)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.TestStepFinished.TestStepResult.decode!(delimited) + field = {:test_step_result, Protox.Message.merge(msg.test_step_result(), value)} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Timestamp.decode!(delimited) + field = {:timestamp, Protox.Message.merge(msg.timestamp(), value)} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:test_step_id, value} + {field, rest} + {4, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:test_case_started_id, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:test_step_result, {:default, nil}, {:message, CucumberMessages.TestStepFinished.TestStepResult}}, 2 => {:timestamp, {:default, nil}, {:message, CucumberMessages.Timestamp}}, 3 => {:test_step_id, {:default, ""}, :string}, 4 => {:test_case_started_id, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{test_case_started_id: {4, {:default, ""}, :string}, test_step_id: {3, {:default, ""}, :string}, test_step_result: {1, {:default, nil}, {:message, CucumberMessages.TestStepFinished.TestStepResult}}, timestamp: {2, {:default, nil}, {:message, CucumberMessages.Timestamp}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:test_step_result)) do + {:ok, nil} + end, def(default(:timestamp)) do + {:ok, nil} + end, def(default(:test_step_id)) do + {:ok, ""} + end, def(default(:test_case_started_id)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_step_finished_test_step_result.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_step_finished_test_step_result.ex new file mode 100644 index 0000000000..e03b291eee --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_step_finished_test_step_result.ex @@ -0,0 +1,161 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.TestStepFinished.TestStepResult) do + @moduledoc(false) + ( + defstruct(status: :UNKNOWN, message: "", duration: nil, will_be_retried: false, __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_status(msg) |> encode_message(msg) |> encode_duration(msg) |> encode_will_be_retried(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_status(acc, msg)) do + field_value = msg.status() + if(field_value == :UNKNOWN) do + acc + else + [acc, "\b", field_value |> CucumberMessages.TestStepFinished.TestStepResult.Status.encode() |> Protox.Encode.encode_enum()] + end + end, defp(encode_message(acc, msg)) do + field_value = msg.message() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_duration(acc, msg)) do + field_value = msg.duration() + if(field_value == nil) do + acc + else + [acc, <<26>>, Protox.Encode.encode_message(field_value)] + end + end, defp(encode_will_be_retried(acc, msg)) do + field_value = msg.will_be_retried() + if(field_value == false) do + acc + else + [acc, " ", Protox.Encode.encode_bool(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.TestStepFinished.TestStepResult)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {value, rest} = Protox.Decode.parse_enum(bytes, CucumberMessages.TestStepFinished.TestStepResult.Status) + field = {:status, value} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:message, value} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Duration.decode!(delimited) + field = {:duration, Protox.Message.merge(msg.duration(), value)} + {field, rest} + {4, _, bytes} -> + {value, rest} = Protox.Decode.parse_bool(bytes) + field = {:will_be_retried, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:status, {:default, :UNKNOWN}, {:enum, CucumberMessages.TestStepFinished.TestStepResult.Status}}, 2 => {:message, {:default, ""}, :string}, 3 => {:duration, {:default, nil}, {:message, CucumberMessages.Duration}}, 4 => {:will_be_retried, {:default, false}, :bool}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{duration: {3, {:default, nil}, {:message, CucumberMessages.Duration}}, message: {2, {:default, ""}, :string}, status: {1, {:default, :UNKNOWN}, {:enum, CucumberMessages.TestStepFinished.TestStepResult.Status}}, will_be_retried: {4, {:default, false}, :bool}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:status)) do + {:ok, :UNKNOWN} + end, def(default(:message)) do + {:ok, ""} + end, def(default(:duration)) do + {:ok, nil} + end, def(default(:will_be_retried)) do + {:ok, false} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_step_finished_test_step_result_status.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_step_finished_test_step_result_status.ex new file mode 100644 index 0000000000..e567c4af90 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_step_finished_test_step_result_status.ex @@ -0,0 +1,55 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.TestStepFinished.TestStepResult.Status) do + @moduledoc(false) + ( + ( + @spec(default() :: :UNKNOWN) + def(default()) do + :UNKNOWN + end + ) + @spec(encode(atom) :: integer | atom) + [def(encode(:UNKNOWN)) do + 0 + end, def(encode(:PASSED)) do + 1 + end, def(encode(:SKIPPED)) do + 2 + end, def(encode(:PENDING)) do + 3 + end, def(encode(:UNDEFINED)) do + 4 + end, def(encode(:AMBIGUOUS)) do + 5 + end, def(encode(:FAILED)) do + 6 + end] + def(encode(x)) do + x + end + @spec(decode(integer) :: atom | integer) + [def(decode(0)) do + :UNKNOWN + end, def(decode(1)) do + :PASSED + end, def(decode(2)) do + :SKIPPED + end, def(decode(3)) do + :PENDING + end, def(decode(4)) do + :UNDEFINED + end, def(decode(5)) do + :AMBIGUOUS + end, def(decode(6)) do + :FAILED + end] + def(decode(x)) do + x + end + @spec(constants() :: [{integer, atom}]) + def(constants()) do + [{0, :UNKNOWN}, {1, :PASSED}, {2, :SKIPPED}, {3, :PENDING}, {4, :UNDEFINED}, {5, :AMBIGUOUS}, {6, :FAILED}] + end + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_step_started.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_step_started.ex new file mode 100644 index 0000000000..333bca0e6b --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_test_step_started.ex @@ -0,0 +1,150 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.TestStepStarted) do + @moduledoc(false) + ( + defstruct(timestamp: nil, test_step_id: "", test_case_started_id: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_timestamp(msg) |> encode_test_step_id(msg) |> encode_test_case_started_id(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_timestamp(acc, msg)) do + field_value = msg.timestamp() + if(field_value == nil) do + acc + else + [acc, "\n", Protox.Encode.encode_message(field_value)] + end + end, defp(encode_test_step_id(acc, msg)) do + field_value = msg.test_step_id() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end, defp(encode_test_case_started_id(acc, msg)) do + field_value = msg.test_case_started_id() + if(field_value == "") do + acc + else + [acc, <<26>>, Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.TestStepStarted)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = CucumberMessages.Timestamp.decode!(delimited) + field = {:timestamp, Protox.Message.merge(msg.timestamp(), value)} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:test_step_id, value} + {field, rest} + {3, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:test_case_started_id, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:timestamp, {:default, nil}, {:message, CucumberMessages.Timestamp}}, 2 => {:test_step_id, {:default, ""}, :string}, 3 => {:test_case_started_id, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{test_case_started_id: {3, {:default, ""}, :string}, test_step_id: {2, {:default, ""}, :string}, timestamp: {1, {:default, nil}, {:message, CucumberMessages.Timestamp}}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:timestamp)) do + {:ok, nil} + end, def(default(:test_step_id)) do + {:ok, ""} + end, def(default(:test_case_started_id)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_timestamp.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_timestamp.ex new file mode 100644 index 0000000000..21b9f74ef3 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_timestamp.ex @@ -0,0 +1,131 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.Timestamp) do + @moduledoc(false) + ( + defstruct(seconds: 0, nanos: 0, __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_seconds(msg) |> encode_nanos(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_seconds(acc, msg)) do + field_value = msg.seconds() + if(field_value == 0) do + acc + else + [acc, "\b", Protox.Encode.encode_int64(field_value)] + end + end, defp(encode_nanos(acc, msg)) do + field_value = msg.nanos() + if(field_value == 0) do + acc + else + [acc, <<16>>, Protox.Encode.encode_int32(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.Timestamp)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {value, rest} = Protox.Decode.parse_int64(bytes) + field = {:seconds, value} + {field, rest} + {2, _, bytes} -> + {value, rest} = Protox.Decode.parse_int32(bytes) + field = {:nanos, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:seconds, {:default, 0}, :int64}, 2 => {:nanos, {:default, 0}, :int32}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{nanos: {2, {:default, 0}, :int32}, seconds: {1, {:default, 0}, :int64}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:seconds)) do + {:ok, 0} + end, def(default(:nanos)) do + {:ok, 0} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_undefined_parameter_type.ex b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_undefined_parameter_type.ex new file mode 100644 index 0000000000..be8adb4205 --- /dev/null +++ b/messages/elixir/lib/cucumber_messages/generated/elixir_cucumber_messages_undefined_parameter_type.ex @@ -0,0 +1,135 @@ +# credo:disable-for-this-file +defmodule(CucumberMessages.UndefinedParameterType) do + @moduledoc(false) + ( + defstruct(name: "", expression: "", __uf__: []) + ( + @spec(encode(struct) :: {:ok, iodata} | {:error, any}) + def(encode(msg)) do + try do + {:ok, encode!(msg)} + rescue + e -> + {:error, e} + end + end + @spec(encode!(struct) :: iodata | no_return) + def(encode!(msg)) do + [] |> encode_name(msg) |> encode_expression(msg) |> encode_unknown_fields(msg) + end + [] + [defp(encode_name(acc, msg)) do + field_value = msg.name() + if(field_value == "") do + acc + else + [acc, "\n", Protox.Encode.encode_string(field_value)] + end + end, defp(encode_expression(acc, msg)) do + field_value = msg.expression() + if(field_value == "") do + acc + else + [acc, <<18>>, Protox.Encode.encode_string(field_value)] + end + end] + defp(encode_unknown_fields(acc, msg)) do + Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> case(wire_type) do + 0 -> + [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] + 1 -> + [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] + 2 -> + len_bytes = bytes |> byte_size() |> Protox.Varint.encode() + [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] + 5 -> + [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] + end end) + end + ) + ( + @spec(decode(binary) :: {:ok, struct} | {:error, any}) + def(decode(bytes)) do + try do + {:ok, decode!(bytes)} + rescue + e -> + {:error, e} + end + end + ( + @spec(decode!(binary) :: struct | no_return) + def(decode!(bytes)) do + parse_key_value(bytes, struct(CucumberMessages.UndefinedParameterType)) + end + ) + ( + @spec(parse_key_value(binary, struct) :: struct) + defp(parse_key_value(<<>>, msg)) do + msg + end + defp(parse_key_value(bytes, msg)) do + {field, rest} = case(Protox.Decode.parse_key(bytes)) do + {0, _, _} -> + raise(%Protox.IllegalTagError{}) + {1, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:name, value} + {field, rest} + {2, _, bytes} -> + {len, bytes} = Protox.Varint.decode(bytes) + <> = bytes + value = delimited + field = {:expression, value} + {field, rest} + {tag, wire_type, rest} -> + {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) + field = {msg.__struct__.unknown_fields_name, [value | msg.__struct__.unknown_fields(msg)]} + {field, new_rest} + end + msg_updated = struct(msg, [field]) + parse_key_value(rest, msg_updated) + end + ) + [] + ) + @spec(defs() :: %{required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()}}) + def(defs()) do + %{1 => {:name, {:default, ""}, :string}, 2 => {:expression, {:default, ""}, :string}} + end + @spec(defs_by_name() :: %{required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()}}) + def(defs_by_name()) do + %{expression: {2, {:default, ""}, :string}, name: {1, {:default, ""}, :string}} + end + @spec(required_fields() :: []) + def(required_fields()) do + [] + end + @spec(unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}]) + def(unknown_fields(msg)) do + msg.__uf__() + end + @spec(unknown_fields_name() :: :__uf__) + def(unknown_fields_name()) do + :__uf__ + end + @spec(clear_unknown_fields(struct) :: struct) + def(clear_unknown_fields(msg)) do + struct!(msg, [{unknown_fields_name(), []}]) + end + @spec(syntax() :: atom) + def(syntax()) do + :proto3 + end + [@spec(default(atom) :: {:ok, boolean | integer | String.t() | float} | {:error, atom}), [def(default(:name)) do + {:ok, ""} + end, def(default(:expression)) do + {:ok, ""} + end], def(default(_)) do + {:error, :no_such_field} + end] + ) + [] +end \ No newline at end of file diff --git a/messages/elixir/lib/cucumber_messages/messages.ex b/messages/elixir/lib/cucumber_messages/messages.ex deleted file mode 100644 index ddf2cdcf1d..0000000000 --- a/messages/elixir/lib/cucumber_messages/messages.ex +++ /dev/null @@ -1,13049 +0,0 @@ -# credo:disable-for-this-file -[ - defmodule(CucumberMessages.Attachment.ContentEncoding) do - @moduledoc false - ( - ( - @spec default() :: :IDENTITY - def(default()) do - :IDENTITY - end - ) - - @spec encode(atom) :: integer | atom - [ - def(encode(:IDENTITY)) do - 0 - end, - def(encode(:BASE64)) do - 1 - end - ] - - def(encode(x)) do - x - end - - @spec decode(integer) :: atom | integer - [ - def(decode(0)) do - :IDENTITY - end, - def(decode(1)) do - :BASE64 - end - ] - - def(decode(x)) do - x - end - - @spec constants() :: [{integer, atom}] - def(constants()) do - [{0, :IDENTITY}, {1, :BASE64}] - end - ) - - [] - end, - defmodule(CucumberMessages.StepDefinition.StepDefinitionPattern.StepDefinitionPatternType) do - @moduledoc false - ( - ( - @spec default() :: :CUCUMBER_EXPRESSION - def(default()) do - :CUCUMBER_EXPRESSION - end - ) - - @spec encode(atom) :: integer | atom - [ - def(encode(:CUCUMBER_EXPRESSION)) do - 0 - end, - def(encode(:REGULAR_EXPRESSION)) do - 1 - end - ] - - def(encode(x)) do - x - end - - @spec decode(integer) :: atom | integer - [ - def(decode(0)) do - :CUCUMBER_EXPRESSION - end, - def(decode(1)) do - :REGULAR_EXPRESSION - end - ] - - def(decode(x)) do - x - end - - @spec constants() :: [{integer, atom}] - def(constants()) do - [{0, :CUCUMBER_EXPRESSION}, {1, :REGULAR_EXPRESSION}] - end - ) - - [] - end, - defmodule(CucumberMessages.TestStepFinished.TestStepResult.Status) do - @moduledoc false - ( - ( - @spec default() :: :UNKNOWN - def(default()) do - :UNKNOWN - end - ) - - @spec encode(atom) :: integer | atom - [ - def(encode(:UNKNOWN)) do - 0 - end, - def(encode(:PASSED)) do - 1 - end, - def(encode(:SKIPPED)) do - 2 - end, - def(encode(:PENDING)) do - 3 - end, - def(encode(:UNDEFINED)) do - 4 - end, - def(encode(:AMBIGUOUS)) do - 5 - end, - def(encode(:FAILED)) do - 6 - end - ] - - def(encode(x)) do - x - end - - @spec decode(integer) :: atom | integer - [ - def(decode(0)) do - :UNKNOWN - end, - def(decode(1)) do - :PASSED - end, - def(decode(2)) do - :SKIPPED - end, - def(decode(3)) do - :PENDING - end, - def(decode(4)) do - :UNDEFINED - end, - def(decode(5)) do - :AMBIGUOUS - end, - def(decode(6)) do - :FAILED - end - ] - - def(decode(x)) do - x - end - - @spec constants() :: [{integer, atom}] - def(constants()) do - [ - {0, :UNKNOWN}, - {1, :PASSED}, - {2, :SKIPPED}, - {3, :PENDING}, - {4, :UNDEFINED}, - {5, :AMBIGUOUS}, - {6, :FAILED} - ] - end - ) - - [] - end, - defmodule(CucumberMessages.Pickle.PickleTag) do - @moduledoc false - ( - defstruct(name: "", ast_node_id: "", __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_name(msg) |> encode_ast_node_id(msg) |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_name(acc, msg)) do - field_value = msg.name() - - if(field_value == "") do - acc - else - [acc, "\n", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_ast_node_id(acc, msg)) do - field_value = msg.ast_node_id() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.Pickle.PickleTag)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:name, value} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:ast_node_id, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{1 => {:name, {:default, ""}, :string}, 2 => {:ast_node_id, {:default, ""}, :string}} - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ast_node_id: {2, {:default, ""}, :string}, name: {1, {:default, ""}, :string}} - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:name)) do - {:ok, ""} - end, - def(default(:ast_node_id)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.Meta.CI) do - @moduledoc false - ( - defstruct(name: "", url: "", git: nil, __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_name(msg) - |> encode_url(msg) - |> encode_git(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_name(acc, msg)) do - field_value = msg.name() - - if(field_value == "") do - acc - else - [acc, "\n", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_url(acc, msg)) do - field_value = msg.url() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_git(acc, msg)) do - field_value = msg.git() - - if(field_value == nil) do - acc - else - [acc, <<26>>, Protox.Encode.encode_message(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.Meta.CI)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:name, value} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:url, value} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Meta.CI.Git.decode!(delimited) - field = {:git, Protox.Message.merge(msg.git(), value)} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:name, {:default, ""}, :string}, - 2 => {:url, {:default, ""}, :string}, - 3 => {:git, {:default, nil}, {:message, CucumberMessages.Meta.CI.Git}} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - git: {3, {:default, nil}, {:message, CucumberMessages.Meta.CI.Git}}, - name: {1, {:default, ""}, :string}, - url: {2, {:default, ""}, :string} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:name)) do - {:ok, ""} - end, - def(default(:url)) do - {:ok, ""} - end, - def(default(:git)) do - {:ok, nil} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.PickleStepArgument.PickleTable.PickleTableRow.PickleTableCell) do - @moduledoc false - ( - defstruct(value: "", __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_value(msg) |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_value(acc, msg)) do - field_value = msg.value() - - if(field_value == "") do - acc - else - [acc, "\n", Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value( - bytes, - struct( - CucumberMessages.PickleStepArgument.PickleTable.PickleTableRow.PickleTableCell - ) - ) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:value, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{1 => {:value, {:default, ""}, :string}} - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{value: {1, {:default, ""}, :string}} - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:value)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.Meta) do - @moduledoc false - ( - defstruct( - protocol_version: "", - implementation: nil, - runtime: nil, - os: nil, - cpu: nil, - ci: nil, - __uf__: [] - ) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_protocol_version(msg) - |> encode_implementation(msg) - |> encode_runtime(msg) - |> encode_os(msg) - |> encode_cpu(msg) - |> encode_ci(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_protocol_version(acc, msg)) do - field_value = msg.protocol_version() - - if(field_value == "") do - acc - else - [acc, "\n", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_implementation(acc, msg)) do - field_value = msg.implementation() - - if(field_value == nil) do - acc - else - [acc, <<18>>, Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_runtime(acc, msg)) do - field_value = msg.runtime() - - if(field_value == nil) do - acc - else - [acc, <<26>>, Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_os(acc, msg)) do - field_value = msg.os() - - if(field_value == nil) do - acc - else - [acc, "\"", Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_cpu(acc, msg)) do - field_value = msg.cpu() - - if(field_value == nil) do - acc - else - [acc, "*", Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_ci(acc, msg)) do - field_value = msg.ci() - - if(field_value == nil) do - acc - else - [acc, "2", Protox.Encode.encode_message(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.Meta)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:protocol_version, value} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Meta.Product.decode!(delimited) - field = {:implementation, Protox.Message.merge(msg.implementation(), value)} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Meta.Product.decode!(delimited) - field = {:runtime, Protox.Message.merge(msg.runtime(), value)} - {field, rest} - - {4, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Meta.Product.decode!(delimited) - field = {:os, Protox.Message.merge(msg.os(), value)} - {field, rest} - - {5, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Meta.Product.decode!(delimited) - field = {:cpu, Protox.Message.merge(msg.cpu(), value)} - {field, rest} - - {6, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Meta.CI.decode!(delimited) - field = {:ci, Protox.Message.merge(msg.ci(), value)} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:protocol_version, {:default, ""}, :string}, - 2 => {:implementation, {:default, nil}, {:message, CucumberMessages.Meta.Product}}, - 3 => {:runtime, {:default, nil}, {:message, CucumberMessages.Meta.Product}}, - 4 => {:os, {:default, nil}, {:message, CucumberMessages.Meta.Product}}, - 5 => {:cpu, {:default, nil}, {:message, CucumberMessages.Meta.Product}}, - 6 => {:ci, {:default, nil}, {:message, CucumberMessages.Meta.CI}} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - ci: {6, {:default, nil}, {:message, CucumberMessages.Meta.CI}}, - cpu: {5, {:default, nil}, {:message, CucumberMessages.Meta.Product}}, - implementation: {2, {:default, nil}, {:message, CucumberMessages.Meta.Product}}, - os: {4, {:default, nil}, {:message, CucumberMessages.Meta.Product}}, - protocol_version: {1, {:default, ""}, :string}, - runtime: {3, {:default, nil}, {:message, CucumberMessages.Meta.Product}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:protocol_version)) do - {:ok, ""} - end, - def(default(:implementation)) do - {:ok, nil} - end, - def(default(:runtime)) do - {:ok, nil} - end, - def(default(:os)) do - {:ok, nil} - end, - def(default(:cpu)) do - {:ok, nil} - end, - def(default(:ci)) do - {:ok, nil} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.GherkinDocument.Feature.FeatureChild.RuleChild) do - @moduledoc false - ( - defstruct(value: nil, __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_value(msg) |> encode_unknown_fields(msg) - end - - [ - defp(encode_value(acc, msg)) do - case(msg.value()) do - nil -> - acc - - {:background, _field_value} -> - encode_background(acc, msg) - - {:scenario, _field_value} -> - encode_scenario(acc, msg) - end - end - ] - - [ - defp(encode_background(acc, msg)) do - {_, field_value} = msg.value() - [acc, "\n", Protox.Encode.encode_message(field_value)] - end, - defp(encode_scenario(acc, msg)) do - {_, field_value} = msg.value() - [acc, <<18>>, Protox.Encode.encode_message(field_value)] - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value( - bytes, - struct(CucumberMessages.GherkinDocument.Feature.FeatureChild.RuleChild) - ) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.GherkinDocument.Feature.Background.decode!(delimited) - - field = - case(msg.value()) do - {:background, previous_value} -> - {:value, {:background, Protox.Message.merge(previous_value, value)}} - - _ -> - {:value, {:background, value}} - end - - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.GherkinDocument.Feature.Scenario.decode!(delimited) - - field = - case(msg.value()) do - {:scenario, previous_value} -> - {:value, {:scenario, Protox.Message.merge(previous_value, value)}} - - _ -> - {:value, {:scenario, value}} - end - - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => - {:background, {:oneof, :value}, - {:message, CucumberMessages.GherkinDocument.Feature.Background}}, - 2 => - {:scenario, {:oneof, :value}, - {:message, CucumberMessages.GherkinDocument.Feature.Scenario}} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - background: - {1, {:oneof, :value}, {:message, CucumberMessages.GherkinDocument.Feature.Background}}, - scenario: - {2, {:oneof, :value}, {:message, CucumberMessages.GherkinDocument.Feature.Scenario}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:background)) do - {:error, :no_default_value} - end, - def(default(:scenario)) do - {:error, :no_default_value} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.GherkinDocument.Feature.FeatureChild.Rule) do - @moduledoc false - ( - defstruct( - location: nil, - keyword: "", - name: "", - description: "", - children: [], - id: "", - __uf__: [] - ) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_location(msg) - |> encode_keyword(msg) - |> encode_name(msg) - |> encode_description(msg) - |> encode_children(msg) - |> encode_id(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_location(acc, msg)) do - field_value = msg.location() - - if(field_value == nil) do - acc - else - [acc, "\n", Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_keyword(acc, msg)) do - field_value = msg.keyword() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_name(acc, msg)) do - field_value = msg.name() - - if(field_value == "") do - acc - else - [acc, <<26>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_description(acc, msg)) do - field_value = msg.description() - - if(field_value == "") do - acc - else - [acc, "\"", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_children(acc, msg)) do - case(msg.children()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, "*", Protox.Encode.encode_message(value)] - end) - ] - end - end, - defp(encode_id(acc, msg)) do - field_value = msg.id() - - if(field_value == "") do - acc - else - [acc, "2", Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value( - bytes, - struct(CucumberMessages.GherkinDocument.Feature.FeatureChild.Rule) - ) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Location.decode!(delimited) - field = {:location, Protox.Message.merge(msg.location(), value)} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:keyword, value} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:name, value} - {field, rest} - - {4, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:description, value} - {field, rest} - - {5, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - - value = - CucumberMessages.GherkinDocument.Feature.FeatureChild.RuleChild.decode!( - delimited - ) - - field = {:children, msg.children() ++ List.wrap(value)} - {field, rest} - - {6, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:id, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, - 2 => {:keyword, {:default, ""}, :string}, - 3 => {:name, {:default, ""}, :string}, - 4 => {:description, {:default, ""}, :string}, - 5 => - {:children, :unpacked, - {:message, CucumberMessages.GherkinDocument.Feature.FeatureChild.RuleChild}}, - 6 => {:id, {:default, ""}, :string} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - children: - {5, :unpacked, - {:message, CucumberMessages.GherkinDocument.Feature.FeatureChild.RuleChild}}, - description: {4, {:default, ""}, :string}, - id: {6, {:default, ""}, :string}, - keyword: {2, {:default, ""}, :string}, - location: {1, {:default, nil}, {:message, CucumberMessages.Location}}, - name: {3, {:default, ""}, :string} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:location)) do - {:ok, nil} - end, - def(default(:keyword)) do - {:ok, ""} - end, - def(default(:name)) do - {:ok, ""} - end, - def(default(:description)) do - {:ok, ""} - end, - def(default(:children)) do - {:error, :no_default_value} - end, - def(default(:id)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.UndefinedParameterType) do - @moduledoc false - ( - defstruct(name: "", expression: "", __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_name(msg) |> encode_expression(msg) |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_name(acc, msg)) do - field_value = msg.name() - - if(field_value == "") do - acc - else - [acc, "\n", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_expression(acc, msg)) do - field_value = msg.expression() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.UndefinedParameterType)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:name, value} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:expression, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{1 => {:name, {:default, ""}, :string}, 2 => {:expression, {:default, ""}, :string}} - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{expression: {2, {:default, ""}, :string}, name: {1, {:default, ""}, :string}} - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:name)) do - {:ok, ""} - end, - def(default(:expression)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.TestCase.TestStep.StepMatchArgumentsList) do - @moduledoc false - ( - defstruct(step_match_arguments: [], __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_step_match_arguments(msg) |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_step_match_arguments(acc, msg)) do - case(msg.step_match_arguments()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, "\n", Protox.Encode.encode_message(value)] - end) - ] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value( - bytes, - struct(CucumberMessages.TestCase.TestStep.StepMatchArgumentsList) - ) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - - value = - CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument.decode!( - delimited - ) - - field = {:step_match_arguments, msg.step_match_arguments() ++ List.wrap(value)} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => - {:step_match_arguments, :unpacked, - {:message, - CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument}} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - step_match_arguments: - {1, :unpacked, - {:message, - CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:step_match_arguments)) do - {:error, :no_default_value} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.GherkinDocument.Feature) do - @moduledoc false - ( - defstruct( - location: nil, - tags: [], - language: "", - keyword: "", - name: "", - description: "", - children: [], - __uf__: [] - ) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_location(msg) - |> encode_tags(msg) - |> encode_language(msg) - |> encode_keyword(msg) - |> encode_name(msg) - |> encode_description(msg) - |> encode_children(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_location(acc, msg)) do - field_value = msg.location() - - if(field_value == nil) do - acc - else - [acc, "\n", Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_tags(acc, msg)) do - case(msg.tags()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, <<18>>, Protox.Encode.encode_message(value)] - end) - ] - end - end, - defp(encode_language(acc, msg)) do - field_value = msg.language() - - if(field_value == "") do - acc - else - [acc, <<26>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_keyword(acc, msg)) do - field_value = msg.keyword() - - if(field_value == "") do - acc - else - [acc, "\"", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_name(acc, msg)) do - field_value = msg.name() - - if(field_value == "") do - acc - else - [acc, "*", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_description(acc, msg)) do - field_value = msg.description() - - if(field_value == "") do - acc - else - [acc, "2", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_children(acc, msg)) do - case(msg.children()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, ":", Protox.Encode.encode_message(value)] - end) - ] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.GherkinDocument.Feature)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Location.decode!(delimited) - field = {:location, Protox.Message.merge(msg.location(), value)} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.GherkinDocument.Feature.Tag.decode!(delimited) - field = {:tags, msg.tags() ++ List.wrap(value)} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:language, value} - {field, rest} - - {4, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:keyword, value} - {field, rest} - - {5, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:name, value} - {field, rest} - - {6, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:description, value} - {field, rest} - - {7, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.GherkinDocument.Feature.FeatureChild.decode!(delimited) - field = {:children, msg.children() ++ List.wrap(value)} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, - 2 => {:tags, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Tag}}, - 3 => {:language, {:default, ""}, :string}, - 4 => {:keyword, {:default, ""}, :string}, - 5 => {:name, {:default, ""}, :string}, - 6 => {:description, {:default, ""}, :string}, - 7 => - {:children, :unpacked, - {:message, CucumberMessages.GherkinDocument.Feature.FeatureChild}} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - children: - {7, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.FeatureChild}}, - description: {6, {:default, ""}, :string}, - keyword: {4, {:default, ""}, :string}, - language: {3, {:default, ""}, :string}, - location: {1, {:default, nil}, {:message, CucumberMessages.Location}}, - name: {5, {:default, ""}, :string}, - tags: {2, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Tag}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:location)) do - {:ok, nil} - end, - def(default(:tags)) do - {:error, :no_default_value} - end, - def(default(:language)) do - {:ok, ""} - end, - def(default(:keyword)) do - {:ok, ""} - end, - def(default(:name)) do - {:ok, ""} - end, - def(default(:description)) do - {:ok, ""} - end, - def(default(:children)) do - {:error, :no_default_value} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.GherkinDocument.Comment) do - @moduledoc false - ( - defstruct(location: nil, text: "", __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_location(msg) |> encode_text(msg) |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_location(acc, msg)) do - field_value = msg.location() - - if(field_value == nil) do - acc - else - [acc, "\n", Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_text(acc, msg)) do - field_value = msg.text() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.GherkinDocument.Comment)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Location.decode!(delimited) - field = {:location, Protox.Message.merge(msg.location(), value)} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:text, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, - 2 => {:text, {:default, ""}, :string} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - location: {1, {:default, nil}, {:message, CucumberMessages.Location}}, - text: {2, {:default, ""}, :string} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:location)) do - {:ok, nil} - end, - def(default(:text)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.StepDefinition.StepDefinitionPattern) do - @moduledoc false - ( - defstruct(source: "", type: :CUCUMBER_EXPRESSION, __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_source(msg) |> encode_type(msg) |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_source(acc, msg)) do - field_value = msg.source() - - if(field_value == "") do - acc - else - [acc, "\n", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_type(acc, msg)) do - field_value = msg.type() - - if(field_value == :CUCUMBER_EXPRESSION) do - acc - else - [ - acc, - <<16>>, - field_value - |> CucumberMessages.StepDefinition.StepDefinitionPattern.StepDefinitionPatternType.encode() - |> Protox.Encode.encode_enum() - ] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.StepDefinition.StepDefinitionPattern)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:source, value} - {field, rest} - - {2, _, bytes} -> - {value, rest} = - Protox.Decode.parse_enum( - bytes, - CucumberMessages.StepDefinition.StepDefinitionPattern.StepDefinitionPatternType - ) - - field = {:type, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:source, {:default, ""}, :string}, - 2 => - {:type, {:default, :CUCUMBER_EXPRESSION}, - {:enum, - CucumberMessages.StepDefinition.StepDefinitionPattern.StepDefinitionPatternType}} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - source: {1, {:default, ""}, :string}, - type: - {2, {:default, :CUCUMBER_EXPRESSION}, - {:enum, - CucumberMessages.StepDefinition.StepDefinitionPattern.StepDefinitionPatternType}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:source)) do - {:ok, ""} - end, - def(default(:type)) do - {:ok, :CUCUMBER_EXPRESSION} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.GherkinDocument.Feature.Tag) do - @moduledoc false - ( - defstruct(location: nil, name: "", id: "", __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_location(msg) - |> encode_name(msg) - |> encode_id(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_location(acc, msg)) do - field_value = msg.location() - - if(field_value == nil) do - acc - else - [acc, "\n", Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_name(acc, msg)) do - field_value = msg.name() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_id(acc, msg)) do - field_value = msg.id() - - if(field_value == "") do - acc - else - [acc, <<26>>, Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.GherkinDocument.Feature.Tag)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Location.decode!(delimited) - field = {:location, Protox.Message.merge(msg.location(), value)} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:name, value} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:id, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, - 2 => {:name, {:default, ""}, :string}, - 3 => {:id, {:default, ""}, :string} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - id: {3, {:default, ""}, :string}, - location: {1, {:default, nil}, {:message, CucumberMessages.Location}}, - name: {2, {:default, ""}, :string} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:location)) do - {:ok, nil} - end, - def(default(:name)) do - {:ok, ""} - end, - def(default(:id)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.PickleStepArgument.PickleDocString) do - @moduledoc false - ( - defstruct(media_type: "", content: "", __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_media_type(msg) |> encode_content(msg) |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_media_type(acc, msg)) do - field_value = msg.media_type() - - if(field_value == "") do - acc - else - [acc, "\n", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_content(acc, msg)) do - field_value = msg.content() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.PickleStepArgument.PickleDocString)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:media_type, value} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:content, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{1 => {:media_type, {:default, ""}, :string}, 2 => {:content, {:default, ""}, :string}} - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{content: {2, {:default, ""}, :string}, media_type: {1, {:default, ""}, :string}} - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:media_type)) do - {:ok, ""} - end, - def(default(:content)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.PickleStepArgument) do - @moduledoc false - ( - defstruct(message: nil, __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_message(msg) |> encode_unknown_fields(msg) - end - - [ - defp(encode_message(acc, msg)) do - case(msg.message()) do - nil -> - acc - - {:doc_string, _field_value} -> - encode_doc_string(acc, msg) - - {:data_table, _field_value} -> - encode_data_table(acc, msg) - end - end - ] - - [ - defp(encode_doc_string(acc, msg)) do - {_, field_value} = msg.message() - [acc, "\n", Protox.Encode.encode_message(field_value)] - end, - defp(encode_data_table(acc, msg)) do - {_, field_value} = msg.message() - [acc, <<18>>, Protox.Encode.encode_message(field_value)] - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.PickleStepArgument)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.PickleStepArgument.PickleDocString.decode!(delimited) - - field = - case(msg.message()) do - {:doc_string, previous_value} -> - {:message, {:doc_string, Protox.Message.merge(previous_value, value)}} - - _ -> - {:message, {:doc_string, value}} - end - - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.PickleStepArgument.PickleTable.decode!(delimited) - - field = - case(msg.message()) do - {:data_table, previous_value} -> - {:message, {:data_table, Protox.Message.merge(previous_value, value)}} - - _ -> - {:message, {:data_table, value}} - end - - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => - {:doc_string, {:oneof, :message}, - {:message, CucumberMessages.PickleStepArgument.PickleDocString}}, - 2 => - {:data_table, {:oneof, :message}, - {:message, CucumberMessages.PickleStepArgument.PickleTable}} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - data_table: - {2, {:oneof, :message}, {:message, CucumberMessages.PickleStepArgument.PickleTable}}, - doc_string: - {1, {:oneof, :message}, - {:message, CucumberMessages.PickleStepArgument.PickleDocString}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:doc_string)) do - {:error, :no_default_value} - end, - def(default(:data_table)) do - {:error, :no_default_value} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.ParseError) do - @moduledoc false - ( - defstruct(source: nil, message: "", __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_source(msg) |> encode_message(msg) |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_source(acc, msg)) do - field_value = msg.source() - - if(field_value == nil) do - acc - else - [acc, "\n", Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_message(acc, msg)) do - field_value = msg.message() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.ParseError)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.SourceReference.decode!(delimited) - field = {:source, Protox.Message.merge(msg.source(), value)} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:message, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:source, {:default, nil}, {:message, CucumberMessages.SourceReference}}, - 2 => {:message, {:default, ""}, :string} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - message: {2, {:default, ""}, :string}, - source: {1, {:default, nil}, {:message, CucumberMessages.SourceReference}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:source)) do - {:ok, nil} - end, - def(default(:message)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.PickleStepArgument.PickleTable) do - @moduledoc false - ( - defstruct(rows: [], __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_rows(msg) |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_rows(acc, msg)) do - case(msg.rows()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, "\n", Protox.Encode.encode_message(value)] - end) - ] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.PickleStepArgument.PickleTable)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - - value = - CucumberMessages.PickleStepArgument.PickleTable.PickleTableRow.decode!( - delimited - ) - - field = {:rows, msg.rows() ++ List.wrap(value)} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => - {:rows, :unpacked, - {:message, CucumberMessages.PickleStepArgument.PickleTable.PickleTableRow}} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - rows: - {1, :unpacked, - {:message, CucumberMessages.PickleStepArgument.PickleTable.PickleTableRow}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:rows)) do - {:error, :no_default_value} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.GherkinDocument.Feature.Background) do - @moduledoc false - ( - defstruct( - location: nil, - keyword: "", - name: "", - description: "", - steps: [], - id: "", - __uf__: [] - ) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_location(msg) - |> encode_keyword(msg) - |> encode_name(msg) - |> encode_description(msg) - |> encode_steps(msg) - |> encode_id(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_location(acc, msg)) do - field_value = msg.location() - - if(field_value == nil) do - acc - else - [acc, "\n", Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_keyword(acc, msg)) do - field_value = msg.keyword() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_name(acc, msg)) do - field_value = msg.name() - - if(field_value == "") do - acc - else - [acc, <<26>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_description(acc, msg)) do - field_value = msg.description() - - if(field_value == "") do - acc - else - [acc, "\"", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_steps(acc, msg)) do - case(msg.steps()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, "*", Protox.Encode.encode_message(value)] - end) - ] - end - end, - defp(encode_id(acc, msg)) do - field_value = msg.id() - - if(field_value == "") do - acc - else - [acc, "2", Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.GherkinDocument.Feature.Background)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Location.decode!(delimited) - field = {:location, Protox.Message.merge(msg.location(), value)} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:keyword, value} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:name, value} - {field, rest} - - {4, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:description, value} - {field, rest} - - {5, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.GherkinDocument.Feature.Step.decode!(delimited) - field = {:steps, msg.steps() ++ List.wrap(value)} - {field, rest} - - {6, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:id, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, - 2 => {:keyword, {:default, ""}, :string}, - 3 => {:name, {:default, ""}, :string}, - 4 => {:description, {:default, ""}, :string}, - 5 => {:steps, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Step}}, - 6 => {:id, {:default, ""}, :string} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - description: {4, {:default, ""}, :string}, - id: {6, {:default, ""}, :string}, - keyword: {2, {:default, ""}, :string}, - location: {1, {:default, nil}, {:message, CucumberMessages.Location}}, - name: {3, {:default, ""}, :string}, - steps: {5, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Step}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:location)) do - {:ok, nil} - end, - def(default(:keyword)) do - {:ok, ""} - end, - def(default(:name)) do - {:ok, ""} - end, - def(default(:description)) do - {:ok, ""} - end, - def(default(:steps)) do - {:error, :no_default_value} - end, - def(default(:id)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.TestStepStarted) do - @moduledoc false - ( - defstruct(timestamp: nil, test_step_id: "", test_case_started_id: "", __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_timestamp(msg) - |> encode_test_step_id(msg) - |> encode_test_case_started_id(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_timestamp(acc, msg)) do - field_value = msg.timestamp() - - if(field_value == nil) do - acc - else - [acc, "\n", Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_test_step_id(acc, msg)) do - field_value = msg.test_step_id() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_test_case_started_id(acc, msg)) do - field_value = msg.test_case_started_id() - - if(field_value == "") do - acc - else - [acc, <<26>>, Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.TestStepStarted)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Timestamp.decode!(delimited) - field = {:timestamp, Protox.Message.merge(msg.timestamp(), value)} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:test_step_id, value} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:test_case_started_id, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:timestamp, {:default, nil}, {:message, CucumberMessages.Timestamp}}, - 2 => {:test_step_id, {:default, ""}, :string}, - 3 => {:test_case_started_id, {:default, ""}, :string} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - test_case_started_id: {3, {:default, ""}, :string}, - test_step_id: {2, {:default, ""}, :string}, - timestamp: {1, {:default, nil}, {:message, CucumberMessages.Timestamp}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:timestamp)) do - {:ok, nil} - end, - def(default(:test_step_id)) do - {:ok, ""} - end, - def(default(:test_case_started_id)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.Attachment) do - @moduledoc false - ( - defstruct( - source: nil, - test_step_id: "", - test_case_started_id: "", - body: "", - media_type: "", - content_encoding: :IDENTITY, - __uf__: [] - ) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_source(msg) - |> encode_test_step_id(msg) - |> encode_test_case_started_id(msg) - |> encode_body(msg) - |> encode_media_type(msg) - |> encode_content_encoding(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_source(acc, msg)) do - field_value = msg.source() - - if(field_value == nil) do - acc - else - [acc, "\n", Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_test_step_id(acc, msg)) do - field_value = msg.test_step_id() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_test_case_started_id(acc, msg)) do - field_value = msg.test_case_started_id() - - if(field_value == "") do - acc - else - [acc, <<26>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_body(acc, msg)) do - field_value = msg.body() - - if(field_value == "") do - acc - else - [acc, "\"", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_media_type(acc, msg)) do - field_value = msg.media_type() - - if(field_value == "") do - acc - else - [acc, "*", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_content_encoding(acc, msg)) do - field_value = msg.content_encoding() - - if(field_value == :IDENTITY) do - acc - else - [ - acc, - "0", - field_value - |> CucumberMessages.Attachment.ContentEncoding.encode() - |> Protox.Encode.encode_enum() - ] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.Attachment)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.SourceReference.decode!(delimited) - field = {:source, Protox.Message.merge(msg.source(), value)} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:test_step_id, value} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:test_case_started_id, value} - {field, rest} - - {4, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:body, value} - {field, rest} - - {5, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:media_type, value} - {field, rest} - - {6, _, bytes} -> - {value, rest} = - Protox.Decode.parse_enum(bytes, CucumberMessages.Attachment.ContentEncoding) - - field = {:content_encoding, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:source, {:default, nil}, {:message, CucumberMessages.SourceReference}}, - 2 => {:test_step_id, {:default, ""}, :string}, - 3 => {:test_case_started_id, {:default, ""}, :string}, - 4 => {:body, {:default, ""}, :string}, - 5 => {:media_type, {:default, ""}, :string}, - 6 => - {:content_encoding, {:default, :IDENTITY}, - {:enum, CucumberMessages.Attachment.ContentEncoding}} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - body: {4, {:default, ""}, :string}, - content_encoding: - {6, {:default, :IDENTITY}, {:enum, CucumberMessages.Attachment.ContentEncoding}}, - media_type: {5, {:default, ""}, :string}, - source: {1, {:default, nil}, {:message, CucumberMessages.SourceReference}}, - test_case_started_id: {3, {:default, ""}, :string}, - test_step_id: {2, {:default, ""}, :string} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:source)) do - {:ok, nil} - end, - def(default(:test_step_id)) do - {:ok, ""} - end, - def(default(:test_case_started_id)) do - {:ok, ""} - end, - def(default(:body)) do - {:ok, ""} - end, - def(default(:media_type)) do - {:ok, ""} - end, - def(default(:content_encoding)) do - {:ok, :IDENTITY} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.ParameterType) do - @moduledoc false - ( - defstruct( - name: "", - regular_expressions: [], - prefer_for_regular_expression_match: false, - use_for_snippets: false, - id: "", - __uf__: [] - ) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_name(msg) - |> encode_regular_expressions(msg) - |> encode_prefer_for_regular_expression_match(msg) - |> encode_use_for_snippets(msg) - |> encode_id(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_name(acc, msg)) do - field_value = msg.name() - - if(field_value == "") do - acc - else - [acc, "\n", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_regular_expressions(acc, msg)) do - case(msg.regular_expressions()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, <<18>>, Protox.Encode.encode_string(value)] - end) - ] - end - end, - defp(encode_prefer_for_regular_expression_match(acc, msg)) do - field_value = msg.prefer_for_regular_expression_match() - - if(field_value == false) do - acc - else - [acc, <<24>>, Protox.Encode.encode_bool(field_value)] - end - end, - defp(encode_use_for_snippets(acc, msg)) do - field_value = msg.use_for_snippets() - - if(field_value == false) do - acc - else - [acc, " ", Protox.Encode.encode_bool(field_value)] - end - end, - defp(encode_id(acc, msg)) do - field_value = msg.id() - - if(field_value == "") do - acc - else - [acc, "*", Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.ParameterType)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:name, value} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:regular_expressions, msg.regular_expressions() ++ List.wrap(value)} - {field, rest} - - {3, _, bytes} -> - {value, rest} = Protox.Decode.parse_bool(bytes) - field = {:prefer_for_regular_expression_match, value} - {field, rest} - - {4, _, bytes} -> - {value, rest} = Protox.Decode.parse_bool(bytes) - field = {:use_for_snippets, value} - {field, rest} - - {5, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:id, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:name, {:default, ""}, :string}, - 2 => {:regular_expressions, :unpacked, :string}, - 3 => {:prefer_for_regular_expression_match, {:default, false}, :bool}, - 4 => {:use_for_snippets, {:default, false}, :bool}, - 5 => {:id, {:default, ""}, :string} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - id: {5, {:default, ""}, :string}, - name: {1, {:default, ""}, :string}, - prefer_for_regular_expression_match: {3, {:default, false}, :bool}, - regular_expressions: {2, :unpacked, :string}, - use_for_snippets: {4, {:default, false}, :bool} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:name)) do - {:ok, ""} - end, - def(default(:regular_expressions)) do - {:error, :no_default_value} - end, - def(default(:prefer_for_regular_expression_match)) do - {:ok, false} - end, - def(default(:use_for_snippets)) do - {:ok, false} - end, - def(default(:id)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.Pickle.PickleStep) do - @moduledoc false - ( - defstruct(text: "", argument: nil, id: "", ast_node_ids: [], __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_text(msg) - |> encode_argument(msg) - |> encode_id(msg) - |> encode_ast_node_ids(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_text(acc, msg)) do - field_value = msg.text() - - if(field_value == "") do - acc - else - [acc, "\n", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_argument(acc, msg)) do - field_value = msg.argument() - - if(field_value == nil) do - acc - else - [acc, <<18>>, Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_id(acc, msg)) do - field_value = msg.id() - - if(field_value == "") do - acc - else - [acc, <<26>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_ast_node_ids(acc, msg)) do - case(msg.ast_node_ids()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, "\"", Protox.Encode.encode_string(value)] - end) - ] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.Pickle.PickleStep)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:text, value} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.PickleStepArgument.decode!(delimited) - field = {:argument, Protox.Message.merge(msg.argument(), value)} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:id, value} - {field, rest} - - {4, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:ast_node_ids, msg.ast_node_ids() ++ List.wrap(value)} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:text, {:default, ""}, :string}, - 2 => {:argument, {:default, nil}, {:message, CucumberMessages.PickleStepArgument}}, - 3 => {:id, {:default, ""}, :string}, - 4 => {:ast_node_ids, :unpacked, :string} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - argument: {2, {:default, nil}, {:message, CucumberMessages.PickleStepArgument}}, - ast_node_ids: {4, :unpacked, :string}, - id: {3, {:default, ""}, :string}, - text: {1, {:default, ""}, :string} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:text)) do - {:ok, ""} - end, - def(default(:argument)) do - {:ok, nil} - end, - def(default(:id)) do - {:ok, ""} - end, - def(default(:ast_node_ids)) do - {:error, :no_default_value} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.TestCaseFinished) do - @moduledoc false - ( - defstruct(timestamp: nil, test_case_started_id: "", __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_timestamp(msg) - |> encode_test_case_started_id(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_timestamp(acc, msg)) do - field_value = msg.timestamp() - - if(field_value == nil) do - acc - else - [acc, "\n", Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_test_case_started_id(acc, msg)) do - field_value = msg.test_case_started_id() - - if(field_value == "") do - acc - else - [acc, <<26>>, Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.TestCaseFinished)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Timestamp.decode!(delimited) - field = {:timestamp, Protox.Message.merge(msg.timestamp(), value)} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:test_case_started_id, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:timestamp, {:default, nil}, {:message, CucumberMessages.Timestamp}}, - 3 => {:test_case_started_id, {:default, ""}, :string} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - test_case_started_id: {3, {:default, ""}, :string}, - timestamp: {1, {:default, nil}, {:message, CucumberMessages.Timestamp}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:timestamp)) do - {:ok, nil} - end, - def(default(:test_case_started_id)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.GherkinDocument) do - @moduledoc false - ( - defstruct(uri: "", feature: nil, comments: [], __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_uri(msg) - |> encode_feature(msg) - |> encode_comments(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_uri(acc, msg)) do - field_value = msg.uri() - - if(field_value == "") do - acc - else - [acc, "\n", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_feature(acc, msg)) do - field_value = msg.feature() - - if(field_value == nil) do - acc - else - [acc, <<18>>, Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_comments(acc, msg)) do - case(msg.comments()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, <<26>>, Protox.Encode.encode_message(value)] - end) - ] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.GherkinDocument)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:uri, value} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.GherkinDocument.Feature.decode!(delimited) - field = {:feature, Protox.Message.merge(msg.feature(), value)} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.GherkinDocument.Comment.decode!(delimited) - field = {:comments, msg.comments() ++ List.wrap(value)} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:uri, {:default, ""}, :string}, - 2 => {:feature, {:default, nil}, {:message, CucumberMessages.GherkinDocument.Feature}}, - 3 => {:comments, :unpacked, {:message, CucumberMessages.GherkinDocument.Comment}} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - comments: {3, :unpacked, {:message, CucumberMessages.GherkinDocument.Comment}}, - feature: {2, {:default, nil}, {:message, CucumberMessages.GherkinDocument.Feature}}, - uri: {1, {:default, ""}, :string} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:uri)) do - {:ok, ""} - end, - def(default(:feature)) do - {:ok, nil} - end, - def(default(:comments)) do - {:error, :no_default_value} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.Hook) do - @moduledoc false - ( - defstruct(id: "", tag_expression: "", source_reference: nil, __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_id(msg) - |> encode_tag_expression(msg) - |> encode_source_reference(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_id(acc, msg)) do - field_value = msg.id() - - if(field_value == "") do - acc - else - [acc, "\n", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_tag_expression(acc, msg)) do - field_value = msg.tag_expression() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_source_reference(acc, msg)) do - field_value = msg.source_reference() - - if(field_value == nil) do - acc - else - [acc, <<26>>, Protox.Encode.encode_message(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.Hook)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:id, value} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:tag_expression, value} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.SourceReference.decode!(delimited) - field = {:source_reference, Protox.Message.merge(msg.source_reference(), value)} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:id, {:default, ""}, :string}, - 2 => {:tag_expression, {:default, ""}, :string}, - 3 => {:source_reference, {:default, nil}, {:message, CucumberMessages.SourceReference}} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - id: {1, {:default, ""}, :string}, - source_reference: {3, {:default, nil}, {:message, CucumberMessages.SourceReference}}, - tag_expression: {2, {:default, ""}, :string} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:id)) do - {:ok, ""} - end, - def(default(:tag_expression)) do - {:ok, ""} - end, - def(default(:source_reference)) do - {:ok, nil} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.Pickle) do - @moduledoc false - ( - defstruct( - id: "", - uri: "", - name: "", - language: "", - steps: [], - tags: [], - ast_node_ids: [], - __uf__: [] - ) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_id(msg) - |> encode_uri(msg) - |> encode_name(msg) - |> encode_language(msg) - |> encode_steps(msg) - |> encode_tags(msg) - |> encode_ast_node_ids(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_id(acc, msg)) do - field_value = msg.id() - - if(field_value == "") do - acc - else - [acc, "\n", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_uri(acc, msg)) do - field_value = msg.uri() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_name(acc, msg)) do - field_value = msg.name() - - if(field_value == "") do - acc - else - [acc, <<26>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_language(acc, msg)) do - field_value = msg.language() - - if(field_value == "") do - acc - else - [acc, "\"", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_steps(acc, msg)) do - case(msg.steps()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, "*", Protox.Encode.encode_message(value)] - end) - ] - end - end, - defp(encode_tags(acc, msg)) do - case(msg.tags()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, "2", Protox.Encode.encode_message(value)] - end) - ] - end - end, - defp(encode_ast_node_ids(acc, msg)) do - case(msg.ast_node_ids()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, ":", Protox.Encode.encode_string(value)] - end) - ] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.Pickle)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:id, value} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:uri, value} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:name, value} - {field, rest} - - {4, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:language, value} - {field, rest} - - {5, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Pickle.PickleStep.decode!(delimited) - field = {:steps, msg.steps() ++ List.wrap(value)} - {field, rest} - - {6, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Pickle.PickleTag.decode!(delimited) - field = {:tags, msg.tags() ++ List.wrap(value)} - {field, rest} - - {7, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:ast_node_ids, msg.ast_node_ids() ++ List.wrap(value)} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:id, {:default, ""}, :string}, - 2 => {:uri, {:default, ""}, :string}, - 3 => {:name, {:default, ""}, :string}, - 4 => {:language, {:default, ""}, :string}, - 5 => {:steps, :unpacked, {:message, CucumberMessages.Pickle.PickleStep}}, - 6 => {:tags, :unpacked, {:message, CucumberMessages.Pickle.PickleTag}}, - 7 => {:ast_node_ids, :unpacked, :string} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - ast_node_ids: {7, :unpacked, :string}, - id: {1, {:default, ""}, :string}, - language: {4, {:default, ""}, :string}, - name: {3, {:default, ""}, :string}, - steps: {5, :unpacked, {:message, CucumberMessages.Pickle.PickleStep}}, - tags: {6, :unpacked, {:message, CucumberMessages.Pickle.PickleTag}}, - uri: {2, {:default, ""}, :string} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:id)) do - {:ok, ""} - end, - def(default(:uri)) do - {:ok, ""} - end, - def(default(:name)) do - {:ok, ""} - end, - def(default(:language)) do - {:ok, ""} - end, - def(default(:steps)) do - {:error, :no_default_value} - end, - def(default(:tags)) do - {:error, :no_default_value} - end, - def(default(:ast_node_ids)) do - {:error, :no_default_value} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.Location) do - @moduledoc false - ( - defstruct(line: 0, column: 0, __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_line(msg) |> encode_column(msg) |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_line(acc, msg)) do - field_value = msg.line() - - if(field_value == 0) do - acc - else - [acc, "\b", Protox.Encode.encode_uint32(field_value)] - end - end, - defp(encode_column(acc, msg)) do - field_value = msg.column() - - if(field_value == 0) do - acc - else - [acc, <<16>>, Protox.Encode.encode_uint32(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.Location)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {value, rest} = Protox.Decode.parse_uint32(bytes) - field = {:line, value} - {field, rest} - - {2, _, bytes} -> - {value, rest} = Protox.Decode.parse_uint32(bytes) - field = {:column, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{1 => {:line, {:default, 0}, :uint32}, 2 => {:column, {:default, 0}, :uint32}} - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{column: {2, {:default, 0}, :uint32}, line: {1, {:default, 0}, :uint32}} - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:line)) do - {:ok, 0} - end, - def(default(:column)) do - {:ok, 0} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.Meta.Product) do - @moduledoc false - ( - defstruct(name: "", version: "", __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_name(msg) |> encode_version(msg) |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_name(acc, msg)) do - field_value = msg.name() - - if(field_value == "") do - acc - else - [acc, "\n", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_version(acc, msg)) do - field_value = msg.version() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.Meta.Product)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:name, value} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:version, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{1 => {:name, {:default, ""}, :string}, 2 => {:version, {:default, ""}, :string}} - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{name: {1, {:default, ""}, :string}, version: {2, {:default, ""}, :string}} - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:name)) do - {:ok, ""} - end, - def(default(:version)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.StepDefinition) do - @moduledoc false - ( - defstruct(id: "", pattern: nil, source_reference: nil, __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_id(msg) - |> encode_pattern(msg) - |> encode_source_reference(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_id(acc, msg)) do - field_value = msg.id() - - if(field_value == "") do - acc - else - [acc, "\n", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_pattern(acc, msg)) do - field_value = msg.pattern() - - if(field_value == nil) do - acc - else - [acc, <<18>>, Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_source_reference(acc, msg)) do - field_value = msg.source_reference() - - if(field_value == nil) do - acc - else - [acc, <<26>>, Protox.Encode.encode_message(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.StepDefinition)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:id, value} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.StepDefinition.StepDefinitionPattern.decode!(delimited) - field = {:pattern, Protox.Message.merge(msg.pattern(), value)} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.SourceReference.decode!(delimited) - field = {:source_reference, Protox.Message.merge(msg.source_reference(), value)} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:id, {:default, ""}, :string}, - 2 => - {:pattern, {:default, nil}, - {:message, CucumberMessages.StepDefinition.StepDefinitionPattern}}, - 3 => {:source_reference, {:default, nil}, {:message, CucumberMessages.SourceReference}} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - id: {1, {:default, ""}, :string}, - pattern: - {2, {:default, nil}, - {:message, CucumberMessages.StepDefinition.StepDefinitionPattern}}, - source_reference: {3, {:default, nil}, {:message, CucumberMessages.SourceReference}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:id)) do - {:ok, ""} - end, - def(default(:pattern)) do - {:ok, nil} - end, - def(default(:source_reference)) do - {:ok, nil} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument) do - @moduledoc false - ( - defstruct(parameter_type_name: "", group: nil, __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_parameter_type_name(msg) |> encode_group(msg) |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_parameter_type_name(acc, msg)) do - field_value = msg.parameter_type_name() - - if(field_value == "") do - acc - else - [acc, "\n", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_group(acc, msg)) do - field_value = msg.group() - - if(field_value == nil) do - acc - else - [acc, <<18>>, Protox.Encode.encode_message(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value( - bytes, - struct(CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument) - ) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:parameter_type_name, value} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - - value = - CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument.Group.decode!( - delimited - ) - - field = {:group, Protox.Message.merge(msg.group(), value)} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:parameter_type_name, {:default, ""}, :string}, - 2 => - {:group, {:default, nil}, - {:message, - CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument.Group}} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - group: - {2, {:default, nil}, - {:message, - CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument.Group}}, - parameter_type_name: {1, {:default, ""}, :string} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:parameter_type_name)) do - {:ok, ""} - end, - def(default(:group)) do - {:ok, nil} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.TestCase) do - @moduledoc false - ( - defstruct(id: "", pickle_id: "", test_steps: [], __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_id(msg) - |> encode_pickle_id(msg) - |> encode_test_steps(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_id(acc, msg)) do - field_value = msg.id() - - if(field_value == "") do - acc - else - [acc, "\n", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_pickle_id(acc, msg)) do - field_value = msg.pickle_id() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_test_steps(acc, msg)) do - case(msg.test_steps()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, <<26>>, Protox.Encode.encode_message(value)] - end) - ] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.TestCase)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:id, value} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:pickle_id, value} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.TestCase.TestStep.decode!(delimited) - field = {:test_steps, msg.test_steps() ++ List.wrap(value)} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:id, {:default, ""}, :string}, - 2 => {:pickle_id, {:default, ""}, :string}, - 3 => {:test_steps, :unpacked, {:message, CucumberMessages.TestCase.TestStep}} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - id: {1, {:default, ""}, :string}, - pickle_id: {2, {:default, ""}, :string}, - test_steps: {3, :unpacked, {:message, CucumberMessages.TestCase.TestStep}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:id)) do - {:ok, ""} - end, - def(default(:pickle_id)) do - {:ok, ""} - end, - def(default(:test_steps)) do - {:error, :no_default_value} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.GherkinDocument.Feature.Step.DataTable) do - @moduledoc false - ( - defstruct(location: nil, rows: [], __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_location(msg) |> encode_rows(msg) |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_location(acc, msg)) do - field_value = msg.location() - - if(field_value == nil) do - acc - else - [acc, "\n", Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_rows(acc, msg)) do - case(msg.rows()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, <<18>>, Protox.Encode.encode_message(value)] - end) - ] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value( - bytes, - struct(CucumberMessages.GherkinDocument.Feature.Step.DataTable) - ) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Location.decode!(delimited) - field = {:location, Protox.Message.merge(msg.location(), value)} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.GherkinDocument.Feature.TableRow.decode!(delimited) - field = {:rows, msg.rows() ++ List.wrap(value)} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, - 2 => {:rows, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.TableRow}} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - location: {1, {:default, nil}, {:message, CucumberMessages.Location}}, - rows: {2, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.TableRow}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:location)) do - {:ok, nil} - end, - def(default(:rows)) do - {:error, :no_default_value} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.SourceReference) do - @moduledoc false - ( - defstruct(uri: "", location: nil, __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_uri(msg) |> encode_location(msg) |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_uri(acc, msg)) do - field_value = msg.uri() - - if(field_value == "") do - acc - else - [acc, "\n", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_location(acc, msg)) do - field_value = msg.location() - - if(field_value == nil) do - acc - else - [acc, <<18>>, Protox.Encode.encode_message(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.SourceReference)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:uri, value} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Location.decode!(delimited) - field = {:location, Protox.Message.merge(msg.location(), value)} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:uri, {:default, ""}, :string}, - 2 => {:location, {:default, nil}, {:message, CucumberMessages.Location}} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - location: {2, {:default, nil}, {:message, CucumberMessages.Location}}, - uri: {1, {:default, ""}, :string} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:uri)) do - {:ok, ""} - end, - def(default(:location)) do - {:ok, nil} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.GherkinDocument.Feature.Step) do - @moduledoc false - ( - defstruct(location: nil, keyword: "", text: "", argument: nil, id: "", __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_argument(msg) - |> encode_location(msg) - |> encode_keyword(msg) - |> encode_text(msg) - |> encode_id(msg) - |> encode_unknown_fields(msg) - end - - [ - defp(encode_argument(acc, msg)) do - case(msg.argument()) do - nil -> - acc - - {:doc_string, _field_value} -> - encode_doc_string(acc, msg) - - {:data_table, _field_value} -> - encode_data_table(acc, msg) - end - end - ] - - [ - defp(encode_location(acc, msg)) do - field_value = msg.location() - - if(field_value == nil) do - acc - else - [acc, "\n", Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_keyword(acc, msg)) do - field_value = msg.keyword() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_text(acc, msg)) do - field_value = msg.text() - - if(field_value == "") do - acc - else - [acc, <<26>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_doc_string(acc, msg)) do - {_, field_value} = msg.argument() - [acc, "\"", Protox.Encode.encode_message(field_value)] - end, - defp(encode_data_table(acc, msg)) do - {_, field_value} = msg.argument() - [acc, "*", Protox.Encode.encode_message(field_value)] - end, - defp(encode_id(acc, msg)) do - field_value = msg.id() - - if(field_value == "") do - acc - else - [acc, "2", Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.GherkinDocument.Feature.Step)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Location.decode!(delimited) - field = {:location, Protox.Message.merge(msg.location(), value)} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:keyword, value} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:text, value} - {field, rest} - - {4, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - - value = - CucumberMessages.GherkinDocument.Feature.Step.DocString.decode!(delimited) - - field = - case(msg.argument()) do - {:doc_string, previous_value} -> - {:argument, {:doc_string, Protox.Message.merge(previous_value, value)}} - - _ -> - {:argument, {:doc_string, value}} - end - - {field, rest} - - {5, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - - value = - CucumberMessages.GherkinDocument.Feature.Step.DataTable.decode!(delimited) - - field = - case(msg.argument()) do - {:data_table, previous_value} -> - {:argument, {:data_table, Protox.Message.merge(previous_value, value)}} - - _ -> - {:argument, {:data_table, value}} - end - - {field, rest} - - {6, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:id, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, - 2 => {:keyword, {:default, ""}, :string}, - 3 => {:text, {:default, ""}, :string}, - 4 => - {:doc_string, {:oneof, :argument}, - {:message, CucumberMessages.GherkinDocument.Feature.Step.DocString}}, - 5 => - {:data_table, {:oneof, :argument}, - {:message, CucumberMessages.GherkinDocument.Feature.Step.DataTable}}, - 6 => {:id, {:default, ""}, :string} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - data_table: - {5, {:oneof, :argument}, - {:message, CucumberMessages.GherkinDocument.Feature.Step.DataTable}}, - doc_string: - {4, {:oneof, :argument}, - {:message, CucumberMessages.GherkinDocument.Feature.Step.DocString}}, - id: {6, {:default, ""}, :string}, - keyword: {2, {:default, ""}, :string}, - location: {1, {:default, nil}, {:message, CucumberMessages.Location}}, - text: {3, {:default, ""}, :string} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:location)) do - {:ok, nil} - end, - def(default(:keyword)) do - {:ok, ""} - end, - def(default(:text)) do - {:ok, ""} - end, - def(default(:doc_string)) do - {:error, :no_default_value} - end, - def(default(:data_table)) do - {:error, :no_default_value} - end, - def(default(:id)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.TestCaseStarted) do - @moduledoc false - ( - defstruct(timestamp: nil, attempt: 0, test_case_id: "", id: "", __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_timestamp(msg) - |> encode_attempt(msg) - |> encode_test_case_id(msg) - |> encode_id(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_timestamp(acc, msg)) do - field_value = msg.timestamp() - - if(field_value == nil) do - acc - else - [acc, "\n", Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_attempt(acc, msg)) do - field_value = msg.attempt() - - if(field_value == 0) do - acc - else - [acc, <<24>>, Protox.Encode.encode_uint32(field_value)] - end - end, - defp(encode_test_case_id(acc, msg)) do - field_value = msg.test_case_id() - - if(field_value == "") do - acc - else - [acc, "\"", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_id(acc, msg)) do - field_value = msg.id() - - if(field_value == "") do - acc - else - [acc, "*", Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.TestCaseStarted)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Timestamp.decode!(delimited) - field = {:timestamp, Protox.Message.merge(msg.timestamp(), value)} - {field, rest} - - {3, _, bytes} -> - {value, rest} = Protox.Decode.parse_uint32(bytes) - field = {:attempt, value} - {field, rest} - - {4, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:test_case_id, value} - {field, rest} - - {5, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:id, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:timestamp, {:default, nil}, {:message, CucumberMessages.Timestamp}}, - 3 => {:attempt, {:default, 0}, :uint32}, - 4 => {:test_case_id, {:default, ""}, :string}, - 5 => {:id, {:default, ""}, :string} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - attempt: {3, {:default, 0}, :uint32}, - id: {5, {:default, ""}, :string}, - test_case_id: {4, {:default, ""}, :string}, - timestamp: {1, {:default, nil}, {:message, CucumberMessages.Timestamp}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:timestamp)) do - {:ok, nil} - end, - def(default(:attempt)) do - {:ok, 0} - end, - def(default(:test_case_id)) do - {:ok, ""} - end, - def(default(:id)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.TestStepFinished.TestStepResult) do - @moduledoc false - ( - defstruct(status: :UNKNOWN, message: "", duration: nil, will_be_retried: false, __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_status(msg) - |> encode_message(msg) - |> encode_duration(msg) - |> encode_will_be_retried(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_status(acc, msg)) do - field_value = msg.status() - - if(field_value == :UNKNOWN) do - acc - else - [ - acc, - "\b", - field_value - |> CucumberMessages.TestStepFinished.TestStepResult.Status.encode() - |> Protox.Encode.encode_enum() - ] - end - end, - defp(encode_message(acc, msg)) do - field_value = msg.message() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_duration(acc, msg)) do - field_value = msg.duration() - - if(field_value == nil) do - acc - else - [acc, <<26>>, Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_will_be_retried(acc, msg)) do - field_value = msg.will_be_retried() - - if(field_value == false) do - acc - else - [acc, " ", Protox.Encode.encode_bool(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.TestStepFinished.TestStepResult)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {value, rest} = - Protox.Decode.parse_enum( - bytes, - CucumberMessages.TestStepFinished.TestStepResult.Status - ) - - field = {:status, value} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:message, value} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Duration.decode!(delimited) - field = {:duration, Protox.Message.merge(msg.duration(), value)} - {field, rest} - - {4, _, bytes} -> - {value, rest} = Protox.Decode.parse_bool(bytes) - field = {:will_be_retried, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => - {:status, {:default, :UNKNOWN}, - {:enum, CucumberMessages.TestStepFinished.TestStepResult.Status}}, - 2 => {:message, {:default, ""}, :string}, - 3 => {:duration, {:default, nil}, {:message, CucumberMessages.Duration}}, - 4 => {:will_be_retried, {:default, false}, :bool} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - duration: {3, {:default, nil}, {:message, CucumberMessages.Duration}}, - message: {2, {:default, ""}, :string}, - status: - {1, {:default, :UNKNOWN}, - {:enum, CucumberMessages.TestStepFinished.TestStepResult.Status}}, - will_be_retried: {4, {:default, false}, :bool} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:status)) do - {:ok, :UNKNOWN} - end, - def(default(:message)) do - {:ok, ""} - end, - def(default(:duration)) do - {:ok, nil} - end, - def(default(:will_be_retried)) do - {:ok, false} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.Envelope) do - @moduledoc false - ( - defstruct(message: nil, __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_message(msg) |> encode_unknown_fields(msg) - end - - [ - defp(encode_message(acc, msg)) do - case(msg.message()) do - nil -> - acc - - {:source, _field_value} -> - encode_source(acc, msg) - - {:gherkin_document, _field_value} -> - encode_gherkin_document(acc, msg) - - {:pickle, _field_value} -> - encode_pickle(acc, msg) - - {:step_definition, _field_value} -> - encode_step_definition(acc, msg) - - {:hook, _field_value} -> - encode_hook(acc, msg) - - {:parameter_type, _field_value} -> - encode_parameter_type(acc, msg) - - {:test_case, _field_value} -> - encode_test_case(acc, msg) - - {:undefined_parameter_type, _field_value} -> - encode_undefined_parameter_type(acc, msg) - - {:test_run_started, _field_value} -> - encode_test_run_started(acc, msg) - - {:test_case_started, _field_value} -> - encode_test_case_started(acc, msg) - - {:test_step_started, _field_value} -> - encode_test_step_started(acc, msg) - - {:attachment, _field_value} -> - encode_attachment(acc, msg) - - {:test_step_finished, _field_value} -> - encode_test_step_finished(acc, msg) - - {:test_case_finished, _field_value} -> - encode_test_case_finished(acc, msg) - - {:test_run_finished, _field_value} -> - encode_test_run_finished(acc, msg) - - {:parse_error, _field_value} -> - encode_parse_error(acc, msg) - - {:meta, _field_value} -> - encode_meta(acc, msg) - end - end - ] - - [ - defp(encode_source(acc, msg)) do - {_, field_value} = msg.message() - [acc, "\n", Protox.Encode.encode_message(field_value)] - end, - defp(encode_gherkin_document(acc, msg)) do - {_, field_value} = msg.message() - [acc, <<18>>, Protox.Encode.encode_message(field_value)] - end, - defp(encode_pickle(acc, msg)) do - {_, field_value} = msg.message() - [acc, <<26>>, Protox.Encode.encode_message(field_value)] - end, - defp(encode_step_definition(acc, msg)) do - {_, field_value} = msg.message() - [acc, "\"", Protox.Encode.encode_message(field_value)] - end, - defp(encode_hook(acc, msg)) do - {_, field_value} = msg.message() - [acc, "*", Protox.Encode.encode_message(field_value)] - end, - defp(encode_parameter_type(acc, msg)) do - {_, field_value} = msg.message() - [acc, "2", Protox.Encode.encode_message(field_value)] - end, - defp(encode_test_case(acc, msg)) do - {_, field_value} = msg.message() - [acc, ":", Protox.Encode.encode_message(field_value)] - end, - defp(encode_undefined_parameter_type(acc, msg)) do - {_, field_value} = msg.message() - [acc, "B", Protox.Encode.encode_message(field_value)] - end, - defp(encode_test_run_started(acc, msg)) do - {_, field_value} = msg.message() - [acc, "J", Protox.Encode.encode_message(field_value)] - end, - defp(encode_test_case_started(acc, msg)) do - {_, field_value} = msg.message() - [acc, "R", Protox.Encode.encode_message(field_value)] - end, - defp(encode_test_step_started(acc, msg)) do - {_, field_value} = msg.message() - [acc, "Z", Protox.Encode.encode_message(field_value)] - end, - defp(encode_attachment(acc, msg)) do - {_, field_value} = msg.message() - [acc, "b", Protox.Encode.encode_message(field_value)] - end, - defp(encode_test_step_finished(acc, msg)) do - {_, field_value} = msg.message() - [acc, "j", Protox.Encode.encode_message(field_value)] - end, - defp(encode_test_case_finished(acc, msg)) do - {_, field_value} = msg.message() - [acc, "r", Protox.Encode.encode_message(field_value)] - end, - defp(encode_test_run_finished(acc, msg)) do - {_, field_value} = msg.message() - [acc, "z", Protox.Encode.encode_message(field_value)] - end, - defp(encode_parse_error(acc, msg)) do - {_, field_value} = msg.message() - [acc, [<<130>>, <<1>>], Protox.Encode.encode_message(field_value)] - end, - defp(encode_meta(acc, msg)) do - {_, field_value} = msg.message() - [acc, [<<138>>, <<1>>], Protox.Encode.encode_message(field_value)] - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.Envelope)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Source.decode!(delimited) - - field = - case(msg.message()) do - {:source, previous_value} -> - {:message, {:source, Protox.Message.merge(previous_value, value)}} - - _ -> - {:message, {:source, value}} - end - - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.GherkinDocument.decode!(delimited) - - field = - case(msg.message()) do - {:gherkin_document, previous_value} -> - {:message, - {:gherkin_document, Protox.Message.merge(previous_value, value)}} - - _ -> - {:message, {:gherkin_document, value}} - end - - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Pickle.decode!(delimited) - - field = - case(msg.message()) do - {:pickle, previous_value} -> - {:message, {:pickle, Protox.Message.merge(previous_value, value)}} - - _ -> - {:message, {:pickle, value}} - end - - {field, rest} - - {4, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.StepDefinition.decode!(delimited) - - field = - case(msg.message()) do - {:step_definition, previous_value} -> - {:message, - {:step_definition, Protox.Message.merge(previous_value, value)}} - - _ -> - {:message, {:step_definition, value}} - end - - {field, rest} - - {5, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Hook.decode!(delimited) - - field = - case(msg.message()) do - {:hook, previous_value} -> - {:message, {:hook, Protox.Message.merge(previous_value, value)}} - - _ -> - {:message, {:hook, value}} - end - - {field, rest} - - {6, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.ParameterType.decode!(delimited) - - field = - case(msg.message()) do - {:parameter_type, previous_value} -> - {:message, {:parameter_type, Protox.Message.merge(previous_value, value)}} - - _ -> - {:message, {:parameter_type, value}} - end - - {field, rest} - - {7, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.TestCase.decode!(delimited) - - field = - case(msg.message()) do - {:test_case, previous_value} -> - {:message, {:test_case, Protox.Message.merge(previous_value, value)}} - - _ -> - {:message, {:test_case, value}} - end - - {field, rest} - - {8, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.UndefinedParameterType.decode!(delimited) - - field = - case(msg.message()) do - {:undefined_parameter_type, previous_value} -> - {:message, - {:undefined_parameter_type, Protox.Message.merge(previous_value, value)}} - - _ -> - {:message, {:undefined_parameter_type, value}} - end - - {field, rest} - - {9, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.TestRunStarted.decode!(delimited) - - field = - case(msg.message()) do - {:test_run_started, previous_value} -> - {:message, - {:test_run_started, Protox.Message.merge(previous_value, value)}} - - _ -> - {:message, {:test_run_started, value}} - end - - {field, rest} - - {10, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.TestCaseStarted.decode!(delimited) - - field = - case(msg.message()) do - {:test_case_started, previous_value} -> - {:message, - {:test_case_started, Protox.Message.merge(previous_value, value)}} - - _ -> - {:message, {:test_case_started, value}} - end - - {field, rest} - - {11, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.TestStepStarted.decode!(delimited) - - field = - case(msg.message()) do - {:test_step_started, previous_value} -> - {:message, - {:test_step_started, Protox.Message.merge(previous_value, value)}} - - _ -> - {:message, {:test_step_started, value}} - end - - {field, rest} - - {12, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Attachment.decode!(delimited) - - field = - case(msg.message()) do - {:attachment, previous_value} -> - {:message, {:attachment, Protox.Message.merge(previous_value, value)}} - - _ -> - {:message, {:attachment, value}} - end - - {field, rest} - - {13, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.TestStepFinished.decode!(delimited) - - field = - case(msg.message()) do - {:test_step_finished, previous_value} -> - {:message, - {:test_step_finished, Protox.Message.merge(previous_value, value)}} - - _ -> - {:message, {:test_step_finished, value}} - end - - {field, rest} - - {14, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.TestCaseFinished.decode!(delimited) - - field = - case(msg.message()) do - {:test_case_finished, previous_value} -> - {:message, - {:test_case_finished, Protox.Message.merge(previous_value, value)}} - - _ -> - {:message, {:test_case_finished, value}} - end - - {field, rest} - - {15, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.TestRunFinished.decode!(delimited) - - field = - case(msg.message()) do - {:test_run_finished, previous_value} -> - {:message, - {:test_run_finished, Protox.Message.merge(previous_value, value)}} - - _ -> - {:message, {:test_run_finished, value}} - end - - {field, rest} - - {16, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.ParseError.decode!(delimited) - - field = - case(msg.message()) do - {:parse_error, previous_value} -> - {:message, {:parse_error, Protox.Message.merge(previous_value, value)}} - - _ -> - {:message, {:parse_error, value}} - end - - {field, rest} - - {17, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Meta.decode!(delimited) - - field = - case(msg.message()) do - {:meta, previous_value} -> - {:message, {:meta, Protox.Message.merge(previous_value, value)}} - - _ -> - {:message, {:meta, value}} - end - - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:source, {:oneof, :message}, {:message, CucumberMessages.Source}}, - 2 => - {:gherkin_document, {:oneof, :message}, {:message, CucumberMessages.GherkinDocument}}, - 3 => {:pickle, {:oneof, :message}, {:message, CucumberMessages.Pickle}}, - 4 => - {:step_definition, {:oneof, :message}, {:message, CucumberMessages.StepDefinition}}, - 5 => {:hook, {:oneof, :message}, {:message, CucumberMessages.Hook}}, - 6 => {:parameter_type, {:oneof, :message}, {:message, CucumberMessages.ParameterType}}, - 7 => {:test_case, {:oneof, :message}, {:message, CucumberMessages.TestCase}}, - 8 => - {:undefined_parameter_type, {:oneof, :message}, - {:message, CucumberMessages.UndefinedParameterType}}, - 9 => - {:test_run_started, {:oneof, :message}, {:message, CucumberMessages.TestRunStarted}}, - 10 => - {:test_case_started, {:oneof, :message}, {:message, CucumberMessages.TestCaseStarted}}, - 11 => - {:test_step_started, {:oneof, :message}, {:message, CucumberMessages.TestStepStarted}}, - 12 => {:attachment, {:oneof, :message}, {:message, CucumberMessages.Attachment}}, - 13 => - {:test_step_finished, {:oneof, :message}, - {:message, CucumberMessages.TestStepFinished}}, - 14 => - {:test_case_finished, {:oneof, :message}, - {:message, CucumberMessages.TestCaseFinished}}, - 15 => - {:test_run_finished, {:oneof, :message}, {:message, CucumberMessages.TestRunFinished}}, - 16 => {:parse_error, {:oneof, :message}, {:message, CucumberMessages.ParseError}}, - 17 => {:meta, {:oneof, :message}, {:message, CucumberMessages.Meta}} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - attachment: {12, {:oneof, :message}, {:message, CucumberMessages.Attachment}}, - gherkin_document: {2, {:oneof, :message}, {:message, CucumberMessages.GherkinDocument}}, - hook: {5, {:oneof, :message}, {:message, CucumberMessages.Hook}}, - meta: {17, {:oneof, :message}, {:message, CucumberMessages.Meta}}, - parameter_type: {6, {:oneof, :message}, {:message, CucumberMessages.ParameterType}}, - parse_error: {16, {:oneof, :message}, {:message, CucumberMessages.ParseError}}, - pickle: {3, {:oneof, :message}, {:message, CucumberMessages.Pickle}}, - source: {1, {:oneof, :message}, {:message, CucumberMessages.Source}}, - step_definition: {4, {:oneof, :message}, {:message, CucumberMessages.StepDefinition}}, - test_case: {7, {:oneof, :message}, {:message, CucumberMessages.TestCase}}, - test_case_finished: - {14, {:oneof, :message}, {:message, CucumberMessages.TestCaseFinished}}, - test_case_started: - {10, {:oneof, :message}, {:message, CucumberMessages.TestCaseStarted}}, - test_run_finished: - {15, {:oneof, :message}, {:message, CucumberMessages.TestRunFinished}}, - test_run_started: {9, {:oneof, :message}, {:message, CucumberMessages.TestRunStarted}}, - test_step_finished: - {13, {:oneof, :message}, {:message, CucumberMessages.TestStepFinished}}, - test_step_started: - {11, {:oneof, :message}, {:message, CucumberMessages.TestStepStarted}}, - undefined_parameter_type: - {8, {:oneof, :message}, {:message, CucumberMessages.UndefinedParameterType}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:source)) do - {:error, :no_default_value} - end, - def(default(:gherkin_document)) do - {:error, :no_default_value} - end, - def(default(:pickle)) do - {:error, :no_default_value} - end, - def(default(:step_definition)) do - {:error, :no_default_value} - end, - def(default(:hook)) do - {:error, :no_default_value} - end, - def(default(:parameter_type)) do - {:error, :no_default_value} - end, - def(default(:test_case)) do - {:error, :no_default_value} - end, - def(default(:undefined_parameter_type)) do - {:error, :no_default_value} - end, - def(default(:test_run_started)) do - {:error, :no_default_value} - end, - def(default(:test_case_started)) do - {:error, :no_default_value} - end, - def(default(:test_step_started)) do - {:error, :no_default_value} - end, - def(default(:attachment)) do - {:error, :no_default_value} - end, - def(default(:test_step_finished)) do - {:error, :no_default_value} - end, - def(default(:test_case_finished)) do - {:error, :no_default_value} - end, - def(default(:test_run_finished)) do - {:error, :no_default_value} - end, - def(default(:parse_error)) do - {:error, :no_default_value} - end, - def(default(:meta)) do - {:error, :no_default_value} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.GherkinDocument.Feature.Step.DocString) do - @moduledoc false - ( - defstruct(location: nil, media_type: "", content: "", delimiter: "", __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_location(msg) - |> encode_media_type(msg) - |> encode_content(msg) - |> encode_delimiter(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_location(acc, msg)) do - field_value = msg.location() - - if(field_value == nil) do - acc - else - [acc, "\n", Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_media_type(acc, msg)) do - field_value = msg.media_type() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_content(acc, msg)) do - field_value = msg.content() - - if(field_value == "") do - acc - else - [acc, <<26>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_delimiter(acc, msg)) do - field_value = msg.delimiter() - - if(field_value == "") do - acc - else - [acc, "\"", Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value( - bytes, - struct(CucumberMessages.GherkinDocument.Feature.Step.DocString) - ) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Location.decode!(delimited) - field = {:location, Protox.Message.merge(msg.location(), value)} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:media_type, value} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:content, value} - {field, rest} - - {4, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:delimiter, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, - 2 => {:media_type, {:default, ""}, :string}, - 3 => {:content, {:default, ""}, :string}, - 4 => {:delimiter, {:default, ""}, :string} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - content: {3, {:default, ""}, :string}, - delimiter: {4, {:default, ""}, :string}, - location: {1, {:default, nil}, {:message, CucumberMessages.Location}}, - media_type: {2, {:default, ""}, :string} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:location)) do - {:ok, nil} - end, - def(default(:media_type)) do - {:ok, ""} - end, - def(default(:content)) do - {:ok, ""} - end, - def(default(:delimiter)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.Timestamp) do - @moduledoc false - ( - defstruct(seconds: 0, nanos: 0, __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_seconds(msg) |> encode_nanos(msg) |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_seconds(acc, msg)) do - field_value = msg.seconds() - - if(field_value == 0) do - acc - else - [acc, "\b", Protox.Encode.encode_int64(field_value)] - end - end, - defp(encode_nanos(acc, msg)) do - field_value = msg.nanos() - - if(field_value == 0) do - acc - else - [acc, <<16>>, Protox.Encode.encode_int32(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.Timestamp)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {value, rest} = Protox.Decode.parse_int64(bytes) - field = {:seconds, value} - {field, rest} - - {2, _, bytes} -> - {value, rest} = Protox.Decode.parse_int32(bytes) - field = {:nanos, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{1 => {:seconds, {:default, 0}, :int64}, 2 => {:nanos, {:default, 0}, :int32}} - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{nanos: {2, {:default, 0}, :int32}, seconds: {1, {:default, 0}, :int64}} - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:seconds)) do - {:ok, 0} - end, - def(default(:nanos)) do - {:ok, 0} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.TestCase.TestStep) do - @moduledoc false - ( - defstruct( - id: "", - pickle_step_id: "", - step_definition_ids: [], - step_match_arguments_lists: [], - hook_id: "", - __uf__: [] - ) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_id(msg) - |> encode_pickle_step_id(msg) - |> encode_step_definition_ids(msg) - |> encode_step_match_arguments_lists(msg) - |> encode_hook_id(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_id(acc, msg)) do - field_value = msg.id() - - if(field_value == "") do - acc - else - [acc, "\n", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_pickle_step_id(acc, msg)) do - field_value = msg.pickle_step_id() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_step_definition_ids(acc, msg)) do - case(msg.step_definition_ids()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, <<26>>, Protox.Encode.encode_string(value)] - end) - ] - end - end, - defp(encode_step_match_arguments_lists(acc, msg)) do - case(msg.step_match_arguments_lists()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, "\"", Protox.Encode.encode_message(value)] - end) - ] - end - end, - defp(encode_hook_id(acc, msg)) do - field_value = msg.hook_id() - - if(field_value == "") do - acc - else - [acc, "*", Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.TestCase.TestStep)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:id, value} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:pickle_step_id, value} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:step_definition_ids, msg.step_definition_ids() ++ List.wrap(value)} - {field, rest} - - {4, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - - value = - CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.decode!(delimited) - - field = - {:step_match_arguments_lists, - msg.step_match_arguments_lists() ++ List.wrap(value)} - - {field, rest} - - {5, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:hook_id, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:id, {:default, ""}, :string}, - 2 => {:pickle_step_id, {:default, ""}, :string}, - 3 => {:step_definition_ids, :unpacked, :string}, - 4 => - {:step_match_arguments_lists, :unpacked, - {:message, CucumberMessages.TestCase.TestStep.StepMatchArgumentsList}}, - 5 => {:hook_id, {:default, ""}, :string} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - hook_id: {5, {:default, ""}, :string}, - id: {1, {:default, ""}, :string}, - pickle_step_id: {2, {:default, ""}, :string}, - step_definition_ids: {3, :unpacked, :string}, - step_match_arguments_lists: - {4, :unpacked, {:message, CucumberMessages.TestCase.TestStep.StepMatchArgumentsList}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:id)) do - {:ok, ""} - end, - def(default(:pickle_step_id)) do - {:ok, ""} - end, - def(default(:step_definition_ids)) do - {:error, :no_default_value} - end, - def(default(:step_match_arguments_lists)) do - {:error, :no_default_value} - end, - def(default(:hook_id)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.Duration) do - @moduledoc false - ( - defstruct(seconds: 0, nanos: 0, __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_seconds(msg) |> encode_nanos(msg) |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_seconds(acc, msg)) do - field_value = msg.seconds() - - if(field_value == 0) do - acc - else - [acc, "\b", Protox.Encode.encode_int64(field_value)] - end - end, - defp(encode_nanos(acc, msg)) do - field_value = msg.nanos() - - if(field_value == 0) do - acc - else - [acc, <<16>>, Protox.Encode.encode_int32(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.Duration)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {value, rest} = Protox.Decode.parse_int64(bytes) - field = {:seconds, value} - {field, rest} - - {2, _, bytes} -> - {value, rest} = Protox.Decode.parse_int32(bytes) - field = {:nanos, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{1 => {:seconds, {:default, 0}, :int64}, 2 => {:nanos, {:default, 0}, :int32}} - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{nanos: {2, {:default, 0}, :int32}, seconds: {1, {:default, 0}, :int64}} - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:seconds)) do - {:ok, 0} - end, - def(default(:nanos)) do - {:ok, 0} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.GherkinDocument.Feature.FeatureChild) do - @moduledoc false - ( - defstruct(value: nil, __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_value(msg) |> encode_unknown_fields(msg) - end - - [ - defp(encode_value(acc, msg)) do - case(msg.value()) do - nil -> - acc - - {:rule, _field_value} -> - encode_rule(acc, msg) - - {:background, _field_value} -> - encode_background(acc, msg) - - {:scenario, _field_value} -> - encode_scenario(acc, msg) - end - end - ] - - [ - defp(encode_rule(acc, msg)) do - {_, field_value} = msg.value() - [acc, "\n", Protox.Encode.encode_message(field_value)] - end, - defp(encode_background(acc, msg)) do - {_, field_value} = msg.value() - [acc, <<18>>, Protox.Encode.encode_message(field_value)] - end, - defp(encode_scenario(acc, msg)) do - {_, field_value} = msg.value() - [acc, <<26>>, Protox.Encode.encode_message(field_value)] - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.GherkinDocument.Feature.FeatureChild)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - - value = - CucumberMessages.GherkinDocument.Feature.FeatureChild.Rule.decode!(delimited) - - field = - case(msg.value()) do - {:rule, previous_value} -> - {:value, {:rule, Protox.Message.merge(previous_value, value)}} - - _ -> - {:value, {:rule, value}} - end - - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.GherkinDocument.Feature.Background.decode!(delimited) - - field = - case(msg.value()) do - {:background, previous_value} -> - {:value, {:background, Protox.Message.merge(previous_value, value)}} - - _ -> - {:value, {:background, value}} - end - - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.GherkinDocument.Feature.Scenario.decode!(delimited) - - field = - case(msg.value()) do - {:scenario, previous_value} -> - {:value, {:scenario, Protox.Message.merge(previous_value, value)}} - - _ -> - {:value, {:scenario, value}} - end - - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => - {:rule, {:oneof, :value}, - {:message, CucumberMessages.GherkinDocument.Feature.FeatureChild.Rule}}, - 2 => - {:background, {:oneof, :value}, - {:message, CucumberMessages.GherkinDocument.Feature.Background}}, - 3 => - {:scenario, {:oneof, :value}, - {:message, CucumberMessages.GherkinDocument.Feature.Scenario}} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - background: - {2, {:oneof, :value}, {:message, CucumberMessages.GherkinDocument.Feature.Background}}, - rule: - {1, {:oneof, :value}, - {:message, CucumberMessages.GherkinDocument.Feature.FeatureChild.Rule}}, - scenario: - {3, {:oneof, :value}, {:message, CucumberMessages.GherkinDocument.Feature.Scenario}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:rule)) do - {:error, :no_default_value} - end, - def(default(:background)) do - {:error, :no_default_value} - end, - def(default(:scenario)) do - {:error, :no_default_value} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.GherkinDocument.Feature.Scenario) do - @moduledoc false - ( - defstruct( - location: nil, - tags: [], - keyword: "", - name: "", - description: "", - steps: [], - examples: [], - id: "", - __uf__: [] - ) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_location(msg) - |> encode_tags(msg) - |> encode_keyword(msg) - |> encode_name(msg) - |> encode_description(msg) - |> encode_steps(msg) - |> encode_examples(msg) - |> encode_id(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_location(acc, msg)) do - field_value = msg.location() - - if(field_value == nil) do - acc - else - [acc, "\n", Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_tags(acc, msg)) do - case(msg.tags()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, <<18>>, Protox.Encode.encode_message(value)] - end) - ] - end - end, - defp(encode_keyword(acc, msg)) do - field_value = msg.keyword() - - if(field_value == "") do - acc - else - [acc, <<26>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_name(acc, msg)) do - field_value = msg.name() - - if(field_value == "") do - acc - else - [acc, "\"", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_description(acc, msg)) do - field_value = msg.description() - - if(field_value == "") do - acc - else - [acc, "*", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_steps(acc, msg)) do - case(msg.steps()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, "2", Protox.Encode.encode_message(value)] - end) - ] - end - end, - defp(encode_examples(acc, msg)) do - case(msg.examples()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, ":", Protox.Encode.encode_message(value)] - end) - ] - end - end, - defp(encode_id(acc, msg)) do - field_value = msg.id() - - if(field_value == "") do - acc - else - [acc, "B", Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.GherkinDocument.Feature.Scenario)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Location.decode!(delimited) - field = {:location, Protox.Message.merge(msg.location(), value)} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.GherkinDocument.Feature.Tag.decode!(delimited) - field = {:tags, msg.tags() ++ List.wrap(value)} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:keyword, value} - {field, rest} - - {4, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:name, value} - {field, rest} - - {5, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:description, value} - {field, rest} - - {6, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.GherkinDocument.Feature.Step.decode!(delimited) - field = {:steps, msg.steps() ++ List.wrap(value)} - {field, rest} - - {7, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - - value = - CucumberMessages.GherkinDocument.Feature.Scenario.Examples.decode!(delimited) - - field = {:examples, msg.examples() ++ List.wrap(value)} - {field, rest} - - {8, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:id, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, - 2 => {:tags, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Tag}}, - 3 => {:keyword, {:default, ""}, :string}, - 4 => {:name, {:default, ""}, :string}, - 5 => {:description, {:default, ""}, :string}, - 6 => {:steps, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Step}}, - 7 => - {:examples, :unpacked, - {:message, CucumberMessages.GherkinDocument.Feature.Scenario.Examples}}, - 8 => {:id, {:default, ""}, :string} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - description: {5, {:default, ""}, :string}, - examples: - {7, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Scenario.Examples}}, - id: {8, {:default, ""}, :string}, - keyword: {3, {:default, ""}, :string}, - location: {1, {:default, nil}, {:message, CucumberMessages.Location}}, - name: {4, {:default, ""}, :string}, - steps: {6, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Step}}, - tags: {2, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Tag}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:location)) do - {:ok, nil} - end, - def(default(:tags)) do - {:error, :no_default_value} - end, - def(default(:keyword)) do - {:ok, ""} - end, - def(default(:name)) do - {:ok, ""} - end, - def(default(:description)) do - {:ok, ""} - end, - def(default(:steps)) do - {:error, :no_default_value} - end, - def(default(:examples)) do - {:error, :no_default_value} - end, - def(default(:id)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.Meta.CI.Git) do - @moduledoc false - ( - defstruct(remote: "", revision: "", branch: "", tag: "", __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_remote(msg) - |> encode_revision(msg) - |> encode_branch(msg) - |> encode_tag(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_remote(acc, msg)) do - field_value = msg.remote() - - if(field_value == "") do - acc - else - [acc, "\n", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_revision(acc, msg)) do - field_value = msg.revision() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_branch(acc, msg)) do - field_value = msg.branch() - - if(field_value == "") do - acc - else - [acc, <<26>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_tag(acc, msg)) do - field_value = msg.tag() - - if(field_value == "") do - acc - else - [acc, "\"", Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.Meta.CI.Git)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:remote, value} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:revision, value} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:branch, value} - {field, rest} - - {4, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:tag, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:remote, {:default, ""}, :string}, - 2 => {:revision, {:default, ""}, :string}, - 3 => {:branch, {:default, ""}, :string}, - 4 => {:tag, {:default, ""}, :string} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - branch: {3, {:default, ""}, :string}, - remote: {1, {:default, ""}, :string}, - revision: {2, {:default, ""}, :string}, - tag: {4, {:default, ""}, :string} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:remote)) do - {:ok, ""} - end, - def(default(:revision)) do - {:ok, ""} - end, - def(default(:branch)) do - {:ok, ""} - end, - def(default(:tag)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.Source) do - @moduledoc false - ( - defstruct(uri: "", data: "", media_type: "", __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_uri(msg) - |> encode_data(msg) - |> encode_media_type(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_uri(acc, msg)) do - field_value = msg.uri() - - if(field_value == "") do - acc - else - [acc, "\n", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_data(acc, msg)) do - field_value = msg.data() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_media_type(acc, msg)) do - field_value = msg.media_type() - - if(field_value == "") do - acc - else - [acc, <<26>>, Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.Source)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:uri, value} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:data, value} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:media_type, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:uri, {:default, ""}, :string}, - 2 => {:data, {:default, ""}, :string}, - 3 => {:media_type, {:default, ""}, :string} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - data: {2, {:default, ""}, :string}, - media_type: {3, {:default, ""}, :string}, - uri: {1, {:default, ""}, :string} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:uri)) do - {:ok, ""} - end, - def(default(:data)) do - {:ok, ""} - end, - def(default(:media_type)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.GherkinDocument.Feature.Scenario.Examples) do - @moduledoc false - ( - defstruct( - location: nil, - tags: [], - keyword: "", - name: "", - description: "", - table_header: nil, - table_body: [], - id: "", - __uf__: [] - ) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_location(msg) - |> encode_tags(msg) - |> encode_keyword(msg) - |> encode_name(msg) - |> encode_description(msg) - |> encode_table_header(msg) - |> encode_table_body(msg) - |> encode_id(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_location(acc, msg)) do - field_value = msg.location() - - if(field_value == nil) do - acc - else - [acc, "\n", Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_tags(acc, msg)) do - case(msg.tags()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, <<18>>, Protox.Encode.encode_message(value)] - end) - ] - end - end, - defp(encode_keyword(acc, msg)) do - field_value = msg.keyword() - - if(field_value == "") do - acc - else - [acc, <<26>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_name(acc, msg)) do - field_value = msg.name() - - if(field_value == "") do - acc - else - [acc, "\"", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_description(acc, msg)) do - field_value = msg.description() - - if(field_value == "") do - acc - else - [acc, "*", Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_table_header(acc, msg)) do - field_value = msg.table_header() - - if(field_value == nil) do - acc - else - [acc, "2", Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_table_body(acc, msg)) do - case(msg.table_body()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, ":", Protox.Encode.encode_message(value)] - end) - ] - end - end, - defp(encode_id(acc, msg)) do - field_value = msg.id() - - if(field_value == "") do - acc - else - [acc, "B", Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value( - bytes, - struct(CucumberMessages.GherkinDocument.Feature.Scenario.Examples) - ) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Location.decode!(delimited) - field = {:location, Protox.Message.merge(msg.location(), value)} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.GherkinDocument.Feature.Tag.decode!(delimited) - field = {:tags, msg.tags() ++ List.wrap(value)} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:keyword, value} - {field, rest} - - {4, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:name, value} - {field, rest} - - {5, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:description, value} - {field, rest} - - {6, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.GherkinDocument.Feature.TableRow.decode!(delimited) - field = {:table_header, Protox.Message.merge(msg.table_header(), value)} - {field, rest} - - {7, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.GherkinDocument.Feature.TableRow.decode!(delimited) - field = {:table_body, msg.table_body() ++ List.wrap(value)} - {field, rest} - - {8, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:id, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, - 2 => {:tags, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Tag}}, - 3 => {:keyword, {:default, ""}, :string}, - 4 => {:name, {:default, ""}, :string}, - 5 => {:description, {:default, ""}, :string}, - 6 => - {:table_header, {:default, nil}, - {:message, CucumberMessages.GherkinDocument.Feature.TableRow}}, - 7 => - {:table_body, :unpacked, - {:message, CucumberMessages.GherkinDocument.Feature.TableRow}}, - 8 => {:id, {:default, ""}, :string} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - description: {5, {:default, ""}, :string}, - id: {8, {:default, ""}, :string}, - keyword: {3, {:default, ""}, :string}, - location: {1, {:default, nil}, {:message, CucumberMessages.Location}}, - name: {4, {:default, ""}, :string}, - table_body: - {7, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.TableRow}}, - table_header: - {6, {:default, nil}, {:message, CucumberMessages.GherkinDocument.Feature.TableRow}}, - tags: {2, :unpacked, {:message, CucumberMessages.GherkinDocument.Feature.Tag}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:location)) do - {:ok, nil} - end, - def(default(:tags)) do - {:error, :no_default_value} - end, - def(default(:keyword)) do - {:ok, ""} - end, - def(default(:name)) do - {:ok, ""} - end, - def(default(:description)) do - {:ok, ""} - end, - def(default(:table_header)) do - {:ok, nil} - end, - def(default(:table_body)) do - {:error, :no_default_value} - end, - def(default(:id)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument.Group) do - @moduledoc false - ( - defstruct(start: 0, value: "", children: [], __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_start(msg) - |> encode_value(msg) - |> encode_children(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_start(acc, msg)) do - field_value = msg.start() - - if(field_value == 0) do - acc - else - [acc, "\b", Protox.Encode.encode_uint32(field_value)] - end - end, - defp(encode_value(acc, msg)) do - field_value = msg.value() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_children(acc, msg)) do - case(msg.children()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, <<26>>, Protox.Encode.encode_message(value)] - end) - ] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value( - bytes, - struct( - CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument.Group - ) - ) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {value, rest} = Protox.Decode.parse_uint32(bytes) - field = {:start, value} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:value, value} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - - value = - CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument.Group.decode!( - delimited - ) - - field = {:children, msg.children() ++ List.wrap(value)} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:start, {:default, 0}, :uint32}, - 2 => {:value, {:default, ""}, :string}, - 3 => - {:children, :unpacked, - {:message, - CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument.Group}} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - children: - {3, :unpacked, - {:message, - CucumberMessages.TestCase.TestStep.StepMatchArgumentsList.StepMatchArgument.Group}}, - start: {1, {:default, 0}, :uint32}, - value: {2, {:default, ""}, :string} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:start)) do - {:ok, 0} - end, - def(default(:value)) do - {:ok, ""} - end, - def(default(:children)) do - {:error, :no_default_value} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.PickleStepArgument.PickleTable.PickleTableRow) do - @moduledoc false - ( - defstruct(cells: [], __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_cells(msg) |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_cells(acc, msg)) do - case(msg.cells()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, "\n", Protox.Encode.encode_message(value)] - end) - ] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value( - bytes, - struct(CucumberMessages.PickleStepArgument.PickleTable.PickleTableRow) - ) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - - value = - CucumberMessages.PickleStepArgument.PickleTable.PickleTableRow.PickleTableCell.decode!( - delimited - ) - - field = {:cells, msg.cells() ++ List.wrap(value)} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => - {:cells, :unpacked, - {:message, - CucumberMessages.PickleStepArgument.PickleTable.PickleTableRow.PickleTableCell}} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - cells: - {1, :unpacked, - {:message, - CucumberMessages.PickleStepArgument.PickleTable.PickleTableRow.PickleTableCell}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:cells)) do - {:error, :no_default_value} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.TestRunFinished) do - @moduledoc false - ( - defstruct(success: false, timestamp: nil, message: "", __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_success(msg) - |> encode_timestamp(msg) - |> encode_message(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_success(acc, msg)) do - field_value = msg.success() - - if(field_value == false) do - acc - else - [acc, "\b", Protox.Encode.encode_bool(field_value)] - end - end, - defp(encode_timestamp(acc, msg)) do - field_value = msg.timestamp() - - if(field_value == nil) do - acc - else - [acc, <<18>>, Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_message(acc, msg)) do - field_value = msg.message() - - if(field_value == "") do - acc - else - [acc, <<26>>, Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.TestRunFinished)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {value, rest} = Protox.Decode.parse_bool(bytes) - field = {:success, value} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Timestamp.decode!(delimited) - field = {:timestamp, Protox.Message.merge(msg.timestamp(), value)} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:message, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:success, {:default, false}, :bool}, - 2 => {:timestamp, {:default, nil}, {:message, CucumberMessages.Timestamp}}, - 3 => {:message, {:default, ""}, :string} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - message: {3, {:default, ""}, :string}, - success: {1, {:default, false}, :bool}, - timestamp: {2, {:default, nil}, {:message, CucumberMessages.Timestamp}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:success)) do - {:ok, false} - end, - def(default(:timestamp)) do - {:ok, nil} - end, - def(default(:message)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.TestRunStarted) do - @moduledoc false - ( - defstruct(timestamp: nil, __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_timestamp(msg) |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_timestamp(acc, msg)) do - field_value = msg.timestamp() - - if(field_value == nil) do - acc - else - [acc, "\n", Protox.Encode.encode_message(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.TestRunStarted)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Timestamp.decode!(delimited) - field = {:timestamp, Protox.Message.merge(msg.timestamp(), value)} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{1 => {:timestamp, {:default, nil}, {:message, CucumberMessages.Timestamp}}} - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{timestamp: {1, {:default, nil}, {:message, CucumberMessages.Timestamp}}} - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:timestamp)) do - {:ok, nil} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.GherkinDocument.Feature.TableRow.TableCell) do - @moduledoc false - ( - defstruct(location: nil, value: "", __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] |> encode_location(msg) |> encode_value(msg) |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_location(acc, msg)) do - field_value = msg.location() - - if(field_value == nil) do - acc - else - [acc, "\n", Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_value(acc, msg)) do - field_value = msg.value() - - if(field_value == "") do - acc - else - [acc, <<18>>, Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value( - bytes, - struct(CucumberMessages.GherkinDocument.Feature.TableRow.TableCell) - ) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Location.decode!(delimited) - field = {:location, Protox.Message.merge(msg.location(), value)} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:value, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, - 2 => {:value, {:default, ""}, :string} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - location: {1, {:default, nil}, {:message, CucumberMessages.Location}}, - value: {2, {:default, ""}, :string} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:location)) do - {:ok, nil} - end, - def(default(:value)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.GherkinDocument.Feature.TableRow) do - @moduledoc false - ( - defstruct(location: nil, cells: [], id: "", __uf__: []) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_location(msg) - |> encode_cells(msg) - |> encode_id(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_location(acc, msg)) do - field_value = msg.location() - - if(field_value == nil) do - acc - else - [acc, "\n", Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_cells(acc, msg)) do - case(msg.cells()) do - [] -> - acc - - values -> - [ - acc, - Enum.reduce(values, [], fn value, acc -> - [acc, <<18>>, Protox.Encode.encode_message(value)] - end) - ] - end - end, - defp(encode_id(acc, msg)) do - field_value = msg.id() - - if(field_value == "") do - acc - else - [acc, <<26>>, Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.GherkinDocument.Feature.TableRow)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Location.decode!(delimited) - field = {:location, Protox.Message.merge(msg.location(), value)} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - - value = - CucumberMessages.GherkinDocument.Feature.TableRow.TableCell.decode!(delimited) - - field = {:cells, msg.cells() ++ List.wrap(value)} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:id, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => {:location, {:default, nil}, {:message, CucumberMessages.Location}}, - 2 => - {:cells, :unpacked, - {:message, CucumberMessages.GherkinDocument.Feature.TableRow.TableCell}}, - 3 => {:id, {:default, ""}, :string} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - cells: - {2, :unpacked, - {:message, CucumberMessages.GherkinDocument.Feature.TableRow.TableCell}}, - id: {3, {:default, ""}, :string}, - location: {1, {:default, nil}, {:message, CucumberMessages.Location}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:location)) do - {:ok, nil} - end, - def(default(:cells)) do - {:error, :no_default_value} - end, - def(default(:id)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end, - defmodule(CucumberMessages.TestStepFinished) do - @moduledoc false - ( - defstruct( - test_step_result: nil, - timestamp: nil, - test_step_id: "", - test_case_started_id: "", - __uf__: [] - ) - - ( - @spec encode(struct) :: {:ok, iodata} | {:error, any} - def(encode(msg)) do - try do - {:ok, encode!(msg)} - rescue - e -> - {:error, e} - end - end - - @spec encode!(struct) :: iodata | no_return - def(encode!(msg)) do - [] - |> encode_test_step_result(msg) - |> encode_timestamp(msg) - |> encode_test_step_id(msg) - |> encode_test_case_started_id(msg) - |> encode_unknown_fields(msg) - end - - [] - - [ - defp(encode_test_step_result(acc, msg)) do - field_value = msg.test_step_result() - - if(field_value == nil) do - acc - else - [acc, "\n", Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_timestamp(acc, msg)) do - field_value = msg.timestamp() - - if(field_value == nil) do - acc - else - [acc, <<18>>, Protox.Encode.encode_message(field_value)] - end - end, - defp(encode_test_step_id(acc, msg)) do - field_value = msg.test_step_id() - - if(field_value == "") do - acc - else - [acc, <<26>>, Protox.Encode.encode_string(field_value)] - end - end, - defp(encode_test_case_started_id(acc, msg)) do - field_value = msg.test_case_started_id() - - if(field_value == "") do - acc - else - [acc, "\"", Protox.Encode.encode_string(field_value)] - end - end - ] - - defp(encode_unknown_fields(acc, msg)) do - Enum.reduce(msg.__struct__.unknown_fields(msg), acc, fn {tag, wire_type, bytes}, acc -> - case(wire_type) do - 0 -> - [acc, Protox.Encode.make_key_bytes(tag, :int32), bytes] - - 1 -> - [acc, Protox.Encode.make_key_bytes(tag, :double), bytes] - - 2 -> - len_bytes = bytes |> byte_size() |> Protox.Varint.encode() - [acc, Protox.Encode.make_key_bytes(tag, :packed), len_bytes, bytes] - - 5 -> - [acc, Protox.Encode.make_key_bytes(tag, :float), bytes] - end - end) - end - ) - - ( - @spec decode(binary) :: {:ok, struct} | {:error, any} - def(decode(bytes)) do - try do - {:ok, decode!(bytes)} - rescue - Protox.IllegalTagError -> - {:error, :illegal_tag} - - e in Protox.RequiredFieldsError -> - {:error, {:missing_fields, e.missing_fields}} - - e in Protox.DecodingError -> - {:error, {e.reason, e.binary}} - - e -> - {:error, e} - end - end - - ( - @spec decode!(binary) :: struct | no_return - def(decode!(bytes)) do - parse_key_value(bytes, struct(CucumberMessages.TestStepFinished)) - end - ) - - ( - @spec parse_key_value(binary, struct) :: struct - defp(parse_key_value(<<>>, msg)) do - msg - end - - defp(parse_key_value(bytes, msg)) do - {field, rest} = - case(Protox.Decode.parse_key(bytes)) do - {0, _, _} -> - raise(%Protox.IllegalTagError{}) - - {1, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.TestStepFinished.TestStepResult.decode!(delimited) - field = {:test_step_result, Protox.Message.merge(msg.test_step_result(), value)} - {field, rest} - - {2, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = CucumberMessages.Timestamp.decode!(delimited) - field = {:timestamp, Protox.Message.merge(msg.timestamp(), value)} - {field, rest} - - {3, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:test_step_id, value} - {field, rest} - - {4, _, bytes} -> - {len, bytes} = Protox.Varint.decode(bytes) - <> = bytes - value = delimited - field = {:test_case_started_id, value} - {field, rest} - - {tag, wire_type, rest} -> - {value, new_rest} = Protox.Decode.parse_unknown(tag, wire_type, rest) - - field = - {msg.__struct__.unknown_fields_name, - [value | msg.__struct__.unknown_fields(msg)]} - - {field, new_rest} - end - - msg_updated = struct(msg, [field]) - parse_key_value(rest, msg_updated) - end - ) - - [] - ) - - @spec defs() :: %{ - required(non_neg_integer) => {atom, Protox.Types.kind(), Protox.Types.type()} - } - def(defs()) do - %{ - 1 => - {:test_step_result, {:default, nil}, - {:message, CucumberMessages.TestStepFinished.TestStepResult}}, - 2 => {:timestamp, {:default, nil}, {:message, CucumberMessages.Timestamp}}, - 3 => {:test_step_id, {:default, ""}, :string}, - 4 => {:test_case_started_id, {:default, ""}, :string} - } - end - - @spec defs_by_name() :: %{ - required(atom) => {non_neg_integer, Protox.Types.kind(), Protox.Types.type()} - } - def(defs_by_name()) do - %{ - test_case_started_id: {4, {:default, ""}, :string}, - test_step_id: {3, {:default, ""}, :string}, - test_step_result: - {1, {:default, nil}, {:message, CucumberMessages.TestStepFinished.TestStepResult}}, - timestamp: {2, {:default, nil}, {:message, CucumberMessages.Timestamp}} - } - end - - @spec required_fields() :: [] - def(required_fields()) do - [] - end - - @spec unknown_fields(struct) :: [{non_neg_integer, Protox.Types.tag(), binary}] - def(unknown_fields(msg)) do - msg.__uf__() - end - - @spec unknown_fields_name() :: :__uf__ - def(unknown_fields_name()) do - :__uf__ - end - - @spec clear_unknown_fields(struct) :: struct - def(clear_unknown_fields(msg)) do - struct!(msg, [{unknown_fields_name(), []}]) - end - - @spec syntax() :: atom - def(syntax()) do - :proto3 - end - - [ - @spec( - default(atom) :: {:ok, boolean | integer | String.t() | binary | float} | {:error, atom} - ), - [ - def(default(:test_step_result)) do - {:ok, nil} - end, - def(default(:timestamp)) do - {:ok, nil} - end, - def(default(:test_step_id)) do - {:ok, ""} - end, - def(default(:test_case_started_id)) do - {:ok, ""} - end - ], - def(default(_)) do - {:error, :no_such_field} - end - ] - ) - - [] - end -] diff --git a/messages/elixir/mix.lock b/messages/elixir/mix.lock index 995ab56e51..f163fab5be 100644 --- a/messages/elixir/mix.lock +++ b/messages/elixir/mix.lock @@ -1,9 +1,9 @@ %{ "earmark_parser": {:hex, :earmark_parser, "1.4.10", "6603d7a603b9c18d3d20db69921527f82ef09990885ed7525003c7fe7dc86c56", [:mix], [], "hexpm", "8e2d5370b732385db2c9b22215c3f59c84ac7dda7ed7e544d7c459496ae519c0"}, - "ex_doc": {:hex, :ex_doc, "0.22.5", "d2312c99f52cb1f98371e28f68259b4e0cee13d0122baedaf74a8e44e299a35b", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "d6ac685fd0b226805db96f7fbb384cbf8e01903ddb902ff66c9b189104705cae"}, + "ex_doc": {:hex, :ex_doc, "0.23.0", "a069bc9b0bf8efe323ecde8c0d62afc13d308b1fa3d228b65bca5cf8703a529d", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "f5e2c4702468b2fd11b10d39416ddadd2fcdd173ba2a0285ebd92c39827a5a16"}, "jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"}, - "makeup": {:hex, :makeup, "1.0.3", "e339e2f766d12e7260e6672dd4047405963c5ec99661abdc432e6ec67d29ef95", [:mix], [{:nimble_parsec, "~> 0.5", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "2e9b4996d11832947731f7608fed7ad2f9443011b3b479ae288011265cdd3dad"}, - "makeup_elixir": {:hex, :makeup_elixir, "0.14.1", "4f0e96847c63c17841d42c08107405a005a2680eb9c7ccadfd757bd31dabccfb", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f2438b1a80eaec9ede832b5c41cd4f373b38fd7aa33e3b22d9db79e640cbde11"}, - "nimble_parsec": {:hex, :nimble_parsec, "0.6.0", "32111b3bf39137144abd7ba1cce0914533b2d16ef35e8abc5ec8be6122944263", [:mix], [], "hexpm", "27eac315a94909d4dc68bc07a4a83e06c8379237c5ea528a9acff4ca1c873c52"}, - "protox": {:hex, :protox, "1.0.0", "48e3600c9f5dc34cd88fc0d11440ffd90f4850f11eeaaf30b98771e75dcb918e", [:mix], [], "hexpm", "a808c48c3fca79787cc8d7c34c57558e8c119e92430e85bda8da6d29eeb98151"}, + "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"}, + "protox": {:hex, :protox, "1.1.1", "0134aa8dd5c29dd2a27dde518aff8e92f4c8730b3c272ec6b16df9113bbd3ef7", [:mix], [], "hexpm", "e583a0a66f9d7fa1afb09a2d976d09d61f9c25ed1f3fb3f2faff7dd4d70fa7c9"}, }