Grpc-web: Typings do not match generated javascript

Created on 1 Oct 2017  Â·  6Comments  Â·  Source: improbable-eng/grpc-web

message validationReq {
    string accessToken = 1;
}

Produces a typings file with definitions like setAccessToken(...).

However the produced javascript does not honor the camelcase and creates the prototype function setAccesstoken(...).

Is this a .proto convention? A bug? It's late so I'm filing a short bug to see if there is a simple answer. Please let me know if more information is needed and I'd be happy to oblige.

Most helpful comment

We had similar issue in the past but resolved by following the protocol buffers style guide.

https://developers.google.com/protocol-buffers/docs/style

Your field name inside the message should look like this:

message validationReq {
string access_token = 1;
}

All 6 comments

Hi @b3ntly,

I believe this is using a JavaScript/TS convention where methods are camel-cased and begin with a lowercase letter. What is the behaviour you'd expect from the generated JS?

My expectation is that using a camel-case convention in my .proto definitions will translate to camel-cased stubs in the generated Go, TS, and JS code. The problem is that while the Go and Typescript definitions are properly camel-cased, the Javascript isn't.

For example calling .setAccessToken() will pass the Typescript compilation process but throw a runtime error because the actual prototype generated via JS is .setAccesstoken();

I'm hoping someone intimate with the codebase can point me to where this might be occurring so I can submit a quick PR, as I assume it is a bug and am frankly surprised nobody else has run into it.

Which version of protoc are you using?

Thanks

On Thu, 5 Oct 2017 04:22 Benjamin Jones, notifications@github.com wrote:

My expectation is that using a camel-case convention in my .proto
definitions will translate to camel-cased stubs in the generated Go, TS,
and JS code. The problem is that while the Go and Typescript definitions
are properly camel-cased, the Javascript isn't.

For example calling .setAccessToken() will pass the Typescript compilation
process but throw a runtime error because the actual prototype generated
via JS is .setAccesstoken();

I'm hoping someone intimate with the codebase can point me to where this
might be occurring so I can submit a quick PR, as I assume it is a bug and
am frankly surprised nobody else has run into it.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/improbable-eng/grpc-web/issues/92#issuecomment-334348225,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAMN-Y42F47gDaYisWUyG42sLTLxMMfIks5spEtngaJpZM4Ppxfq
.

3.4.1

The exact environment is outlined by this Dockerfile.

Thanks for the responses, there's no huge rush as this is not a production problem, just something I'd like to get to the bottom of.

We had similar issue in the past but resolved by following the protocol buffers style guide.

https://developers.google.com/protocol-buffers/docs/style

Your field name inside the message should look like this:

message validationReq {
string access_token = 1;
}

This looks to be resolved, can we close @MarcusLongmuir?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

igorgatis picture igorgatis  Â·  4Comments

osechet picture osechet  Â·  8Comments

ktr0731 picture ktr0731  Â·  13Comments

nhooyr picture nhooyr  Â·  20Comments

gertcuykens picture gertcuykens  Â·  15Comments