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

Bugfix for field names with leading underscores #183

Merged
merged 2 commits into from
Jun 13, 2019

Conversation

jonny-improbable
Copy link
Contributor

If a proto field name has a leading underscore, the typescript definition (.d.ts) will be generated incorrectly (the first character will be upper case when it should be lower to match the file generated by protoc-gen-js).

This PR fixes this issue by stripping the leading underscore from the field name during code generation.

fixes #182

Changes

  • Add stripPrefix util method
  • Strip leading prefix from the field name before further processing is performed during d.ts generation

Verification

  • Added unit tests for stripPrefix
  • Added integration tests and a new proto to verify casing handling

If a proto field name has a leading underscore, the typescript definition (`.d.ts`) will be generated incorrectly (the first character will be upper case when it should be lower to match the file generated by protoc-gen-js).

This PR fixes this issue by stripping the leading underscore from the field name during code generation.

fixes #182
Copy link
Contributor

@easyCZ easyCZ left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the contribution. The tests look sound too!

@jonny-improbable jonny-improbable merged commit cf38460 into master Jun 13, 2019
@jonny-improbable jonny-improbable deleted the bugfix/182-leading-underscores branch June 13, 2019 21:47
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.

toObject produces object does not conform to AsObject
2 participants