Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom options are not parsed correctly #138

Open
alirezasharifianzadeh opened this issue Dec 11, 2020 · 0 comments
Open

Custom options are not parsed correctly #138

alirezasharifianzadeh opened this issue Dec 11, 2020 · 0 comments
Labels
Effort:Large Kind:Bug A bug. Can be a documentation bug, Dialyzer issue, or anything that just "doesn't work".

Comments

@alirezasharifianzadeh
Copy link

alirezasharifianzadeh commented Dec 11, 2020

Hi, I am trying to parse this proto file:

syntax = "proto3";

import "google/protobuf/descriptor.proto";

extend google.protobuf.EnumValueOptions {
  optional uint32 my_enum_value_option = 50005;
}

enum MyEnum {
  UNKNOWN = 0;
  FOO = 1 [(my_enum_value_option) = 321];
  BAR = 2;
}

with this command:

protoc -I . --elixir_out=gen_descriptors=true:. --plugin=/Users/alirezasharifianzadeh/.asdf/installs/elixir/1.11.1/.mix/escripts/protoc-gen-elixir *.proto

But the output does not contain my_enum_value_option value!

Here is the elixir output:

defmodule MyEnum do
  @moduledoc false
  use Protobuf, enum: true, syntax: :proto2
  @type t :: integer | :UNKNOWN | :FOO | :BAR

  def descriptor do
    # credo:disable-for-next-line
    Elixir.Google.Protobuf.EnumDescriptorProto.decode(
      <<10, 6, 77, 121, 69, 110, 117, 109, 18, 11, 10, 7, 85, 78, 75, 78, 79, 87, 78, 16, 0, 18,
        11, 10, 3, 70, 79, 79, 16, 1, 26, 2, 8, 0, 18, 7, 10, 3, 66, 65, 82, 16, 2>>
    )
  end

  field :UNKNOWN, 0

  field :FOO, 1

  field :BAR, 2
end
%Google.Protobuf.EnumDescriptorProto{
  name: "MyEnum",
  options: nil,
  reserved_name: [],
  reserved_range: [],
  value: [
    %Google.Protobuf.EnumValueDescriptorProto{
      name: "UNKNOWN",
      number: 0,
      options: nil
    },
    %Google.Protobuf.EnumValueDescriptorProto{
      name: "FOO",
      number: 1,
      options: %Google.Protobuf.EnumValueOptions{
        deprecated: false,
        uninterpreted_option: []
      }
    },
    %Google.Protobuf.EnumValueDescriptorProto{
      name: "BAR",
      number: 2,
      options: nil
    }
  ]
}
@whatyouhide whatyouhide added the bug label Nov 4, 2021
@whatyouhide whatyouhide added Kind:Bug A bug. Can be a documentation bug, Dialyzer issue, or anything that just "doesn't work". and removed bug labels May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Effort:Large Kind:Bug A bug. Can be a documentation bug, Dialyzer issue, or anything that just "doesn't work".
Projects
None yet
Development

No branches or pull requests

2 participants