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

Fix snake_cased oneof message are generated to incorrect types #118

Merged
merged 2 commits into from
Oct 13, 2018

Conversation

riku179
Copy link
Contributor

@riku179 riku179 commented Oct 10, 2018

snake_cased oneof message are not match generated js codes like below.
So I've fixed the messages are generated correctly.

sample.proto

syntax = "proto3";

message Sample {
    message msg_one {
    }

    message msg_two {
    }

    oneof msg_type {
        msg_one MSG_ONE = 1;
        msg_two MSG_TWO = 2;
    }
}

generated sample_pb.d.ts

...
export enum Msg_typeCase {
  MSG_TYPE_NOT_SET = 0,
  MSG_ONE = 1,
  MSG_TWO = 2,
}

generated sample_pb.js

/**
 * @enum {number}
 */
proto.Sample.MsgTypeCase = { 
  MSG_TYPE_NOT_SET: 0,
  MSG_ONE: 1,
  MSG_TWO: 2
};

@jonnyreeves jonnyreeves merged commit 34d3d68 into improbable-eng:master Oct 13, 2018
@jonnyreeves
Copy link
Contributor

jonnyreeves commented Oct 13, 2018

Awesome, thanks for fixing this and adding tests; you can test out these changes by switching to 0.7.7-pre.34d3d68 on npm

coltonmorris pushed a commit to coltonmorris/ts-protoc-gen that referenced this pull request Oct 17, 2018
* upstream/master:
  Transport member of ServiceClientOptions should be optional (improbable-eng#125)
  Allow canceling unary calls (improbable-eng#124)
  CI should check that generated code has been committed (improbable-eng#127)
  Bumped to v0.7.8-pre (improbable-eng#123)
  Prepare 0.7.7 release (improbable-eng#112)
  Clean up Bazel Installation during Travis Build (improbable-eng#122)
  Don't deploy .deb files to npm (improbable-eng#121)
  Fix snake_cased oneof message are generated to incorrect types (improbable-eng#118)
  Make ServiceError optionally null (improbable-eng#116)
  Be explicit about the need for a CommonJS environment. (improbable-eng#108)
  Replace usage of `Object.assign` (improbable-eng#110)
  Add hint for Windows users (improbable-eng#107)
  Collapse Bazel Instructions in README (improbable-eng#106)
  Implement Client Streaming and BiDi Streaming for grpc-web (improbable-eng#82)
  Add support for jstype annotation (improbable-eng#104)
chrisgervang pushed a commit to chrisgervang/flowtype-protoc-gen that referenced this pull request Nov 14, 2018
…bable-eng#118)

* Fix oneOfName() returns incorrect type names

* Add integration tests
chrisgervang added a commit to chrisgervang/flowtype-protoc-gen that referenced this pull request Nov 16, 2018
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

Successfully merging this pull request may close these issues.

2 participants