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

Incorrect code generated with type names #28

Open
mharmer opened this issue May 30, 2019 · 0 comments
Open

Incorrect code generated with type names #28

mharmer opened this issue May 30, 2019 · 0 comments

Comments

@mharmer
Copy link

mharmer commented May 30, 2019

When compiling a single proto file that imports another, the referenced types don't seem to be correct:

sub.proto:

syntax = "proto3";

package Foo;

message Baz2 {
	int32 field_a = 1;
}

main.proto:

syntax = "proto3";

import "sub.proto";

package Foo;

message Baz {
	Baz2 field_a = 1;
}

Compiled with: protoc --elm_out=. main.proto sub.proto

Produces incorrect code:

-- Sub.elm
type alias Baz2 =
    { fieldA : Int -- 1
    }

-- Main.elm
type alias Baz =
    { fieldA : Maybe Foo_Baz2 -- 1
    }

Compiler error for reference:

I cannot find a `Foo_Baz2` type:

16|     { fieldA : Maybe Foo_Baz2 -- 1

It seems as though the package name is incorrectly being added to the name of the type.
As a workaround, if I comment out the package name from both proto files it seems to generate correct code.

I don't know if this falls into the unsupported 'Packages' listing in the main README.md, since it didn't list details as to why it wasn't supported.

Interestingly, this is very similar to a bug I just reported in the other Elm protoc project: eriktim/protoc-gen-elm#7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant