grpc / grpc-web

gRPC for Web Clients
https://grpc.io
Apache License 2.0
8.46k stars 762 forks source link

Duplicate dot after enum's namespace in typescript file when using dot in package name #1284

Closed johejo closed 1 year ago

johejo commented 1 year ago

related #1271

1278 breaks the package name includes dot.

$ tree
.
├── child
│   └── enum.proto
└── test.proto

1 directory, 2 files

test.proto

syntax = "proto3";

import "child/enum.proto";

package test;

message HelloRequest {
    child.DocEnum doc = 1;
}

child/enum.proto

syntax = "proto3";

package test.child;

enum DocEnum {
    DOC_ENUM_PDF = 0;
    DOC_ENUM_HTML = 1;
}
$ protoc-gen-grpc-web --version
protoc-gen-grpc-web 1.4.0
protoc -I=. *.proto --plugin=/path/to/protoc-gen-js --plugin=/path/to/protoc-gen-grpc-web --js_out=import_style=commonjs:. --grpc-web_out=import_style=commonjs+dts,mode=grpcwebtext:.
import * as jspb from 'google-protobuf'

import * as child_enum_pb from './child/enum_pb';

export class HelloRequest extends jspb.Message {
  getDoc(): child_enum_pb..DocEnum;
  setDoc(value: child_enum_pb..DocEnum): HelloRequest;

  serializeBinary(): Uint8Array;
  toObject(includeInstance?: boolean): HelloRequest.AsObject;
  static toObject(includeInstance: boolean, msg: HelloRequest): HelloRequest.AsObject;
  static serializeBinaryToWriter(message: HelloRequest, writer: jspb.BinaryWriter): void;
  static deserializeBinary(bytes: Uint8Array): HelloRequest;
  static deserializeBinaryFromReader(message: HelloRequest, reader: jspb.BinaryReader): HelloRequest;
}

export namespace HelloRequest {
  export type AsObject = {
    doc: child_enum_pb..DocEnum,
  }
}
augi commented 1 year ago

Hello, we are observing exactly the same issue 🙏

sampajano commented 1 year ago

@johejo @augi Thanks so much for reporting this issue! I'll take a look and provide a fix release soon!

augi commented 1 year ago

Thank you very much for the quick fix! 👍 When can we expect a new release, please? 🙏

sampajano commented 1 year ago

Thank you very much for the quick fix! 👍 When can we expect a new release, please? 🙏

You're very welcome.. And yes of course.. No later than end of day tomorrow! 😃

sampajano commented 1 year ago

@augi Hi FYI I've cut a new release containing the bug fix here: https://github.com/grpc/grpc-web/releases/tag/1.4.1

Thanks again for the support! :)