Skip to content

Fix Enum with module in generated TS interface. - #1278

Merged
sampajano merged 1 commit into
grpc:masterfrom
sampajano:1.fix.enum.module
Sep 16, 2022
Merged

Fix Enum with module in generated TS interface.#1278
sampajano merged 1 commit into
grpc:masterfrom
sampajano:1.fix.enum.module

Conversation

@sampajano

Copy link
Copy Markdown
Collaborator

Verified with the example in #1271

// enum.proto

syntax = "proto3";

enum DocEnum {
    DOC_ENUM_PDF = 0;
    DOC_ENUM_HTML = 1;
}

// test.proto

syntax = "proto3";

import "enum.proto";

package Test;

message HelloRequest {
    DocEnum doc = 1;
}

Generate:

protoc -I=. *.proto --js_out=import_style=commonjs,binary:. --grpc-web_out=import_style=typescript,mode=grpcwebtext:.

Before

getDoc(): enum_pbDocEnum;
setDoc(value: enum_pbDocEnum): HelloRequest;

After

getDoc(): enum_pb.DocEnum;
setDoc(value: enum_pb.DocEnum): HelloRequest;

Fixes #1271

Verified with the example in grpc#1271

// enum.proto
```proto
syntax = "proto3";

enum DocEnum {
    DOC_ENUM_PDF = 0;
    DOC_ENUM_HTML = 1;
}
```

// test.proto
```proto
syntax = "proto3";

import "enum.proto";

package Test;

message HelloRequest {
    DocEnum doc = 1;
}
```

generate:
```
protoc --proto_path=. --js_out=import_style=commonjs,binary:. --grpc-web_out=import_style=typescript,mode=grpcwebtext:. *.proto
```

@stanley-cheung stanley-cheung left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing dot after enum's namespace in typescript file

2 participants